
Untitled
By: a guest on Jan 16th, 2011 | syntax:
Python | size: 0.42 KB | hits: 121 | expires: Never
#WILL `CORRUPT` A BMP
import struct
string = "SECRET MESSAGE"
stdin = open("YourBMPhere.bmp","r")
x = stdin.read()
stdin.close()
offset = struct.unpack("<I",x[10:14])[0]
x,y = x[:offset],x[offset:]
z = ''
for char in y:
z+=(chr(ord(char)^2))
new_offset = offset+len(string)
x = x+struct.pack("<I",new_offset)+string+z
stdout = open("result.bmp","w+")
stdout.write(x)
stdout.close()