Last active
November 12, 2021 12:47
-
-
Save edermi/e465058a08e9e744ea9765c473835796 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
import sys | |
def main(): | |
with open(sys.argv[1], 'rb') as f: | |
shellcode = f.read() | |
hexlified = ['0x{:02X}'.format(b) for b in shellcode] | |
with open(sys.argv[2], 'w') as f: | |
f.write(','.join(hexlified)) | |
sys.stderr.write("Shellcode length: {}".format(len(shellcode))) | |
if __name__ == '__main__': | |
try: | |
main() | |
except IndexError: | |
print("Usage: shellcode_to_hex_array beacon.bin beacon.hex") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment