Created
May 11, 2024 22:52
-
-
Save therealdreg/2860a4980e3ded53563f35d245763bf6 to your computer and use it in GitHub Desktop.
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
push string generator x86 assembly shellcode malware exploits | |
#!/usr/bin/env python3 | |
# by Dreg | |
import sys | |
def string_to_hex_chunks(input_string): | |
byte_array = input_string.encode('utf-8') | |
hex_blocks = [] | |
for i in range(0, len(byte_array), 4): | |
block = byte_array[i:i+4] | |
# Primero ajustar la longitud del bloque antes de revertirlo | |
full_block = block + b'\x00' * (4 - len(block)) | |
reversed_block = full_block[::-1] | |
block_int = int.from_bytes(reversed_block, byteorder='big') | |
hex_blocks.append(f'push 0x{block_int:08X}') | |
for block in reversed(hex_blocks): | |
print(block) | |
def main(): | |
if len(sys.argv) != 2: | |
print("Usage: python script.py 'string'") | |
sys.exit(1) | |
input_string = sys.argv[1] | |
string_to_hex_chunks(input_string) | |
if __name__ == '__main__': | |
main() | |
``` | |
dreg@leno ~/Desktop/dreg_nasm_win32_template | |
$ python pushcreator.py FT_CreateDeviceInfoListABCD | |
push 0x00444342 | |
push 0x41747369 | |
push 0x4C6F666E | |
push 0x49656369 | |
push 0x76654465 | |
push 0x74616572 | |
push 0x435F5446 | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment