Skip to content

Commit 1800215

Browse files
committed
fixes #306
1 parent af5972a commit 1800215

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cSploit/src/org/csploit/android/net/metasploit/MsfExploit.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,15 @@ private void retrieveInfos() throws IOException, RPCClient.MSFException {
175175
for(Map.Entry<Integer, String> e : ((Map<Integer,String>)res).entrySet()) {
176176
targets.add(e.getValue());
177177
}
178-
currentTarget = targets.get((Integer)map.get("default_target"));
178+
179+
Integer def = (Integer) map.get("default_target");
180+
if(def != null) {
181+
currentTarget = targets.get(def);
182+
} else if(!targets.isEmpty()) {
183+
currentTarget = targets.get(0);
184+
} else {
185+
currentTarget = null;
186+
}
179187
}
180188

181189
// get authors
@@ -224,7 +232,8 @@ public boolean launch() throws RPCClient.MSFException {
224232
try {
225233
Map<String,Object> opts = new HashMap<String, Object>();
226234

227-
opts.put("TARGET", currentTarget);
235+
if(currentTarget != null)
236+
opts.put("TARGET", currentTarget);
228237

229238
Collection<Option> allOptions = new ArrayList<>(options);
230239

0 commit comments

Comments
 (0)