mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-01-31 12:04:24 +01:00
properly log SFTP uploads
This commit is contained in:
@@ -376,14 +376,16 @@ class HoneyPotFilesystem(object):
|
||||
return True
|
||||
if self.tempfiles[fd] is not None:
|
||||
shasum = hashlib.sha256(open(self.tempfiles[fd], 'rb').read()).hexdigest()
|
||||
log.msg("SHA sum %s" % (shasum,))
|
||||
shasumfile = self.cfg.get('honeypot', 'download_path') + "/" + shasum
|
||||
log.msg(format='SFTP Uploaded file \"%(filename)s\" to %(outfile)s',
|
||||
eventid='COW0017', filename=os.path.basename(self.filenames[fd]), outfile=shasumfile, shasum=shasum )
|
||||
if (os.path.exists(shasumfile)):
|
||||
os.remove(self.tempfiles[fd])
|
||||
else:
|
||||
os.rename(self.tempfiles[fd], shasumfile)
|
||||
os.symlink(shasum, self.tempfiles[fd])
|
||||
self.update_realfile(self.getfile(self.filenames[fd]), shasumfile)
|
||||
|
||||
del self.tempfiles[fd]
|
||||
del self.filenames[fd]
|
||||
return os.close(fd)
|
||||
|
||||
@@ -52,6 +52,7 @@ import socket
|
||||
# COW0014 : direct-tcpip request
|
||||
# COW0015 : direct-tcpip data
|
||||
# COW0016 : key fingerprint
|
||||
# COW0017 : SFTP uploaded file
|
||||
|
||||
class Output(object):
|
||||
"""
|
||||
|
||||
@@ -272,7 +272,7 @@ class SFTPServerForCowrieUser(object):
|
||||
def realPath(self, path):
|
||||
"""
|
||||
"""
|
||||
log.msg("SFTP realPath: %s" % (path,))
|
||||
#log.msg("SFTP realPath: %s" % (path,))
|
||||
return self.fs.realpath(self._absPath(path))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user