1
1
import os
2
2
import binascii
3
3
import re
4
- from datetime import datetime
4
+ from django . utils import timezone
5
5
6
6
from django .apps import AppConfig
7
7
from django .contrib .auth import get_user_model
@@ -27,15 +27,20 @@ def create_flag():
27
27
28
28
29
29
def get_time_passed_after_last_attack (attack_team , target_team ):
30
+ now_time = int (timezone .localtime ().strftime ("%Y%m%d%H%M%S" ))
30
31
last_attack_time = 0
31
32
try :
32
- last_attack = XssLog .objects .filter (from_team = attack_team ,
33
+ attacks = XssLog .objects .filter (from_team = attack_team ,
33
34
to_team = target_team ,
34
- succeed = True ).latest ()
35
- last_attack_time = int (last_attack .created_at .strftime ("%Y%m%d%H%M%S" ))
35
+ succeed = True )
36
+ if len (attacks ) == 0 :
37
+ return now_time
38
+ last_attack = attacks .last ()
39
+ last_attack_time = int (last_attack .created_at_korean_time .strftime ("%Y%m%d%H%M%S" ))
36
40
except XssLog .DoesNotExist :
37
41
pass
38
- return int (datetime .now ().strftime ("%Y%m%d%H%M%S" )) - last_attack_time
42
+ print (now_time - last_attack_time )
43
+ return now_time - last_attack_time
39
44
40
45
41
46
def query_xss (attack_team_name : str , target_team_name : str , query : str ):
@@ -60,7 +65,7 @@ def query_xss(attack_team_name: str, target_team_name: str, query: str):
60
65
xss_log .query = query
61
66
xss_log .save ()
62
67
63
- checked , succeed = check_alert (f'http://localhost:8000 /xss/{ xss_log .hash } ' )
68
+ checked , succeed = check_alert (f'http://plus.or.kr:17354 /xss/{ xss_log .hash } / ' )
64
69
xss_log .checked = checked
65
70
xss_log .succeed = succeed
66
71
xss_log .save ()
0 commit comments