Skip to content

Commit ca2e1d4

Browse files
bobsbobs
authored andcommitted
Returns errors if an error occured
1 parent 1609c08 commit ca2e1d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Java.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self,args):
2929
String systemRootvariable;
3030
try {systemRootvariable = System.getenv("SystemRoot");}
3131
catch (ClassCastException e) {
32-
systemRootvariable = System.getProperty("SystemRoot");
32+
systemRootvariable = System.getProperty("SystemRoot");
3333
}
3434
finalCommand = new String[4];
3535
finalCommand[0] = systemRootvariable+"\\\system32\\\cmd.exe";
@@ -55,6 +55,7 @@ def __init__(self,args):
5555
}
5656
br_in.close();
5757
} catch (IOException ioe) {
58+
sb.append("IOException in input stream: ").append(ioe.getMessage());
5859
System.out.println("Error printing process output.");
5960
ioe.printStackTrace();
6061
} finally {
@@ -75,6 +76,7 @@ def __init__(self,args):
7576
}
7677
br_err.close();
7778
} catch (IOException ioe) {
79+
sb.append("IOException in error stream: ").append(ioe.getMessage());
7880
System.out.println("Error printing execution errors.");
7981
ioe.printStackTrace();
8082
} finally {
@@ -84,6 +86,7 @@ def __init__(self,args):
8486
}
8587
}
8688
catch (Exception ex) {
89+
sb.append("Exception: ").append(ex.getMessage());
8790
System.out.println(ex.getLocalizedMessage());
8891
}
8992
return sb.toString();
@@ -252,7 +255,7 @@ def runjavaModule(args):
252255
Run the JAVA module
253256
'''
254257
status = True
255-
if checkOptionsGivenByTheUser(args,["test-module","shell","reverse-shell"]) == False : return EXIT_MISS_ARGUMENT
258+
if checkOptionsGivenByTheUser(args,["test-module", "shell", "reverse-shell", "exec"]) == False : return EXIT_MISS_ARGUMENT
256259
java = Java(args)
257260
status = java.connection(stopIfError=True)
258261
if args['test-module'] == True :

0 commit comments

Comments
 (0)