set file ownership of downloaded files

This commit is contained in:
Michel Oosterhof
2017-05-23 09:41:35 +04:00
parent 4aa5824e87
commit 196f83ff24
5 changed files with 8 additions and 0 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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):

View File

@ -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()

View File

@ -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()