mirror of
https://github.com/cowrie/cowrie.git
synced 2025-07-01 18:07:27 -04:00
set file ownership of downloaded files
This commit is contained in:
@ -345,6 +345,8 @@ Options: (H) means HTTP/HTTPS only, (F) means FTP only
|
|||||||
|
|
||||||
# Update the honeyfs to point to downloaded file
|
# Update the honeyfs to point to downloaded file
|
||||||
self.fs.update_realfile(self.fs.getfile(outfile), hashPath)
|
self.fs.update_realfile(self.fs.getfile(outfile), hashPath)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
|
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -137,6 +137,8 @@ Download a file via FTP
|
|||||||
|
|
||||||
# Update the honeyfs to point to downloaded file
|
# Update the honeyfs to point to downloaded file
|
||||||
self.fs.update_realfile(self.fs.getfile(fakeoutfile), hash_path)
|
self.fs.update_realfile(self.fs.getfile(fakeoutfile), hash_path)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
|
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def ftp_download(self, safeoutfile):
|
def ftp_download(self, safeoutfile):
|
||||||
|
|||||||
@ -189,6 +189,7 @@ gcc version %s (Debian %s-5)""" % (version, version_short, version_short, versio
|
|||||||
# Create file for the protocol
|
# Create file for the protocol
|
||||||
self.fs.mkfile(outfile, 0, 0, len(data), 33188)
|
self.fs.mkfile(outfile, 0, 0, len(data), 33188)
|
||||||
self.fs.update_realfile(self.fs.getfile(outfile), safeoutfile)
|
self.fs.update_realfile(self.fs.getfile(outfile), safeoutfile)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
|
|
||||||
# Segfault command
|
# Segfault command
|
||||||
class segfault_command(HoneyPotCommand):
|
class segfault_command(HoneyPotCommand):
|
||||||
|
|||||||
@ -76,6 +76,7 @@ class command_tftp(HoneyPotCommand):
|
|||||||
else:
|
else:
|
||||||
self.fs.mkfile(self.file_to_get, 0, 0, 0, 33188)
|
self.fs.mkfile(self.file_to_get, 0, 0, 0, 33188)
|
||||||
self.fs.update_realfile(self.fs.getfile(self.file_to_get), self.safeoutfile)
|
self.fs.update_realfile(self.fs.getfile(self.file_to_get), self.safeoutfile)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
except tftpy.TftpException as err:
|
except tftpy.TftpException as err:
|
||||||
if tclient and tclient.context and not tclient.context.fileobj.closed:
|
if tclient and tclient.context and not tclient.context.fileobj.closed:
|
||||||
tclient.context.fileobj.close()
|
tclient.context.fileobj.close()
|
||||||
@ -111,6 +112,7 @@ class command_tftp(HoneyPotCommand):
|
|||||||
|
|
||||||
# Update the honeyfs to point to downloaded file
|
# Update the honeyfs to point to downloaded file
|
||||||
self.fs.update_realfile(self.fs.getfile(self.file_to_get), hash_path)
|
self.fs.update_realfile(self.fs.getfile(self.file_to_get), hash_path)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -222,6 +222,7 @@ class command_wget(HoneyPotCommand):
|
|||||||
|
|
||||||
# Update the honeyfs to point to downloaded file
|
# Update the honeyfs to point to downloaded file
|
||||||
self.fs.update_realfile(self.fs.getfile(outfile), hash_path)
|
self.fs.update_realfile(self.fs.getfile(outfile), hash_path)
|
||||||
|
self.fs.chown(outfile, self.protocol.user.uid, self.protocol.user.gid)
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user