12
12
import csv
13
13
from pathlib import Path
14
14
15
+ start_time = 0
16
+ end_time = 0
15
17
password_spray_query = '''
16
18
WITH FailedLogins AS (
17
19
@@ -96,7 +98,7 @@ def convert_csv(input_file,temp):
96
98
# Create a CSV reader
97
99
reader = csv .DictReader (csv_file )
98
100
99
- json_file = 'audit_data3 .json'
101
+ json_file = 'audit_data .json'
100
102
json_file = os .path .join (temp , json_file )
101
103
with open (json_file , 'w' , encoding = 'utf-8' ) as jsonl_file :
102
104
# Extract and write the AuditData column to a file as JSON Lines
@@ -205,8 +207,10 @@ def get_country_from_ip(ip, reader):
205
207
206
208
def analyzeoff365 (auditfile , rule_file , output , timezone , include_flattened_data = False ,
207
209
geolite_db_path = 'GeoLite2-Country.mmdb' ):
210
+ start_time = time .time ()
208
211
temp_dir = ".temp"
209
-
212
+ if output is None or output == "" :
213
+ output = os .path .splitext (auditfile )[0 ]
210
214
try :
211
215
# Create necessary directories
212
216
os .makedirs (output , exist_ok = True )
@@ -224,11 +228,11 @@ def analyzeoff365(auditfile, rule_file, output, timezone, include_flattened_data
224
228
db_name = os .path .join (temp_dir , 'audit_data.db' )
225
229
226
230
if rule_file is None :
227
- rule_file = 'lib/ O365_detection_rules.json'
231
+ rule_file = 'O365_detection_rules.json'
228
232
output_file = f"{ output } _o365_report.xlsx"
229
233
230
234
# Measure the start time
231
- start_time = time . time ()
235
+
232
236
233
237
# Flatten the JSON file
234
238
flattened_df = flatten_json_file (input_file , timezone )
0 commit comments