mirror of https://github.com/cowrie/cowrie.git
some small linting fixes (#1351)
* small linting fixes for new version of flake8 * format string fix * expand single letter variable names
This commit is contained in:
parent
02e8e24493
commit
b6fb25dedb
|
@ -532,8 +532,8 @@ class command_shutdown(HoneyPotCommand):
|
|||
"-t secs: delay between warning and kill signal. ",
|
||||
"** the \"time\" argument is mandatory! (try \"now\") **",
|
||||
)
|
||||
for l in output:
|
||||
self.write('{0}\n'.format(l))
|
||||
for line in output:
|
||||
self.write('{0}\n'.format(line))
|
||||
self.exit()
|
||||
elif len(self.args) > 1 and self.args[0].strip().count('-h') \
|
||||
and self.args[1].strip().count('now'):
|
||||
|
@ -595,8 +595,8 @@ class command_history(HoneyPotCommand):
|
|||
self.protocol.historyPosition = 0
|
||||
return
|
||||
count = 1
|
||||
for l in self.protocol.historyLines:
|
||||
self.write(' %s %s\n' % (str(count).rjust(4), l))
|
||||
for line in self.protocol.historyLines:
|
||||
self.write(' %s %s\n' % (str(count).rjust(4), line))
|
||||
count += 1
|
||||
except Exception:
|
||||
# Non-interactive shell, do nothing
|
||||
|
@ -701,8 +701,8 @@ class command_php(HoneyPotCommand):
|
|||
'PHP 5.3.5 (cli)',
|
||||
'Copyright (c) 1997-2010 The PHP Group'
|
||||
)
|
||||
for l in output:
|
||||
self.write('{0}\n'.format(l))
|
||||
for line in output:
|
||||
self.write('{0}\n'.format(line))
|
||||
self.exit()
|
||||
elif self.args[0] == '-h':
|
||||
output = (
|
||||
|
@ -745,8 +745,8 @@ class command_php(HoneyPotCommand):
|
|||
' --ri <name> Show configuration for extension <name>.',
|
||||
''
|
||||
)
|
||||
for l in output:
|
||||
self.write('{0}\n'.format(l))
|
||||
for line in output:
|
||||
self.write('{0}\n'.format(line))
|
||||
self.exit()
|
||||
else:
|
||||
self.exit()
|
||||
|
|
|
@ -33,8 +33,8 @@ class command_chpasswd(HoneyPotCommand):
|
|||
' -s, --sha-rounds number of SHA rounds for the SHA*'
|
||||
' crypt algorithms'
|
||||
)
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def chpasswd_application(self, contents):
|
||||
c = 1
|
||||
|
|
|
@ -29,8 +29,8 @@ class command_crontab(HoneyPotCommand):
|
|||
' -r (delete user\'s crontab)',
|
||||
' -i (prompt before deleting user\'s crontab)'
|
||||
)
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def start(self):
|
||||
try:
|
||||
|
|
|
@ -408,9 +408,8 @@ class HTTPProgressDownloader(client.HTTPDownloader):
|
|||
|
||||
if self.fakeoutfile:
|
||||
self.curl.write(
|
||||
"\r100 {} 100 {} 0 0 {} 0 --:--:-- --:--:-- --:--:-- %d\n".format(self.currentlength,
|
||||
self.currentlength,
|
||||
63673, 65181))
|
||||
"\r100 {} 100 {} 0 0 {} 0 --:--:-- --:--:-- --:--:-- {}\n".format(
|
||||
self.currentlength, self.currentlength, 63673, 65181))
|
||||
|
||||
self.curl.fs.mkfile(self.fakeoutfile, 0, 0, self.totallength, 33188)
|
||||
self.curl.fs.update_realfile(
|
||||
|
|
|
@ -165,7 +165,7 @@ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
|
|||
Target: x86_64-linux-gnu
|
||||
Configured with: ../src/configure -v --with-pkgversion=\'Debian {}-5\' --with-bugurl=file:///usr/share/doc/gcc-{}/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-{} --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/{} --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
||||
Thread model: posix
|
||||
gcc version %s (Debian {}-5)""".format(version, version_short, version_short, version_short, version, version)) # noqa: E501
|
||||
gcc version {} (Debian {}-5)""".format(version, version_short, version_short, version_short, version, version)) # noqa: E501
|
||||
|
||||
# Write
|
||||
self.write('{0}\n'.format(data))
|
||||
|
|
|
@ -33,8 +33,8 @@ class command_perl(HoneyPotCommand):
|
|||
'Internet, point your browser at http://www.perl.org/, the Perl Home Page.',
|
||||
''
|
||||
)
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def help(self):
|
||||
output = (
|
||||
|
@ -70,8 +70,8 @@ class command_perl(HoneyPotCommand):
|
|||
' -X disable all warnings',
|
||||
''
|
||||
)
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def start(self):
|
||||
try:
|
||||
|
|
|
@ -49,13 +49,13 @@ class command_ping(HoneyPotCommand):
|
|||
return
|
||||
|
||||
if len(args) == 0:
|
||||
for l in (
|
||||
for line in (
|
||||
'Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]',
|
||||
' [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]',
|
||||
' [-M mtu discovery hint] [-S sndbuf]',
|
||||
' [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination',
|
||||
):
|
||||
self.write('{0}\n'.format(l))
|
||||
self.write('{0}\n'.format(line))
|
||||
self.exit()
|
||||
return
|
||||
self.host = args[0].strip()
|
||||
|
|
|
@ -69,8 +69,8 @@ class command_python(HoneyPotCommand):
|
|||
' str, bytes and datetime objects. It can also be set to an integer',
|
||||
' in the range [0,4294967295] to get hash values with a predictable seed.'
|
||||
)
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def start(self):
|
||||
try:
|
||||
|
|
|
@ -82,8 +82,8 @@ class command_service(HoneyPotCommand):
|
|||
'[ - ] uuidd',
|
||||
'[ + ] whoopsie',
|
||||
'[ - ] x11-common')
|
||||
for l in output:
|
||||
self.write(l + '\n')
|
||||
for line in output:
|
||||
self.write(line + '\n')
|
||||
|
||||
def help(self):
|
||||
output = 'Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]'
|
||||
|
|
|
@ -52,8 +52,8 @@ class command_ssh(HoneyPotCommand):
|
|||
self.exit()
|
||||
return
|
||||
if not len(args):
|
||||
for l in OUTPUT:
|
||||
self.write('{0}\n'.format(l))
|
||||
for line in OUTPUT:
|
||||
self.write('{0}\n'.format(line))
|
||||
self.exit()
|
||||
return
|
||||
user, host = 'root', args[0]
|
||||
|
|
|
@ -73,7 +73,7 @@ class command_tar(HoneyPotCommand):
|
|||
self.mkfullpath(os.path.dirname(dest), f)
|
||||
self.fs.mkfile(dest, 0, 0, f.size, f.mode, f.mtime)
|
||||
else:
|
||||
log.msg("tar: skipping [%s]".format(f.name))
|
||||
log.msg("tar: skipping [{}]".format(f.name))
|
||||
|
||||
|
||||
commands['/bin/tar'] = command_tar
|
||||
|
|
|
@ -48,8 +48,8 @@ import cowrie.core.output
|
|||
import cowrie.python.logfile
|
||||
|
||||
|
||||
def random_string(l, charset=string.letters.encode()):
|
||||
return b"".join(random.choice(charset) for i in range(l))
|
||||
def random_string(length, charset=string.letters.encode()):
|
||||
return b"".join(random.choice(charset) for i in range(length))
|
||||
|
||||
|
||||
def make_messages():
|
||||
|
|
|
@ -207,7 +207,7 @@ class Output(cowrie.core.output.Output):
|
|||
elif j['response_code'] == -2:
|
||||
log.msg("VT: response=-2: this has been queued for analysis already")
|
||||
else:
|
||||
log.msg("VT: unexpected response code".format(j['response_code']))
|
||||
log.msg("VT: unexpected response code: {}".format(j['response_code']))
|
||||
|
||||
d.addCallback(cbResponse)
|
||||
d.addErrback(cbError)
|
||||
|
@ -354,7 +354,7 @@ class Output(cowrie.core.output.Output):
|
|||
log.msg("VT: response=1: this has been queued for analysis already")
|
||||
log.msg("VT: permalink: {}".format(j['permalink']))
|
||||
else:
|
||||
log.msg("VT: unexpected response code".format(j['response_code']))
|
||||
log.msg("VT: unexpected response code: {}".format(j['response_code']))
|
||||
|
||||
d.addCallback(cbResponse)
|
||||
d.addErrback(cbError)
|
||||
|
|
|
@ -105,7 +105,7 @@ class shlex:
|
|||
self.instream.close()
|
||||
(self.infile, self.instream, self.lineno) = self.filestack.popleft()
|
||||
if self.debug:
|
||||
print('shlex: popping to {}, line %d'.format(self.instream, self.lineno))
|
||||
print('shlex: popping to {}, line {}'.format(self.instream, self.lineno))
|
||||
self.state = ' '
|
||||
|
||||
def get_token(self):
|
||||
|
|
Loading…
Reference in New Issue