mirror of
https://github.com/cowrie/cowrie.git
synced 2025-07-01 18:07:27 -04:00
Add flake8 to the Travis CI testing (#767)
* Add flake8 to the Travis CI testing * exceptions.AttributeError —> AttributeError * notImplementedError —> NotImplementedError * notImplementedError —> NotImplementedError * buffer was removed in Python 3 * New Style Exception for Python 3 * file() —> open() for Python 3 __file()__ was removed in Python 3 * from twisted.conch.ssh.common import getNS __getNS()__ is called on lines 208 and 209 but it is never imported. * New Style Exception again
This commit is contained in:

committed by
Michel Oosterhof

parent
6f2b3f8438
commit
d32cb40ce3
@ -8,6 +8,12 @@ python:
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
install: pip install -r requirements.txt
|
||||
before_script:
|
||||
- pip install flake8 # pytest # add another testing frameworks later
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
script: PYTHONPATH=${TRAVIS_BUILD_DIR} trial cowrie
|
||||
notifications:
|
||||
email: false
|
||||
|
@ -53,7 +53,7 @@ class FTP(object, ftplib.FTP):
|
||||
if resp[0] == '2':
|
||||
resp = self.getresp()
|
||||
if resp[0] != '1':
|
||||
raise ftplib.error_reply, resp
|
||||
raise ftplib.error_reply(resp)
|
||||
except:
|
||||
conn.close()
|
||||
raise
|
||||
@ -66,7 +66,7 @@ class FTP(object, ftplib.FTP):
|
||||
if resp[0] == '2':
|
||||
resp = self.getresp()
|
||||
if resp[0] != '1':
|
||||
raise ftplib.error_reply, resp
|
||||
raise ftplib.error_reply(resp)
|
||||
conn, sockaddr = sock.accept()
|
||||
if self.timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
|
||||
conn.settimeout(self.timeout)
|
||||
|
@ -132,7 +132,7 @@ class DBLogger(object):
|
||||
def ttylog(self, session):
|
||||
ttylog = None
|
||||
if session in self.ttylogs:
|
||||
f = file(self.ttylogs[session])
|
||||
f = open(self.ttylogs[session])
|
||||
ttylog = f.read(10485760)
|
||||
f.close()
|
||||
return ttylog
|
||||
|
@ -19,6 +19,10 @@ import cowrie.core.output
|
||||
|
||||
from cowrie.core.config import CONFIG
|
||||
|
||||
try:
|
||||
buffer # Python 2
|
||||
except NameError: # Python 3
|
||||
buffer = memoryview
|
||||
|
||||
"""
|
||||
From https://github.com/threatstream/kippo/blob/master/kippo/dblog/hpfeeds.py
|
||||
@ -43,6 +47,7 @@ SIZES = {
|
||||
|
||||
COWRIECHAN = 'cowrie.sessions'
|
||||
|
||||
|
||||
class BadClient(Exception):
|
||||
pass
|
||||
|
||||
|
@ -11,6 +11,7 @@ from twisted.internet import reactor, protocol
|
||||
from twisted.python import log
|
||||
from twisted.conch.ssh import common, keys, session
|
||||
from twisted.conch.client.knownhosts import KnownHostsFile
|
||||
from twisted.conch.ssh.common import getNS
|
||||
#from twisted.conch import endpoints
|
||||
|
||||
from cowrie.core.config import CONFIG
|
||||
|
@ -386,7 +386,7 @@ class HoneyPotFilesystem(object):
|
||||
"""
|
||||
"""
|
||||
# this should not be called, we intercept at readChunk
|
||||
raise notImplementedError
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def write(self, fd, string):
|
||||
@ -512,7 +512,7 @@ class HoneyPotFilesystem(object):
|
||||
def symlink(self, targetPath, linkPath):
|
||||
"""
|
||||
"""
|
||||
raise notImplementedError
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def rename(self, oldpath, newpath):
|
||||
|
@ -146,7 +146,7 @@ class HoneyPotCommand(object):
|
||||
# The session could be disconnected already, when his happens .transport is gone
|
||||
try:
|
||||
self.protocol.terminal.transport.processEnded(ret)
|
||||
except exceptions.AttributeError:
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user