2
0

emergency_tool.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # 주요 모듈 불러옴
  2. import json
  3. import sqlite3
  4. import threading
  5. # 기타 코드 불러옴
  6. from func import *
  7. from mark import load_conn2, namumark
  8. # JSON 불러옴
  9. json_data = open('set.json').read()
  10. set_data = json.loads(json_data)
  11. # 디비 연결
  12. conn = sqlite3.connect(set_data['db'] + '.db', check_same_thread = False)
  13. curs = conn.cursor()
  14. # 연결 전달
  15. load_conn2(conn)
  16. print('1. BackLink ReSet')
  17. print('2. ReCaptcha Delete')
  18. print('3. Ban Delete')
  19. print('')
  20. print('select : ', end = '')
  21. what_i_do = input()
  22. if what_i_do == '1':
  23. # 파싱 해주는 함수
  24. def parser(data):
  25. namumark(data[0], data[1], 1)
  26. # 역링크 전부 삭제
  27. curs.execute("delete from back")
  28. conn.commit()
  29. # 데이터에서 제목이랑 내용 불러옴
  30. curs.execute("select title, data from data")
  31. data = curs.fetchall()
  32. # for 돌려서 처리
  33. for test in data:
  34. # 스레드 기반으로 처리
  35. t = threading.Thread(target = parser, args = [test])
  36. t.start()
  37. t.join()
  38. elif what_i_do == '2':
  39. # 데이터 삭제
  40. curs.execute("delete from other where name = 'recaptcha'")
  41. curs.execute("delete from other where name = 'sec_re'")
  42. elif what_i_do == '3':
  43. print('IP or User_Name : ', end = '')
  44. user_data = input()
  45. if re.search("^([0-9]{1,3}\.[0-9]{1,3})$", user_data):
  46. band = 'O'
  47. else:
  48. band = ''
  49. # 데이터 삭제
  50. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [user_data, '해제', get_time(), 'localhost', '', band])
  51. curs.execute("delete from ban where block = ?", [user_data])
  52. # 커밋
  53. conn.commit()