Skip to content

Commit c379445

Browse files
committed
fixes for windows
1 parent 85df26b commit c379445

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
File renamed without changes.

lib/O365Hunter.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import csv
1313
from pathlib import Path
1414

15+
start_time=0
16+
end_time=0
1517
password_spray_query = '''
1618
WITH FailedLogins AS (
1719
@@ -96,7 +98,7 @@ def convert_csv(input_file,temp):
9698
# Create a CSV reader
9799
reader = csv.DictReader(csv_file)
98100

99-
json_file = 'audit_data3.json'
101+
json_file = 'audit_data.json'
100102
json_file=os.path.join(temp, json_file)
101103
with open(json_file, 'w', encoding='utf-8') as jsonl_file:
102104
# Extract and write the AuditData column to a file as JSON Lines
@@ -205,8 +207,10 @@ def get_country_from_ip(ip, reader):
205207

206208
def analyzeoff365(auditfile, rule_file, output, timezone, include_flattened_data=False,
207209
geolite_db_path='GeoLite2-Country.mmdb'):
210+
start_time = time.time()
208211
temp_dir = ".temp"
209-
212+
if output is None or output == "":
213+
output = os.path.splitext(auditfile)[0]
210214
try:
211215
# Create necessary directories
212216
os.makedirs(output, exist_ok=True)
@@ -224,11 +228,11 @@ def analyzeoff365(auditfile, rule_file, output, timezone, include_flattened_data
224228
db_name = os.path.join(temp_dir, 'audit_data.db')
225229

226230
if rule_file is None:
227-
rule_file = 'lib/O365_detection_rules.json'
231+
rule_file = 'O365_detection_rules.json'
228232
output_file = f"{output}_o365_report.xlsx"
229233

230234
# Measure the start time
231-
start_time = time.time()
235+
232236

233237
# Flatten the JSON file
234238
flattened_df = flatten_json_file(input_file, timezone)

0 commit comments

Comments
 (0)