Skip to content

Commit

Permalink
Bug fix with outputfile logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RazzburyPi committed May 2, 2024
1 parent a338dfd commit 9c5fd53
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/smbclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def main():

shell = MiniImpacketShell(smbClient, None, options.outputfile)

if options.outputfile is not None:
f = open(options.outputfile, 'a')
f.write('=' * 20 + '\n' + options.target_ip + '\n' + '=' * 20 + '\n')
f.close()

if options.inputfile is not None:
logging.info("Executing commands from %s" % options.inputfile.name)
for line in options.inputfile.readlines():
Expand All @@ -113,10 +118,8 @@ def main():
else:
print(line, end=' ')
else:
f = open(options.outputfile, 'a')
f.write('=' * 20 + '\n' + options.target_ip + '\n' + '=' * 20 + '\n')
f.close()
shell.cmdloop()

except Exception as e:
if logging.getLogger().level == logging.DEBUG:
import traceback
Expand Down

0 comments on commit 9c5fd53

Please sign in to comment.