Skip to content

Commit 0e2ec40

Browse files
committed
fixed #327
1 parent 6ac6539 commit 0e2ec40

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ private void retrieveOptions() throws IOException, RPCClient.MSFException {
122122

123123
for(Map.Entry<String, HashMap<String, Object>> entry : ((HashMap<String,HashMap<String, Object>>)res).entrySet()) {
124124
String name = entry.getKey();
125-
Option option = new Option(name, entry.getValue());
125+
Option option;
126+
127+
try {
128+
option = new Option(name, entry.getValue());
129+
} catch (IllegalArgumentException e) {
130+
System.errorLogging(e);
131+
continue;
132+
}
126133

127134
if(name.equals("RHOST")) {
128135
if(parent != null)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ public enum types {
4242
private boolean mAdvanced,mRequired,mEvasion;
4343
private String[] enums;
4444

45-
public Option(String name, Map<String,Object> attrs) throws RuntimeException {
45+
public Option(String name, Map<String,Object> attrs) throws IllegalArgumentException {
4646
mName = name;
4747
mAttributes = attrs;
4848
// check for required data
4949
for(String field : requiredFields)
5050
if(!mAttributes.containsKey(field))
51-
throw new RuntimeException("missing "+field+" field");
51+
throw new IllegalArgumentException("missing "+field+" field");
5252
// get type
5353
String type = (String) mAttributes.get("type");
5454
if(!typesMap.containsKey(type))
55-
throw new RuntimeException("unknown option type: "+type);
55+
throw new IllegalArgumentException("unknown option type: "+type);
5656
mType = typesMap.get(type);
5757
if(mType == types.ENUM) {
5858
if(!mAttributes.containsKey("enums"))
59-
throw new RuntimeException("missing enums field");
59+
throw new IllegalArgumentException("missing enums field");
6060
//TODO: search if exists not string enums
6161
enums = new String[((ArrayList<String>)mAttributes.get("enums")).size()];
6262
enums = ((ArrayList<String>) mAttributes.get("enums")).toArray(enums);

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ private void retrieveOptions() throws IOException, RPCClient.MSFException {
4646

4747
for(Map.Entry<String, Map<String, Object>> entry :
4848
((Map<String,Map<String, Object>>)res).entrySet()) {
49-
Option o = new Option(entry.getKey(), entry.getValue());
49+
Option o;
50+
51+
try {
52+
o = new Option(entry.getKey(), entry.getValue());
53+
} catch (IllegalArgumentException e) {
54+
System.errorLogging(e);
55+
continue;
56+
}
5057

5158
if(entry.getKey().equals("LHOST")) {
5259
o.setValue(System.getNetwork().getLocalAddress().getHostAddress());

0 commit comments

Comments
 (0)