i try to read file of bytes written in hex for example: (909090) which is nop nop nop in assembly, i want to xor each two digit as a byte with the 0x91.
how do i print the value in hex? now it prints just numbers with no meaning.
in general i want to build a packer to my assembly code.
def add_prefix(a):
a = str(a)
a = '0x' + a
a = int(a, 16)
return a
fr = open('C:\code.txt', 'r')
word = ''
b = ''
for line in fr:
b += line
count = 0
for char in b:
char = str(char)
word += char
if count%2 == 0:
word = int(str(add_prefix(word)^91), 16)
print word
word = ""
The algorithm needed is quite simple:
0x91)