mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-17 22:14:19 +01:00
py3 style exceptions
This commit is contained in:
@@ -148,7 +148,7 @@ Download a file via FTP
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
ftp.connect(host=self.host, port=self.port, timeout=30)
|
ftp.connect(host=self.host, port=self.port, timeout=30)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
log.msg('FTP connect failed: host=%s, port=%s, err=%s' % (self.host, self.port, str(e)))
|
log.msg('FTP connect failed: host=%s, port=%s, err=%s' % (self.host, self.port, str(e)))
|
||||||
self.write('ftpget: can\'t connect to remote host: Connection refused\n')
|
self.write('ftpget: can\'t connect to remote host: Connection refused\n')
|
||||||
return False
|
return False
|
||||||
@@ -167,7 +167,7 @@ Download a file via FTP
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
ftp.login(user=self.username, passwd=self.password)
|
ftp.login(user=self.username, passwd=self.password)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
log.msg('FTP login failed: user=%s, passwd=%s, err=%s' % (self.username, self.password, str(e)))
|
log.msg('FTP login failed: user=%s, passwd=%s, err=%s' % (self.username, self.password, str(e)))
|
||||||
self.write('ftpget: unexpected server response to USER: %s\n' % str(e))
|
self.write('ftpget: unexpected server response to USER: %s\n' % str(e))
|
||||||
ftp.quit()
|
ftp.quit()
|
||||||
@@ -183,7 +183,7 @@ Download a file via FTP
|
|||||||
try:
|
try:
|
||||||
ftp.cwd(self.remote_dir)
|
ftp.cwd(self.remote_dir)
|
||||||
ftp.retrbinary('RETR %s' % self.remote_file, open(safeoutfile, 'wb').write)
|
ftp.retrbinary('RETR %s' % self.remote_file, open(safeoutfile, 'wb').write)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
log.msg('FTP retrieval failed: %s' % str(e))
|
log.msg('FTP retrieval failed: %s' % str(e))
|
||||||
self.write('ftpget: unexpected server response to USER: %s\n' % str(e))
|
self.write('ftpget: unexpected server response to USER: %s\n' % str(e))
|
||||||
ftp.quit()
|
ftp.quit()
|
||||||
|
|||||||
Reference in New Issue
Block a user