3x5w4rup

Decoder For Base64

May 22nd, 2014
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. ##########################
  4. #Base64 Decode by Saha #
  5. # Quick 'N' Dirty, no BS #
  6. ##########################
  7.  
  8.  
  9. # Required library
  10. import base64
  11.  
  12.  
  13. # Useless filler
  14. filler = ''
  15.  
  16.  
  17. # Open input file, too lazy to create args
  18. fin = open("base64file.txt","r")
  19.  
  20.  
  21. # Read contents of file (I know I know)
  22. finvar = fin.read()
  23.  
  24.  
  25. # Don't forget to close the file.
  26. fin.close()
  27.  
  28.  
  29. # Remove useless PHP code when decoding
  30. rmrf_bs01 = finvar.replace('<?php eval("?>".base64_decode("','')
  31. rmrf_bs02 = rmrf_bs01.replace('")); ?>','')
  32.  
  33.  
  34. # Decode first round
  35. var1 = base64.b64decode(rmrf_bs02)
  36.  
  37.  
  38. # Remove more useless PHP code
  39. rmrf_bs03 = var1.replace('<?php eval("?>".base64_decode("','')
  40. rmrf_bs04 = rmrf_bs03.replace('")); ?>','')
  41.  
  42.  
  43. # Decode second round
  44. var2 = base64.b64decode(rmrf_bs04)
  45.  
  46.  
  47. usr = raw_input('[?] Print to screen or file?\n[!] Write "screen" or "file": ')
  48.  
  49.  
  50. if(usr == 'screen'):
  51.     print var2
  52. elif(usr == 'file'):
  53.     print "[*] Printing to file: output.txt ..."
  54.     fout = open('output.txt', 'w+')
  55.     fout.write(var2)
  56.     fout.close()
  57. else:
  58.     print "[*] You typed something else."
Advertisement
Add Comment
Please, Sign In to add comment