emergency_tool.py 2.5 KB

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