harmonize artifact filenames. use transport + sessionid

This commit is contained in:
Michel Oosterhof 2016-04-13 20:32:35 +04:00
parent d3e651c215
commit 91498f836c
1 changed files with 6 additions and 2 deletions

View File

@ -36,8 +36,12 @@ class HoneyPotCommand(object):
index = self.args.index(">")
self.outfile = self.fs.resolve_path(str(self.args[(index + 1)]), self.protocol.cwd)
del self.args[index:]
self.safeoutfile = '%s/%s_%s' % (self.protocol.cfg.get('honeypot', 'download_path'),
time.strftime('%Y%m%d%H%M%S'), re.sub('[^A-Za-z0-9]', '_', "tmpecho"))
self.safeoutfile = '%s/%s-%s-%s-redir_%s' % (
self.protocol.cfg.get('honeypot', 'download_path'),
time.strftime('%Y%m%d-%H%M%S'),
self.protocol.terminal.transport.session.conn.transport.transportId,
self.protocol.terminal.transport.session.id,
re.sub('[^A-Za-z0-9]', '_', self.outfile))
perm = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
self.fs.mkfile(self.outfile, 0, 0, 0, stat.S_IFREG | perm)
with open(self.safeoutfile, 'a'):