emergency_tool.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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('')
  17. print('select : ', end = '')
  18. what_i_do = input()
  19. if what_i_do == '1':
  20. # 파싱 해주는 함수
  21. def parser(data):
  22. namumark(conn, data[0], data[1], 1)
  23. # 역링크 전부 삭제
  24. curs.execute("delete from back")
  25. conn.commit()
  26. # 데이터에서 제목이랑 내용 불러옴
  27. curs.execute("select title, data from data")
  28. data = curs.fetchall()
  29. # for 돌려서 처리
  30. for test in data:
  31. # 스레드 기반으로 처리
  32. t = threading.Thread(target = parser, args = [test])
  33. t.start()
  34. t.join()
  35. elif what_i_do == '2':
  36. # 데이터 삭제
  37. curs.execute("delete from other where name = 'recaptcha'")
  38. curs.execute("delete from other where name = 'sec_re'")
  39. # 커밋
  40. conn.commit()