1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| import base64 import sys
def deStego(stegoFile): b64table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" with open(stegoFile,'r') as stegoText: message = "" for line in stegoText: try: text = line[line.index("=") - 1:-1] message += "".join([ bin( 0 if i == '=' else b64table.find(i))[2:].zfill(6) for i in text])[2 if text.count('=') ==2 else 4:6] except: pass return "".join([chr(int(message[i:i+8],2)) for i in range(0,len(message),8)])
if __name__ == "__main__": if len(sys.argv) == 2: print(deStego(sys.argv[1])) else: print(deStego("stego.txt"))
|