Advertisement
Guest User

l0ukanik0s -2014 931vii

a guest
Sep 12th, 2014
2,564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import zlib
  3. #scripte originated from http://reverseengineering.stackexchange.com/questions/3593/re-compressed-backup-file-router-linux-based-so-is-it-compresed-with-zlib
  4. print "################################################"
  5. print "#       THe W0lf is so  close                  #"
  6. print "# ZTE 931Vii Router configuration unpacker     #
  7. print "#       Find configuration file @              #"
  8. print "#  http://192.168.1.1/manager_dev_config_t.gch #"
  9. print "#      L0ukanik0s 2014 Hack-Hosting            #"
  10. print "#        [email protected]                #"
  11. print "################################################"
  12.  
  13. print "Enter your config.bin path: e.g root@l0ukanik0s:~#/Desktop/931router_config.bin"
  14. configfile = raw_input("File Path :").strip()
  15.  
  16. magic_numbers = ['\x78\xDA']
  17. filename = configfile
  18.  
  19.  
  20. infile = open(filename, 'r')
  21. data = infile.read()
  22.  
  23.  
  24. pos = 0
  25. found = False
  26.  
  27.  
  28. while pos < len(data):
  29.     window = data[pos:pos+2]
  30.     for marker in magic_numbers:
  31.         if window == marker:
  32.             found = True
  33.             start = pos
  34.             print "Start of zlib %s" % pos
  35.             rest_of_data = data[start:]
  36.             decomp_obj = zlib.decompressobj()
  37.             uncompressed_msg = decomp_obj.decompress(rest_of_data)         
  38.             print "Configuration of ZTE 931 File Content: %s" % uncompressed_msg
  39.             break
  40.     if pos == len(data):
  41.         break
  42.     pos += 1
  43.  
  44.  
  45. if found:
  46.     header = data[:start]
  47.     footer = decomp_obj.unused_data
  48.  
  49.  
  50. if not found:
  51.     print "Sorry, no zlib found."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement