2016-04-28 10:44:40 +00:00
|
|
|
#!/usr/bin/env python
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2015-12-11 14:22:28 +00:00
|
|
|
################################################################
|
2016-07-14 07:04:12 +00:00
|
|
|
# This is a command line interpreter used to edit
|
2015-05-12 14:57:29 +00:00
|
|
|
# cowrie file system pickle files.
|
2013-04-05 12:13:00 +00:00
|
|
|
#
|
2015-12-11 14:22:28 +00:00
|
|
|
# It is intended to mimic a basic bash shell and supports
|
|
|
|
# relative file references.
|
2013-04-05 12:13:00 +00:00
|
|
|
#
|
2015-12-11 14:22:28 +00:00
|
|
|
# Do not use to build a complete file system. Use:
|
2016-07-14 07:04:12 +00:00
|
|
|
# /opt/cowrie/bin/createfs
|
|
|
|
#
|
2015-12-11 14:22:28 +00:00
|
|
|
# Instead it should be used to edit existing file systems
|
|
|
|
# such as the default: /opt/cowrie/data/fs.pickle.
|
2013-04-05 12:13:00 +00:00
|
|
|
#
|
|
|
|
# Donovan Hubbard
|
|
|
|
# Douglas Hubbard
|
|
|
|
# March 2013
|
2015-12-11 14:22:28 +00:00
|
|
|
################################################################
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2018-08-11 22:31:45 +00:00
|
|
|
import cmd
|
|
|
|
import copy
|
|
|
|
import os
|
|
|
|
import pickle
|
|
|
|
import sys
|
|
|
|
import time
|
2013-04-05 12:13:00 +00:00
|
|
|
from stat import *
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
A_NAME, A_TYPE, A_UID, A_GID, A_SIZE, A_MODE, A_CTIME, A_CONTENTS, A_TARGET, A_REALFILE = list(range(0, 10))
|
2016-09-18 21:25:50 +00:00
|
|
|
T_LINK, T_DIR, T_FILE, T_BLK, T_CHR, T_SOCK, T_FIFO = list(range(0, 7))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def getpath(fs, path):
|
|
|
|
cwd = fs
|
|
|
|
for part in path.split('/'):
|
|
|
|
if not len(part):
|
|
|
|
continue
|
|
|
|
ok = False
|
|
|
|
for c in cwd[A_CONTENTS]:
|
|
|
|
if c[A_NAME] == part:
|
|
|
|
cwd = c
|
|
|
|
ok = True
|
|
|
|
break
|
|
|
|
if not ok:
|
|
|
|
raise Exception('File not found')
|
|
|
|
return cwd
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def exists(fs, path):
|
|
|
|
try:
|
|
|
|
getpath(fs, path)
|
|
|
|
return True
|
2016-09-18 21:25:50 +00:00
|
|
|
except Exception as e:
|
2013-04-05 12:13:00 +00:00
|
|
|
if str(e) == 'File not found':
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
raise Exception(e)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
|
|
|
|
def is_directory(fs, path):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Returns whether or not the file at 'path' is a directory
|
|
|
|
|
|
|
|
:param fs:
|
|
|
|
:param path:
|
|
|
|
:return:
|
|
|
|
"""
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
file = getpath(fs, path)
|
2013-04-05 12:13:00 +00:00
|
|
|
if file[A_TYPE] == T_DIR:
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def resolve_reference(pwd, relativeReference):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Used to resolve a current working directory and a relative reference into an absolute file reference.
|
|
|
|
"""
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
tempPath = os.path.join(pwd, relativeReference)
|
|
|
|
absoluteReference = os.path.normpath(tempPath)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
return absoluteReference
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
class fseditCmd(cmd.Cmd):
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def __init__(self, pickle_file_path):
|
|
|
|
cmd.Cmd.__init__(self)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not os.path.isfile(pickle_file_path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("File %s does not exist." % pickle_file_path))
|
2013-04-05 12:13:00 +00:00
|
|
|
sys.exit(1)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
try:
|
|
|
|
pickle_file = open(pickle_file_path, 'rb')
|
|
|
|
except IOError as e:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("Unable to open file %s" % pickle_file_path))
|
2013-04-05 12:13:00 +00:00
|
|
|
sys.exit(1)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
try:
|
|
|
|
self.fs = pickle.load(pickle_file)
|
|
|
|
except:
|
2016-09-18 21:25:50 +00:00
|
|
|
print((("Unable to load file '%s'. " + \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
"Are you sure it is a valid pickle file?") % \
|
|
|
|
(pickle_file_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
sys.exit(1)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
self.pickle_file_path = pickle_file_path
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# get the name of the file so we can display it as the prompt
|
2013-04-05 12:13:00 +00:00
|
|
|
path_parts = pickle_file_path.split('/')
|
|
|
|
self.fs_name = path_parts[-1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.update_pwd("/")
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2015-12-11 12:21:29 +00:00
|
|
|
self.intro = "\nKippo/Cowrie file system interactive editor\n" + \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
"Donovan Hubbard, Douglas Hubbard, March 2013\n" + \
|
|
|
|
"Type 'help' for help\n"
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def save_pickle(self):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
saves the current file system to the pickle
|
|
|
|
:return:
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
try:
|
2016-10-23 14:34:32 +00:00
|
|
|
pickle.dump(self.fs, open(self.pickle_file_path, 'wb'))
|
|
|
|
except Exception as e:
|
2016-09-18 21:25:50 +00:00
|
|
|
print((("Unable to save pickle file '%s'. " + \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
"Are you sure you have write access?") % \
|
|
|
|
(self.pickle_file_path,)))
|
2016-10-23 14:34:32 +00:00
|
|
|
print(str(e))
|
2013-04-05 12:13:00 +00:00
|
|
|
sys.exit(1)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_exit(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Exits the file system editor
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def do_EOF(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
The escape character ctrl+d exits the session
|
|
|
|
"""
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# exiting from the do_EOF method does not create a newline automatically
|
|
|
|
# so we add it manually
|
2016-09-18 21:25:50 +00:00
|
|
|
print()
|
2013-04-05 12:13:00 +00:00
|
|
|
return True
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_ls(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Prints the contents of a directory, use ls -l to list in long format
|
|
|
|
Prints the current directory if no arguments are specified
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
|
2015-03-16 14:38:05 +00:00
|
|
|
longls = False
|
|
|
|
|
2015-03-16 15:03:42 +00:00
|
|
|
if args.startswith('-l'):
|
|
|
|
longls = True
|
|
|
|
args = args[3:]
|
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not len(args):
|
|
|
|
path = self.pwd
|
|
|
|
else:
|
2015-03-16 14:38:05 +00:00
|
|
|
path = resolve_reference(self.pwd, args)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, path) == False:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("ls: cannot access %s: No such file or directory" % (path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if is_directory(self.fs, path) == False:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("ls: %s is not a directory" % (path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
cwd = getpath(self.fs, path)
|
2015-03-16 14:38:05 +00:00
|
|
|
files = cwd[A_CONTENTS];
|
|
|
|
files.sort()
|
|
|
|
|
|
|
|
largest = 0
|
|
|
|
if len(files):
|
|
|
|
largest = max([x[A_SIZE] for x in files])
|
|
|
|
|
|
|
|
for file in files:
|
|
|
|
if not longls:
|
|
|
|
if file[A_TYPE] == T_DIR:
|
2016-09-18 21:25:50 +00:00
|
|
|
print((file[A_NAME] + '/'))
|
2015-03-16 14:38:05 +00:00
|
|
|
else:
|
2016-09-18 21:25:50 +00:00
|
|
|
print((file[A_NAME]))
|
2015-03-16 14:38:05 +00:00
|
|
|
continue
|
|
|
|
|
|
|
|
perms = ['-'] * 10
|
|
|
|
|
|
|
|
if file[A_MODE] & S_IRUSR: perms[1] = 'r'
|
|
|
|
if file[A_MODE] & S_IWUSR: perms[2] = 'w'
|
|
|
|
if file[A_MODE] & S_IXUSR: perms[3] = 'x'
|
|
|
|
|
|
|
|
if file[A_MODE] & S_IRGRP: perms[4] = 'r'
|
|
|
|
if file[A_MODE] & S_IWGRP: perms[5] = 'w'
|
|
|
|
if file[A_MODE] & S_IXGRP: perms[6] = 'x'
|
|
|
|
|
|
|
|
if file[A_MODE] & S_IROTH: perms[7] = 'r'
|
|
|
|
if file[A_MODE] & S_IWOTH: perms[8] = 'w'
|
|
|
|
if file[A_MODE] & S_IXOTH: perms[9] = 'x'
|
|
|
|
|
|
|
|
linktarget = ''
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if file[A_TYPE] == T_DIR:
|
2015-03-16 14:38:05 +00:00
|
|
|
perms[0] = 'd'
|
|
|
|
elif file[A_TYPE] == T_LINK:
|
|
|
|
perms[0] = 'l'
|
|
|
|
linktarget = ' -> %s' % (file[A_TARGET],)
|
|
|
|
|
|
|
|
perms = ''.join(perms)
|
|
|
|
ctime = time.localtime(file[A_CTIME])
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
uid = file[A_UID]
|
|
|
|
gid = file[A_GID]
|
2015-03-16 14:38:05 +00:00
|
|
|
|
|
|
|
if uid == 0:
|
|
|
|
uid = 'root'
|
|
|
|
else:
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
uid = str(uid).rjust(4)
|
2015-03-16 14:38:05 +00:00
|
|
|
|
|
|
|
if gid == 0:
|
|
|
|
gid = 'root'
|
2013-04-05 12:13:00 +00:00
|
|
|
else:
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
gid = str(gid).rjust(4)
|
2015-03-16 14:38:05 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('%s 1 %s %s %s %s %s%s' % \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
(perms,
|
|
|
|
uid,
|
|
|
|
gid,
|
|
|
|
str(file[A_SIZE]).rjust(len(str(largest))),
|
|
|
|
time.strftime('%Y-%m-%d %H:%M', ctime),
|
|
|
|
file[A_NAME],
|
|
|
|
linktarget)))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def update_pwd(self, directory):
|
|
|
|
self.pwd = directory
|
|
|
|
self.prompt = self.fs_name + ":" + self.pwd + "$ "
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_cd(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Changes the current directory.\nUsage: cd <target directory>
|
|
|
|
"""
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# count the number of arguments
|
2013-04-05 12:13:00 +00:00
|
|
|
# 1 or more arguments: changes the directory to the first arg
|
|
|
|
# and ignores the rest
|
|
|
|
# 0 arguments: changes to '/'
|
|
|
|
arguments = args.split()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not len(arguments):
|
|
|
|
self.update_pwd("/")
|
|
|
|
else:
|
|
|
|
relative_dir = arguments[0]
|
|
|
|
target_dir = resolve_reference(self.pwd, relative_dir)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, target_dir) == False:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("cd: %s: No such file or directory" % target_dir))
|
2013-04-05 12:13:00 +00:00
|
|
|
elif is_directory(self.fs, target_dir):
|
|
|
|
self.update_pwd(target_dir)
|
|
|
|
else:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("cd: %s: Not a directory" % target_dir))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_pwd(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Prints the current working directory
|
|
|
|
|
|
|
|
:param args:
|
|
|
|
:return:
|
|
|
|
"""
|
2016-09-18 21:25:50 +00:00
|
|
|
print((self.pwd))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_mkdir(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Add a new directory in the target directory.
|
2013-04-05 12:13:00 +00:00
|
|
|
Handles relative or absolute file paths. \n
|
2018-08-11 22:31:45 +00:00
|
|
|
Usage: mkdir <destination>...
|
|
|
|
"""
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
arg_list = args.split()
|
2015-12-11 14:22:28 +00:00
|
|
|
if len(arg_list) < 1:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("usage: mkdir <new directory> <new directory>...")
|
2013-04-05 12:13:00 +00:00
|
|
|
else:
|
2015-12-11 14:22:28 +00:00
|
|
|
for arg in arg_list:
|
|
|
|
self.mkfile(arg.split(), T_DIR)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_touch(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Add a new file in the target directory.
|
2013-04-05 12:13:00 +00:00
|
|
|
Handles relative or absolute file paths. \n
|
2018-08-11 22:31:45 +00:00
|
|
|
Usage: touch <destination> [<size in bytes>]
|
|
|
|
"""
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
arg_list = args.split()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(arg_list) < 1:
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: touch <destination> (<size in bytes>)')
|
2013-04-05 12:13:00 +00:00
|
|
|
else:
|
|
|
|
self.mkfile(arg_list, T_FILE)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def mkfile(self, args, file_type):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
args must be a list of arguments
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
cwd = self.fs
|
|
|
|
path = resolve_reference(self.pwd, args[0])
|
|
|
|
pathList = path.split('/')
|
|
|
|
parentdir = '/'.join(pathList[:-1])
|
|
|
|
fileName = pathList[len(pathList) - 1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, parentdir):
|
2016-09-18 21:25:50 +00:00
|
|
|
print((('Parent directory %s doesn\'t exist!') % \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
(parentdir,)))
|
2015-12-11 14:22:28 +00:00
|
|
|
self.mkfile(parentdir.split(), T_DIR)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('Error: %s already exists!' % (path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
cwd = getpath(self.fs, parentdir)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# get uid, gid, mode from parent
|
2013-04-05 12:13:00 +00:00
|
|
|
uid = cwd[A_UID]
|
|
|
|
gid = cwd[A_GID]
|
|
|
|
mode = cwd[A_MODE]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# create default file/directory size if none is specified
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(args) == 1:
|
|
|
|
size = 4096
|
|
|
|
else:
|
|
|
|
size = args[1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# set the last update time stamp to now
|
2013-04-05 12:13:00 +00:00
|
|
|
ctime = time.time()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
cwd[A_CONTENTS].append(
|
|
|
|
[fileName, file_type, uid, gid, size, mode, ctime, [], None, None])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.save_pickle()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("Added '%s'" % path))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_rm(self, arguments):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Remove an object from the file system.
|
2013-04-05 12:13:00 +00:00
|
|
|
Will not remove a directory unless the -r switch is invoked.\n
|
2018-08-11 22:31:45 +00:00
|
|
|
Usage: rm [-r] <target>
|
|
|
|
"""
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
args = arguments.split()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(args) < 1 or len(args) > 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: rm [-r] <target>')
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(args) == 2 and args[0] != "-r":
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: rm [-r] <target>')
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(args) == 1:
|
|
|
|
target_path = resolve_reference(self.pwd, args[0])
|
|
|
|
else:
|
|
|
|
target_path = resolve_reference(self.pwd, args[1])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, target_path) == False:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("File \'%s\' doesn\'t exist" % (target_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if target_path == "/":
|
2016-09-18 21:25:50 +00:00
|
|
|
print("rm: cannot delete root directory '/'")
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
target_object = getpath(self.fs, target_path)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
if target_object[A_TYPE] == T_DIR and args[0] != "-r":
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("rm: cannot remove '%s': Is a directory" % (target_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
parent_path = '/'.join(target_path.split('/')[:-1])
|
|
|
|
parent_object = getpath(self.fs, parent_path)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
parent_object[A_CONTENTS].remove(target_object)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.save_pickle()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("Deleted %s" % target_path))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_rmdir(self, arguments):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Remove a file object. Like the unix command,
|
2013-04-05 12:13:00 +00:00
|
|
|
this can only delete empty directories.
|
|
|
|
Use rm -r to recursively delete full directories.\n
|
2018-08-11 22:31:45 +00:00
|
|
|
Usage: rmdir <target directory>
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
args = arguments.split()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(args) != 1:
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: rmdir <target>')
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
target_path = resolve_reference(self.pwd, args[0])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, target_path) == False:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("File \'%s\' doesn\'t exist" % (target_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
target_object = getpath(self.fs, target_path)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if target_object[A_TYPE] != T_DIR:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("rmdir: failed to remove '%s': Not a directory" % \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
(target_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# The unix rmdir command does not delete directories if they are not
|
|
|
|
# empty
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(target_object[A_CONTENTS]) != 0:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("rmdir: failed to remove '%s': Directory not empty" % \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
(target_path,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
parent_path = '/'.join(target_path.split('/')[:-1])
|
|
|
|
parent_object = getpath(self.fs, parent_path)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
parent_object[A_CONTENTS].remove(target_object)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.save_pickle()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if self.pwd == target_path:
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
self.do_cd("..")
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("Deleted %s" % target_path))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_mv(self, arguments):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Moves a file/directory from one directory to another.\n
|
|
|
|
Usage: mv <source file> <destination file>
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
args = arguments.split()
|
|
|
|
if len(args) != 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: mv <source> <destination>')
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
|
|
|
src = resolve_reference(self.pwd, args[0])
|
|
|
|
dst = resolve_reference(self.pwd, args[1])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if src == "/":
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print("mv: cannot move the root directory '/'")
|
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
src = src.strip('/')
|
|
|
|
dst = dst.strip('/')
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, src):
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print(("Source file \'%s\' does not exist!" % src))
|
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the parent directory of the source file
|
|
|
|
# srcparent = '/'.join(src.split('/')[:-1])
|
2013-04-05 12:13:00 +00:00
|
|
|
srcparent = "/".join(src.split('/')[:-1])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the object for source
|
2013-04-05 12:13:00 +00:00
|
|
|
srcl = getpath(self.fs, src)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the object for the source's parent
|
2013-04-05 12:13:00 +00:00
|
|
|
srcparentl = getpath(self.fs, srcparent)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# if the specified filepath is a directory, maintain the current name
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, dst) and is_directory(self.fs, dst):
|
|
|
|
dstparent = dst
|
|
|
|
dstname = srcl[A_NAME]
|
|
|
|
else:
|
|
|
|
dstparent = '/'.join(dst.split('/')[:-1])
|
|
|
|
dstname = dst.split('/')[-1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, dstparent + '/' + dstname):
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print(("A file already exists at " + dst + "!"))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, dstparent):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('Destination directory \'%s\' doesn\'t exist!' % dst))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if src == self.pwd:
|
|
|
|
self.do_cd("..")
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
dstparentl = getpath(self.fs, dstparent)
|
|
|
|
copy = srcl[:]
|
|
|
|
copy[A_NAME] = dstname
|
|
|
|
dstparentl[A_CONTENTS].append(copy)
|
|
|
|
srcparentl[A_CONTENTS].remove(srcl)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.save_pickle()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('File moved from /%s to /%s' % (src, dst)))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_cp(self, arguments):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Copies a file/directory from one directory to another.\n
|
|
|
|
Usage: cp <source file> <destination file>
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
args = arguments.split()
|
|
|
|
if len(args) != 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print('Usage: cp <source> <destination>')
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# src, dst = args[0], args[1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
src = resolve_reference(self.pwd, args[0])
|
|
|
|
dst = resolve_reference(self.pwd, args[1])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
src = src.strip('/')
|
|
|
|
dst = dst.strip('/')
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, src):
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print(("Source file '%s' does not exist!" % (src,)))
|
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the parent directory of the source file
|
2013-04-05 12:13:00 +00:00
|
|
|
srcparent = '/'.join(src.split('/')[:-1])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the object for source
|
2013-04-05 12:13:00 +00:00
|
|
|
srcl = getpath(self.fs, src)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# Get the object for the source's parent
|
2013-04-05 12:13:00 +00:00
|
|
|
srcparentl = getpath(self.fs, srcparent)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
# if the specified filepath is a directory, maintain the current name
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, dst) and is_directory(self.fs, dst):
|
|
|
|
dstparent = dst
|
|
|
|
dstname = srcl[A_NAME]
|
|
|
|
else:
|
|
|
|
dstparent = '/'.join(dst.split('/')[:-1])
|
|
|
|
dstname = dst.split('/')[-1]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if exists(self.fs, dstparent + '/' + dstname):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('A file already exists at %s/%s!' % (dstparent, dstname)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, dstparent):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('Destination directory %s doesn\'t exist!' % (dstparent,)))
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
dstparentl = getpath(self.fs, dstparent)
|
2016-09-05 19:09:49 +00:00
|
|
|
coppy = copy.deepcopy(srcl)
|
|
|
|
coppy[A_NAME] = dstname
|
|
|
|
dstparentl[A_CONTENTS].append(coppy)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
self.save_pickle()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
print(('File copied from /%s to /%s/%s' % (src, dstparent, dstname)))
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2016-01-09 17:12:56 +00:00
|
|
|
def do_chown(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Change file ownership
|
|
|
|
"""
|
2016-01-09 17:12:56 +00:00
|
|
|
arg_list = args.split()
|
|
|
|
|
|
|
|
if len(arg_list) != 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect number of arguments.\nUsage: chown <uid> <file>")
|
2016-01-09 17:12:56 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
uid = arg_list[0]
|
|
|
|
target_path = resolve_reference(self.pwd, arg_list[1])
|
|
|
|
|
|
|
|
if not exists(self.fs, target_path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("File '%s' doesn't exist." % target_path))
|
2016-01-09 17:12:56 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
target_object = getpath(self.fs, target_path)
|
|
|
|
olduid = target_object[A_UID]
|
|
|
|
target_object[A_UID] = int(uid)
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("former UID: " + str(olduid) + ". New UID: " + str(uid)))
|
2016-01-18 16:52:05 +00:00
|
|
|
self.save_pickle()
|
2016-01-09 17:12:56 +00:00
|
|
|
|
|
|
|
def do_chgrp(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Change file ownership
|
|
|
|
"""
|
2016-01-09 17:12:56 +00:00
|
|
|
arg_list = args.split()
|
|
|
|
|
|
|
|
if len(arg_list) != 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect number of arguments.\nUsage: chgrp <gid> <file>")
|
2016-01-09 17:12:56 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
gid = arg_list[0]
|
|
|
|
target_path = resolve_reference(self.pwd, arg_list[1])
|
|
|
|
|
|
|
|
if not exists(self.fs, target_path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("File '%s' doesn't exist." % target_path))
|
2016-01-09 17:12:56 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
target_object = getpath(self.fs, target_path)
|
2016-08-11 10:04:58 +00:00
|
|
|
oldgid = target_object[A_GID]
|
|
|
|
target_object[A_GID] = int(gid)
|
2016-09-18 21:25:50 +00:00
|
|
|
print(("former GID: " + str(oldgid) + ". New GID: " + str(gid)))
|
2016-01-18 16:52:05 +00:00
|
|
|
self.save_pickle()
|
|
|
|
|
|
|
|
def do_chmod(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Change file permissions
|
|
|
|
only modes between 000 and 777 are implemented
|
|
|
|
"""
|
2016-01-18 16:52:05 +00:00
|
|
|
|
|
|
|
arg_list = args.split()
|
|
|
|
|
|
|
|
if len(arg_list) != 2:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect number of arguments.\nUsage: chmod <mode> <file>")
|
2016-01-18 16:52:05 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
mode = arg_list[0]
|
|
|
|
target_path = resolve_reference(self.pwd, arg_list[1])
|
|
|
|
|
|
|
|
if not exists(self.fs, target_path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print("File '%s' doesn't exist." % target_path)
|
2016-01-18 16:52:05 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
target_object = getpath(self.fs, target_path)
|
|
|
|
oldmode = target_object[A_MODE]
|
2016-01-09 17:12:56 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
if target_object[A_TYPE] == T_LINK:
|
2016-09-18 21:25:50 +00:00
|
|
|
print(target_path + " is a link, nothing changed.")
|
2016-01-18 16:52:05 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
num = int(mode, 8)
|
|
|
|
except:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect mode: " + mode)
|
2016-01-18 16:52:05 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if num < 0 or num > 511:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect mode: " + mode)
|
2016-01-18 16:52:05 +00:00
|
|
|
return
|
|
|
|
|
2016-09-18 21:25:50 +00:00
|
|
|
target_object[A_MODE] = (oldmode & 0o7777000) | (num & 0o777)
|
2016-01-18 16:52:05 +00:00
|
|
|
self.save_pickle()
|
2016-01-09 17:12:56 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_file(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Identifies file types.\nUsage: file <file name>
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
arg_list = args.split()
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if len(arg_list) != 1:
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Incorrect number of arguments.\nUsage: file <file>")
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
target_path = resolve_reference(self.pwd, arg_list[0])
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if not exists(self.fs, target_path):
|
2016-09-18 21:25:50 +00:00
|
|
|
print("File '%s' doesn't exist." % target_path)
|
2013-04-05 12:13:00 +00:00
|
|
|
return
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
target_object = getpath(self.fs, target_path)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
file_type = target_object[A_TYPE]
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if file_type == T_FILE:
|
|
|
|
msg = "normal file object"
|
|
|
|
elif file_type == T_DIR:
|
|
|
|
msg = "directory"
|
|
|
|
elif file_type == T_LINK:
|
|
|
|
msg = "link"
|
|
|
|
elif file_type == T_BLK:
|
|
|
|
msg = "block file"
|
|
|
|
elif file_type == T_CHR:
|
|
|
|
msg = "character special"
|
|
|
|
elif file_type == T_SOCK:
|
|
|
|
msg = "socket"
|
|
|
|
elif file_type == T_FIFO:
|
|
|
|
msg = "named pipe"
|
|
|
|
else:
|
|
|
|
msg = "unrecognized file"
|
2014-05-28 04:13:55 +00:00
|
|
|
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print(target_path + " is a " + msg)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def do_clear(self, args):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
Clears the screen
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
os.system('clear')
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def emptyline(self):
|
2018-08-11 22:31:45 +00:00
|
|
|
"""
|
|
|
|
By default the cmd object will repeat the last command
|
2013-04-05 12:13:00 +00:00
|
|
|
if a blank line is entered. Since this is different than
|
2018-08-11 22:31:45 +00:00
|
|
|
bash behavior, overriding this method will stop it.
|
|
|
|
"""
|
2013-04-05 12:13:00 +00:00
|
|
|
pass
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def help_help(self):
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Type help <topic> to get more information.")
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
def help_about(self):
|
2016-09-18 21:25:50 +00:00
|
|
|
print("Kippo/Cowrie stores information about its file systems in a " + \
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
"series of nested lists. Once the lists are made, they are " + \
|
|
|
|
"stored in a pickle file on the hard drive. Every time cowrie " + \
|
|
|
|
"gets a new client, it reads from the pickle file and loads " + \
|
|
|
|
"the fake file system into memory. By default this file " + \
|
|
|
|
"is /opt/cowrie/data/fs.pickle. Originally the script " + \
|
|
|
|
"/opt/cowrie/bin/createfs was used to copy the file system " + \
|
|
|
|
"of the existing computer. However, it quite difficult to " + \
|
|
|
|
"edit the pickle file by hand.\n\nThis script strives to be " + \
|
|
|
|
"a bash-like interface that allows users to modify " + \
|
|
|
|
"existing fs pickle files. It supports many of the " + \
|
|
|
|
"common bash commands and even handles relative file " + \
|
|
|
|
"paths. Keep in mind that you need to restart the " + \
|
|
|
|
"cowrie process in order for the new file system to be " + \
|
|
|
|
"reloaded into memory.\n\nDonovan Hubbard, Douglas Hubbard, " + \
|
|
|
|
"March 2013\nVersion 1.0")
|
|
|
|
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(sys.argv) != 2:
|
Flake8 fixes (#857)
* Adding flake8-import-order to linters
We need some kind of linter to enforce the code style.
Doing this by hand is error prone and no one will really watch for it.
I decieded to use the default style since it's from my point of view the
best to read and more strictes version.
* Enforcing imports order on bin/
* Enforcing imports order on src/twisted/
* Enforcing imports order on setup.py
* Enforcing imports order on src/cowrie/commands
* Enforcing imports order on src/cowrie/core
* Enforcing imports order on src/cowrie/dblog
* Enforcing imports order on src/cowrie/insults
* Enforcing imports order on src/cowrie/output
* Enforcing imports order on src/cowrie/proxy
* Enforcing imports order on src/cowrie/python
* Enforcing imports order on src/cowrie/shell
* Enforcing imports order on src/cowrie/ssh
* Enforcing imports order on src/cowrie/telnet
* Enforcing imports order on src/cowrie/test
* Reformat file, improved readability
* flake8 E5,E701 src/cowrie/commands/base.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/base.py
src/cowrie/commands/base.py:47:121: E501 line too long (180 > 120 characters)
src/cowrie/commands/base.py:48:121: E501 line too long (182 > 120 characters)
src/cowrie/commands/base.py:49:121: E501 line too long (149 > 120 characters)
src/cowrie/commands/base.py:50:121: E501 line too long (175 > 120 characters)
src/cowrie/commands/base.py:52:121: E501 line too long (127 > 120 characters)
src/cowrie/commands/base.py:54:121: E501 line too long (185 > 120 characters)
src/cowrie/commands/base.py:56:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:57:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:59:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:60:121: E501 line too long (188 > 120 characters)
src/cowrie/commands/base.py:61:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/base.py:63:121: E501 line too long (142 > 120 characters)
src/cowrie/commands/base.py:64:121: E501 line too long (152 > 120 characters)
src/cowrie/commands/base.py:66:121: E501 line too long (128 > 120 characters)
src/cowrie/commands/base.py:67:121: E501 line too long (123 > 120 characters)
src/cowrie/commands/base.py:72:121: E501 line too long (130 > 120 characters)
src/cowrie/commands/base.py:74:121: E501 line too long (125 > 120 characters)
src/cowrie/commands/base.py:75:121: E501 line too long (140 > 120 characters)
src/cowrie/commands/base.py:76:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/base.py:78:121: E501 line too long (124 > 120 characters)
src/cowrie/commands/base.py:79:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/base.py:80:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:81:121: E501 line too long (150 > 120 characters)
src/cowrie/commands/base.py:83:121: E501 line too long (129 > 120 characters)
src/cowrie/commands/base.py:544:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:553:68: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:582:66: E502 the backslash is redundant between brackets
src/cowrie/commands/base.py:696:78: E502 the backslash is redundant between brackets
24 E501 line too long (180 > 120 characters)
4 E502 the backslash is redundant between brackets
28
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/curl.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/curl.py
src/cowrie/commands/curl.py:413:106: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/fs.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/fs.py
src/cowrie/commands/fs.py:438:74: E502 the backslash is redundant between brackets
src/cowrie/commands/fs.py:465:67: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/gcc.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/gcc.py
src/cowrie/commands/gcc.py:167:121: E501 line too long (635 > 120 characters)
1 E501 line too long (635 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ifconfig.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ifconfig.py
src/cowrie/commands/ifconfig.py:11:121: E501 line too long (145 > 120 characters)
src/cowrie/commands/ifconfig.py:13:121: E501 line too long (138 > 120 characters)
2 E501 line too long (145 > 120 characters)
2
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/netstat.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/netstat.py
src/cowrie/commands/netstat.py:21:121: E501 line too long (126 > 120 characters)
1 E501 line too long (126 > 120 characters)
1
* flake8 E5, E701 src/cowrie/commands/ping.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ping.py
src/cowrie/commands/ping.py:81:74: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/ssh.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/ssh.py
src/cowrie/commands/ssh.py:79:87: E502 the backslash is redundant between brackets
src/cowrie/commands/ssh.py:99:81: E502 the backslash is redundant between brackets
2 E502 the backslash is redundant between brackets
2
* flake8 E5, E701 src/cowrie/commands/sudo.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/sudo.py
src/cowrie/commands/sudo.py:14:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:15:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:16:121: E501 line too long (122 > 120 characters)
src/cowrie/commands/sudo.py:24:121: E501 line too long (133 > 120 characters)
src/cowrie/commands/sudo.py:25:121: E501 line too long (166 > 120 characters)
src/cowrie/commands/sudo.py:26:121: E501 line too long (122 > 120 characters)
6 E501 line too long (133 > 120 characters)
6
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/commands/wget.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/wget.py
src/cowrie/commands/wget.py:50:19: E701 multiple statements on one line (colon)
src/cowrie/commands/wget.py:264:69: E502 the backslash is redundant between brackets
1 E502 the backslash is redundant between brackets
1 E701 multiple statements on one line (colon)
2
* flake8 E5, E701 src/cowrie/commands/yum.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/commands/yum.py
src/cowrie/commands/yum.py:8:1: F401 'datetime.datetime' imported but unused
src/cowrie/commands/yum.py:223:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:228:121: E501 line too long (193 > 120 characters)
src/cowrie/commands/yum.py:237:121: E501 line too long (193 > 120 characters)
3 E501 line too long (193 > 120 characters)
1 F401 'datetime.datetime' imported but unused
4
* flake8 E5, E701 src/cowrie/core/cef.py
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/core
src/cowrie/core/cef.py:53:121: E501 line too long (122 > 120 characters)
1 E501 line too long (122 > 120 characters)
1
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/hpfeeds.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/hpfeeds.py
src/cowrie/output/hpfeeds.py:61:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:80:29: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:147:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:166:22: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:173:26: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:180:30: E701 multiple statements on one line (colon)
src/cowrie/output/hpfeeds.py:186:34: E701 multiple statements on one line (colon)
7 E701 multiple statements on one line (colon)
7
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/output/sqlite.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/sqlite.py
src/cowrie/output/sqlite.py:73:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:74:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:82:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:83:60: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:91:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:92:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:100:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:101:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:109:62: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:116:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:117:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:125:45: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:126:75: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:134:41: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:135:65: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:143:67: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:149:69: E502 the backslash is redundant between brackets
src/cowrie/output/sqlite.py:165:57: E502 the backslash is redundant between brackets
18 E502 the backslash is redundant between brackets
18
* flake8 E5, E701 src/cowrie/output/mysql.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/output/mysql.py
src/cowrie/output/mysql.py:108:77: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:109:71: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:115:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:116:73: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:122:75: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:127:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:128:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:133:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:134:80: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:139:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:140:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:147:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:148:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:154:58: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:155:88: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:161:54: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:162:78: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:169:68: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:175:70: E502 the backslash is redundant between brackets
src/cowrie/output/mysql.py:191:73: E502 the backslash is redundant between brackets
20 E502 the backslash is redundant between brackets
20
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* flake8 E5, E701 src/cowrie/shell/shlex.py
Before
flake8 --count --select=E1,E2,E3,E5,E701,E901,E999,F401,F821,F822,F823 --max-line-length=120 --statistics src/cowrie/shell
src/cowrie/shell/protocol.py:37:121: E501 line too long (144 > 120 characters)
src/cowrie/shell/shlex.py:111:51: E502 the backslash is redundant between brackets
1 E501 line too long (144 > 120 characters)
1 E502 the backslash is redundant between brackets
2
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Reformat code, improved readability
* Update linters to check for E5 and E701
* Update travis file to the current state
- Removed every checker we do not use. That means twistedchecker
and pytest.
- Updated the flake8 command to match our current clean state
- Removed unused old code
* Fix format typo of cowrie.direct-tcpip.data log event
* Update travis to match the current state
Travis checks now every fixed flake8 error.
Also I removed unused code from it to keep it clean.
* Removed vim file markers
We don't want to have editor specific code in our source files.
Fix your IDE but don't do it in the code.
* src/cowrie/test/test_echo.py removed trailing whitespace
* src/cowrie/commands/yum.py removed trailing whitespace
* src/cowrie/commands/netstat.py removed trailing whitespace
* Checking for flake8 W291, W293
* flake8 F811 ./src/cowrie/commands/scp.py
I made sure to delete only the oldest version of the code.
Before
flake8 --count --select=F811 --application-import-names cowrie --max-line-length=120 --statistics .
./src/cowrie/commands/scp.py:209:5: F811 redefinition of unused 'handle_CTRL_D' from line 192
1 F811 redefinition of unused 'handle_CTRL_D' from line 192
1
* Update flake8 checks
* Fix flake8 E722, F841 src/cowrie/commands/wget.py
* Fix flake8 E722 src/cowrie/commands/ping.py
* Fix flake8 E722,F841 src/cowrie/commands/nc.py
* Fix flake8 E722, E741, F841 src/cowrie/commands/base.py
* Flake8 E731 src/cowrie/commands/base.py
I removed all lambda functions and replaced them with proper code.
That means straight function calls or not calling anything because it's
not needed.
* Fix flake8 E722, F841 src/cowrie/commands/scp.py
* Fix flake8 E722, F841 src/cowrie/commands/ssh.py
* Fix flake8 E712 src/cowrie/commands/iptables.py
* Fix flake8 E741 src/cowrie/commands/adduser.py
* Fix flake8 F841 src/cowrie/commands/tftp.py
* Fix flake8 E722 in all files
* Fix flake8 E711 bin/createdynamicprocess.py
* Fix flake8 E712, E713 src/cowrie/core/dblog.py
* Fix flake8 E712, E713 src/cowrie/shell/avatar.py
* Fix flake8 E712 src/cowrie/shell/fs.py
* Fix flake8 E712, E741 src/cowrie/commands/ls.py
* Fix flake8 E712, E713 src/cowrie/dblog/xmpp.py
* Fix flake8 E731, F841 src/cowrie/commands/gcc.py
* Fix flake8 F841 src/cowrie/insults/insults.py
* Fix flake8 F841 src/cowrie/telnet/session.py
* Fix flake8 F841 src/cowrie/commands/fs.py
* Fix flake8 E741,F841 src/cowrie/commands/last.py
* Fix flake8 E741 src/cowrie/commands/netstat.py
* Fix flake8 F841 src/cowrie/commands/free.py
* Fix flake8 F841 src/cowrie/commands/sudo.py
* Fix flake8 F841 src/cowrie/commands/curl.py
* Fix flake8 F841 src/cowrie/commands/base64.py
* Fix flake8 F841 src/cowrie/commands/service.py
* Fix flake8 F841 src/cowrie/ssh/factory.py
* Fix flake8 F841 src/cowrie/ssh/transport.py
* Fix flake8 F841 src/cowrie/output/csirtg.py
* Fix flake8 F841 src/cowrie/output/kafka.py
* Fix flake8 F841 src/cowrie/output/mongodb.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F741 src/cowrie/output/hpfeeds.py
* Fix flake8 F841 src/proxy/session.py
* Fix flake8 F841 src/cowrie/core/utils.py
* Update travis and Dockerfile for flake8 checks
2018-08-18 11:52:45 +00:00
|
|
|
print("Usage: %s <fs.pickle>" % os.path.basename(sys.argv[0], ))
|
2013-04-05 12:13:00 +00:00
|
|
|
sys.exit(1)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
pickle_file_name = sys.argv[1].strip()
|
2016-09-18 21:25:50 +00:00
|
|
|
print(pickle_file_name)
|
2014-05-28 04:13:55 +00:00
|
|
|
|
2013-04-05 12:13:00 +00:00
|
|
|
fseditCmd(pickle_file_name).cmdloop()
|