Nmap Development mailing list archives

Re: [NSE] jboss-vuln-cve2010-0738.nse


From: Patrik Karlsson <patrik () cqure net>
Date: Sun, 17 Jun 2012 10:31:25 +0200



This code seems to work well for me;

 public static Process getShell() {

    String[] cmds = {"cmd.exe", "/bin/sh"};

     for ( String cmd : cmds ) {

        try {

            return Runtime.getRuntime().exec(cmd);

        }

        catch(IOException e) { }

    }

    return null;

}


The function is probably better of this way (thanks Martin for pointing
that out), to maintain backward compatibility:

public static Process getShell()
{
String[] cmds = {"cmd.exe", "/bin/sh"};
 for ( int i=0; i<cmds.length; i++ )
{
try {
return Runtime.getRuntime().exec(cmds[i]);
}
catch(IOException e) { }
}
return null;
}

Cheers,
Patrik
-- 
Patrik Karlsson
http://www.cqure.net
http://twitter.com/nevdull77
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: