mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-18 14:34:22 +01:00
committed by
Michel Oosterhof
parent
0254a78d53
commit
cbb02c7f04
@@ -45,9 +45,18 @@ class HoneyPotCommand(object):
|
|||||||
self.protocol.terminal.transport.session.id,
|
self.protocol.terminal.transport.session.id,
|
||||||
re.sub('[^A-Za-z0-9]', '_', self.outfile))
|
re.sub('[^A-Za-z0-9]', '_', self.outfile))
|
||||||
perm = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
|
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)
|
try:
|
||||||
with open(self.safeoutfile, 'a'):
|
self.fs.mkfile(self.outfile, 0, 0, 0, stat.S_IFREG | perm)
|
||||||
self.fs.update_realfile(self.fs.getfile(self.outfile), self.safeoutfile)
|
except fs.FileNotFound:
|
||||||
|
# The outfile locates at a non-existing directory.
|
||||||
|
self.protocol.pp.outReceived('-bash: %s: No such file or directory\n' % self.outfile)
|
||||||
|
self.write = self.write_to_failed
|
||||||
|
self.outfile = None
|
||||||
|
self.safeoutfile = None
|
||||||
|
|
||||||
|
else:
|
||||||
|
with open(self.safeoutfile, 'a'):
|
||||||
|
self.fs.update_realfile(self.fs.getfile(self.outfile), self.safeoutfile)
|
||||||
|
|
||||||
|
|
||||||
def check_arguments(self, application, args):
|
def check_arguments(self, application, args):
|
||||||
@@ -78,10 +87,16 @@ class HoneyPotCommand(object):
|
|||||||
self.fs.update_size(self.outfile, self.writtenBytes)
|
self.fs.update_size(self.outfile, self.writtenBytes)
|
||||||
|
|
||||||
|
|
||||||
|
def write_to_failed(self, data):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
self.call()
|
if self.write != self.write_to_failed:
|
||||||
|
self.call()
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user