Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
' Sometimes, after generating a metasploit payload with vba output format, you get a payload which is too long
' for the vba line continuation limit (24 line continuation max)
' So you have to split the payload in two arrays, then merge them again.
'
' This snippet shows the simple trick
Dim PayloadPart1, PayloadPart2, Final As Variant
PayloadPart1 = Array ( whatever metasploit first part payload with line _
continuation _
and again _
and again _
until you close it)
PayloadPart2 = Array ( whatever metasploit second part payload with line _
continuation _
and again _
and again _
until you close it)
' Now merge both arrays into one containing the whole payload
ReDim Final(UBound(PayloadPart1) + UBound(PayloadPart2) + 1)
Dim i As Integer
For i = 0 To Ubound(PayloadPart1)
Final(i) = PayloadPart1(i)
Next i
For i = 0 To Ubound(PayloadPart2)
Final(UBound(PayloadPart1) + 1 + i) = PayloadPart2(i)
Next i
' There you go. Now VirtualAlloc, RtlMoveMemory, CreateThread and so on...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.