emergency_tool.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import json
  2. import sqlite3
  3. import bcrypt
  4. import threading
  5. from func import *
  6. from mark import load_conn2, namumark
  7. json_data = open('set.json').read()
  8. set_data = json.loads(json_data)
  9. conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
  10. curs = conn.cursor()
  11. load_conn(conn)
  12. print('1. backlink reset')
  13. print('2. recaptcha delete')
  14. print('3. ban delete')
  15. print('4. change port')
  16. print('5. change skin')
  17. print('6. change password')
  18. print('select : ', end = '')
  19. what_i_do = input()
  20. if what_i_do == '1':
  21. def parser(data):
  22. namumark(data[0], data[1], 1)
  23. curs.execute("delete from back")
  24. conn.commit()
  25. curs.execute("select title, data from data")
  26. data = curs.fetchall()
  27. num = 0
  28. for test in data:
  29. num += 1
  30. t = threading.Thread(target = parser, args = [test])
  31. t.start()
  32. t.join()
  33. if num % 10 == 0:
  34. print(num)
  35. elif what_i_do == '2':
  36. curs.execute("delete from other where name = 'recaptcha'")
  37. curs.execute("delete from other where name = 'sec_re'")
  38. elif what_i_do == '3':
  39. print('ip or name : ', end = '')
  40. user_data = input()
  41. if re.search("^([0-9]{1,3}\.[0-9]{1,3})$", user_data):
  42. band = 'O'
  43. else:
  44. band = ''
  45. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [user_data, load_lang('release', 1), get_time(), load_lang('tool', 1) + ':emergency', '', band])
  46. curs.execute("delete from ban where block = ?", [user_data])
  47. elif what_i_do == '4':
  48. print('port : ', end = '')
  49. port = input()
  50. curs.execute("update other set data = ? where name = 'port'", [port])
  51. elif what_i_do == '5':
  52. print('skin name : ', end = '')
  53. skin = input()
  54. curs.execute("update other set data = ? where name = 'skin'", [skin])
  55. elif what_i_do == '6':
  56. print('1. bcrypt')
  57. print('select : ', end = '')
  58. what_i_do = input()
  59. print('user name : ', end = '')
  60. user_name = input()
  61. print('user password : ', end = '')
  62. user_pw = input()
  63. if what_i_do == '1':
  64. hashed = bcrypt.hashpw(bytes(user_pw, 'utf-8'), bcrypt.gensalt()).decode()
  65. curs.execute("update user set pw = ? where id = ?", [hashed, user_name])
  66. conn.commit()
  67. print('ok')