Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit a6cc776

Browse files
author
byt3bl33d3r
committed
No reason to save output to a log file it there's no output :/
1 parent 91ab69d commit a6cc776

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

modules/credentials/mimikatz.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def on_response(self, context, response):
212212
context.db.add_credential(credtype, domain, username, password)
213213
context.log.highlight('{}\\{}:{}'.format(domain, username, password))
214214

215-
log_name = 'Mimikatz-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
216-
with open('logs/' + log_name, 'w') as mimikatz_output:
217-
mimikatz_output.write(data)
218-
context.log.info("Saved Mimikatz's output to {}".format(log_name))
215+
log_name = 'Mimikatz-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
216+
with open('logs/' + log_name, 'w') as mimikatz_output:
217+
mimikatz_output.write(data)
218+
context.log.info("Saved Mimikatz's output to {}".format(log_name))

modules/situational_awareness/get_computers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ def on_response(self, context, response):
8888
#We've received the response, stop tracking this host
8989
response.stop_tracking_host()
9090

91-
if len(data) > 0:
91+
if len(data):
9292
def print_post_data(data):
9393
buf = StringIO(data.strip()).readlines()
9494
for line in buf:
9595
context.log.highlight(line.strip())
9696

9797
print_post_data(data)
9898

99-
log_name = 'Computers-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
100-
with open('logs/' + log_name, 'w') as log_file:
101-
log_file.write(data)
102-
context.log.info("Saved output to {}".format(log_name))
99+
log_name = 'Computers-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
100+
with open('logs/' + log_name, 'w') as log_file:
101+
log_file.write(data)
102+
context.log.info("Saved output to {}".format(log_name))

modules/situational_awareness/get_group_members.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ def on_response(self, context, response):
8080
#We've received the response, stop tracking this host
8181
response.stop_tracking_host()
8282

83-
if len(data) > 0:
83+
if len(data):
8484
def print_post_data(data):
8585
buf = StringIO(data.strip()).readlines()
8686
for line in buf:
8787
context.log.highlight(line.strip())
8888

8989
print_post_data(data)
9090

91-
log_name = 'GroupMembers-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
92-
with open('logs/' + log_name, 'w') as log_file:
93-
log_file.write(data)
94-
context.log.info("Saved output to {}".format(log_name))
91+
log_name = 'GroupMembers-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
92+
with open('logs/' + log_name, 'w') as log_file:
93+
log_file.write(data)
94+
context.log.info("Saved output to {}".format(log_name))

modules/situational_awareness/get_groups.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ def on_response(self, context, response):
8080
#We've received the response, stop tracking this host
8181
response.stop_tracking_host()
8282

83-
if len(data) > 0:
83+
if len(data):
8484
def print_post_data(data):
8585
buf = StringIO(data.strip()).readlines()
8686
for line in buf:
8787
context.log.highlight(line.strip())
8888

8989
print_post_data(data)
9090

91-
log_name = 'Groups-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
92-
with open('logs/' + log_name, 'w') as log_file:
93-
log_file.write(data)
94-
context.log.info("Saved output to {}".format(log_name))
91+
log_name = 'Groups-{}-{}.log'.format(response.client_address[0], datetime.now().strftime("%Y-%m-%d_%H%M%S"))
92+
with open('logs/' + log_name, 'w') as log_file:
93+
log_file.write(data)
94+
context.log.info("Saved output to {}".format(log_name))

0 commit comments

Comments
 (0)