2
0

emergency_tool.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 주요 모듈 불러옴
  2. import json
  3. import sqlite3
  4. import threading
  5. # 기타 코드 불러옴
  6. from func import *
  7. from mark import 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. print('1. BackLink ReSet')
  15. print('2. ReCaptcha Delete')
  16. print('3. Ban Delete')
  17. print('')
  18. print('select : ', end = '')
  19. what_i_do = input()
  20. if what_i_do == '1':
  21. # 파싱 해주는 함수
  22. def parser(data):
  23. namumark(conn, data[0], data[1], 1)
  24. # 역링크 전부 삭제
  25. curs.execute("delete from back")
  26. conn.commit()
  27. # 데이터에서 제목이랑 내용 불러옴
  28. curs.execute("select title, data from data")
  29. data = curs.fetchall()
  30. # for 돌려서 처리
  31. for test in data:
  32. # 스레드 기반으로 처리
  33. t = threading.Thread(target = parser, args = [test])
  34. t.start()
  35. t.join()
  36. elif what_i_do == '2':
  37. # 데이터 삭제
  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 User_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. # 데이터 삭제
  48. curs.execute("insert into rb (block, end, today, blocker, why, band) values (?, ?, ?, ?, ?, ?)", [user_data, '해제', get_time(), 'localhost', '', band])
  49. curs.execute("delete from ban where block = ?", [user_data])
  50. # 커밋
  51. conn.commit()