It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/python
################################
##### #####
##### Xor encoder #####
##### For encoding file #####
##### #####
##### Writen by s1n4 #####
##### June 16 , 2011 #####
##### 3:55 AM #####
##### #####
################################
import sys
def usage() :
print 'Usage: %s [Key] [File]' % sys.argv[0]
exit()
def xor(key, fn) :
try :
Input = open(fn, 'rb').read()
except IOError :
usage()
res = ''
c = 0
for i in Input :
res += chr(ord(i) ^ ord(key[c]))
if c == len(key) - 1 :
c = 0
continue
c += 1
try :
Output = open(fn, 'wb')
Output.write(res)
finally :
Output.close()
print key, 'xor', fn
def main() :
if len(sys.argv) == 3 :
xor(sys.argv[1], sys.argv[2])
else :
usage()
main()
xor.py s1n4 test.zip