remove trailing whitespace

This commit is contained in:
Michel Oosterhof
2015-06-23 08:20:38 +00:00
parent 4d48992305
commit 56477389b8
11 changed files with 54 additions and 49 deletions

View File

@ -14,7 +14,7 @@
* default behaviour is changed to disable the exit jail
* sftp support
* exec support
* stdin is saved as a file in dl/ when using exec commands
* stdin is saved as a file in dl/ when using exec commands
to support commands like 'cat >file; ./file'
* allow wget download over non-80 port
* simple JSON logging added
@ -25,7 +25,7 @@
* add 'bash -c' support (no effect option)
* enable support for && multiple commands
* create uuid to uniquely identify each session
* log and deny direct-tcpip attempts
* log and deny direct-tcpip attempts
* add "chattr" command
* support emacs keybindings (c-a, c-b, c-f, c-p, c-n, c-e)
* add "sync" command

View File

@ -70,7 +70,7 @@ filesystem_file = data/fs.pickle
data_path = data
# Class that implements the checklogin() method.
#
#
# Class must be defined in cowrie/core/auth.py
# Default is the 'UserDB' class which uses the password database.
#
@ -79,7 +79,7 @@ data_path = data
# It will also cache username/password combinations that allow login.
#
auth_class = UserDB
# When AuthRandom is used also set the
# When AuthRandom is used also set the
# auth_class_parameters: <min try>, <max try>, <maxcache>
# for example: 2, 5, 10 = allows access after randint(2,5) attempts
# and cache 10 combinations.

View File

@ -153,7 +153,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.""",
COLLECT_GCC=gcc
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 %s-5\' --with-bugurl=file:///usr/share/doc/gcc-%s/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-%s --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++/%s --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
Configured with: ../src/configure -v --with-pkgversion=\'Debian %s-5\' --with-bugurl=file:///usr/share/doc/gcc-%s/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-%s --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++/%s --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 %s-5)""" % (version, version_short, version_short, version_short, version, version))

View File

@ -228,7 +228,7 @@ Perhaps iptables or your kernel needs to be upgraded.""" % (command_iptables.APP
def show_help(self):
""" Show help and exit """
self.writeln( """%s %s'
self.writeln( """%s %s'
Usage: iptables -[AD] chain rule-specification [options]
iptables -I chain [rulenum] rule-specification [options]
@ -388,16 +388,16 @@ Perhaps iptables or your kernel needs to be upgraded."""
def no_command(self):
""" Print no command message and exit """
self.writeln( """%s %s: no command specified'
Try `iptables -h\' or \'iptables --help\' for more information."""
self.writeln( """%s %s: no command specified'
Try `iptables -h\' or \'iptables --help\' for more information."""
% (command_iptables.APP_NAME, command_iptables.APP_VERSION) )
self.exit()
def unknown_option(self, option):
""" Print unknown option message and exit """
self.writeln( """%s %s: unknown option \'%s\''
Try `iptables -h\' or \'iptables --help\' for more information."""
self.writeln( """%s %s: unknown option \'%s\''
Try `iptables -h\' or \'iptables --help\' for more information."""
% (command_iptables.APP_NAME, command_iptables.APP_VERSION, option) )
self.exit()
@ -405,7 +405,7 @@ Try `iptables -h\' or \'iptables --help\' for more information."""
""" Print bad argument and exit """
self.writeln( """Bad argument \'%s\'' % argument,
Try `iptables -h\' or \'iptables --help\' for more information."""
Try `iptables -h\' or \'iptables --help\' for more information."""
% argument )
self.exit()

View File

@ -49,8 +49,8 @@ usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}
<Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
<AF>=Use \'-6|-4\' or \'-A <af>\' or \'--<af>\'; default: inet
List of possible address families (which support routing):
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
x25 (CCITT X.25)""")
self.exit()
@ -109,39 +109,39 @@ unix 4 [ ] DGRAM 7445 /dev/log
unix 2 [ ACC ] STREAM LISTENING 6807 @/com/ubuntu/upstart
unix 2 [ ACC ] STREAM LISTENING 7299 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] SEQPACKET LISTENING 7159 /run/udev/control
unix 3 [ ] STREAM CONNECTED 7323
unix 3 [ ] STREAM CONNECTED 7323
unix 3 [ ] STREAM CONNECTED 7348 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 7330
unix 2 [ ] DGRAM 8966
unix 3 [ ] STREAM CONNECTED 7330
unix 2 [ ] DGRAM 8966
unix 3 [ ] STREAM CONNECTED 7424 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 7140
unix 3 [ ] STREAM CONNECTED 7140
unix 3 [ ] STREAM CONNECTED 7145 @/com/ubuntu/upstart
unix 3 [ ] DGRAM 7199
unix 3 [ ] STREAM CONNECTED 7347
unix 3 [ ] STREAM CONNECTED 8594
unix 3 [ ] STREAM CONNECTED 7331
unix 3 [ ] DGRAM 7199
unix 3 [ ] STREAM CONNECTED 7347
unix 3 [ ] STREAM CONNECTED 8594
unix 3 [ ] STREAM CONNECTED 7331
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
unix 3 [ ] STREAM CONNECTED 7423
unix 3 [ ] DGRAM 7198
unix 2 [ ] DGRAM 9570
unix 3 [ ] STREAM CONNECTED 7423
unix 3 [ ] DGRAM 7198
unix 2 [ ] DGRAM 9570
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
else:
self.honeypot.writeln("""unix 4 [ ] DGRAM 7445 /dev/log
unix 3 [ ] STREAM CONNECTED 7323
unix 3 [ ] STREAM CONNECTED 7323
unix 3 [ ] STREAM CONNECTED 7348 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 7330
unix 2 [ ] DGRAM 8966
unix 3 [ ] STREAM CONNECTED 7330
unix 2 [ ] DGRAM 8966
unix 3 [ ] STREAM CONNECTED 7424 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 7140
unix 3 [ ] STREAM CONNECTED 7140
unix 3 [ ] STREAM CONNECTED 7145 @/com/ubuntu/upstart
unix 3 [ ] DGRAM 7199
unix 3 [ ] STREAM CONNECTED 7347
unix 3 [ ] STREAM CONNECTED 8594
unix 3 [ ] STREAM CONNECTED 7331
unix 3 [ ] DGRAM 7199
unix 3 [ ] STREAM CONNECTED 7347
unix 3 [ ] STREAM CONNECTED 8594
unix 3 [ ] STREAM CONNECTED 7331
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
unix 3 [ ] STREAM CONNECTED 7423
unix 3 [ ] DGRAM 7198
unix 2 [ ] DGRAM 9570
unix 3 [ ] STREAM CONNECTED 7423
unix 3 [ ] DGRAM 7198
unix 2 [ ] DGRAM 9570
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
def call(self):

View File

@ -15,7 +15,7 @@ class command_sleep(HoneyPotCommand):
_time = int( self.args[0] )
self.scheduled = reactor.callLater(_time, self.done)
else:
self.writeln('usage: sleep seconds')
self.writeln('usage: sleep seconds')
self.exit()

View File

@ -1,4 +1,4 @@
#
#
from cowrie.core.honeypot import HoneyPotCommand

View File

@ -1,28 +1,28 @@
# Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
from cowrie.core.honeypot import HoneyPotCommand
commands = {}
class command_which(HoneyPotCommand):
# Do not resolve args
resolve_args = False
def call(self):
""" Look up all the arguments on PATH and print each (first) result """
# No arguments, just exit
if not len(self.args) or not 'PATH' in self.env:
return
# Look up each file
for f in self.args:
for path in self.env['PATH'].split(':'):
resolved = self.fs.resolve_path(f, path)
if self.fs.exists(resolved):
self.writeln("%s/%s" % (path, f))
continue
# Definition
commands['/bin/which'] = command_which

View File

@ -219,9 +219,14 @@ class HoneyPotFilesystem(object):
# log.msg("fs.open excl")
# treat O_RDWR same as O_WRONLY
print "mode = %s\n" % repr(mode)
if openFlags & os.O_WRONLY == os.O_WRONLY or openFlags & os.O_RDWR == os.O_RDWR:
# ensure we do not save with executable bit set
realmode = mode & ~(stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
realmode = realmode | stat.S_IRUSR
print "realmode = %s\n" % repr(mode)
#log.msg("fs.open wronly")
tempfile = '%s/%s_%s' % \

View File

@ -231,16 +231,16 @@ class DBLogger(dblog.DBLogger):
def handleCommand(self, session, args):
c = args['input']
self.meta[session]['commands'].append(c)
def handleUnknownCommand(self, session, args):
uc = args['input']
self.meta[session]['unknownCommands'].append(uc)
def handleInput(self, session, args):
pass
def handleTerminalSize(self, session, args):
pass
pass
def handleClientVersion(self, session, args):
v = args['version']

View File

@ -40,7 +40,7 @@ class CowrieServiceMaker(object):
listen_addr = cfg.get('honeypot', 'listen_addr')
else:
listen_addr = '0.0.0.0'
# preference: 1, option, 2, config, 3, default of 2222
if options['port'] != 0:
listen_port = int(options["port"])