It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/python
#A simple xor encoder
#Xor the input file with 0-255
#Written by s1n4
import sys
def usage() :
print 'Usage: %s [Key] [File]' % sys.argv[0]
print '[Key] 0x00-0xff same as 0-255'
exit()
def xor(key, fn) :
try :
Input = open(fn, 'rb').read()
except IOError :
usage()
res = ''
for i in Input :
try :
res += chr(ord(i) ^ eval(key))
except :
usage()
try :
Output = open(fn, 'wb')
Output.write(res)
finally :
Output.close()
print fn, 'xor', key
def main() :
if len(sys.argv) == 3 :
xor(sys.argv[1], sys.argv[2])
else :
usage()
main()
xor.py 0x4a test.txt