Skip to content

Commit

Permalink
remove trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
micheloosterhof committed Jun 23, 2015
1 parent 4d48992 commit 5647738
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 49 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cowrie.cfg.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cowrie/commands/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def version(self, short):
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))

Expand Down
12 changes: 6 additions & 6 deletions cowrie/commands/iptables.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def show_version(self):
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]
Expand Down Expand Up @@ -388,24 +388,24 @@ def no_permission(self):
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()

def bad_argument(self, argument):
""" 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()

Expand Down
48 changes: 24 additions & 24 deletions cowrie/commands/netstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def show_help(self):
<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()

Expand Down Expand Up @@ -109,39 +109,39 @@ def do_netstat_normal(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion cowrie/commands/sleep.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def start(self):
_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()


Expand Down
2 changes: 1 addition & 1 deletion cowrie/commands/uname.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#

from cowrie.core.honeypot import HoneyPotCommand

Expand Down
16 changes: 8 additions & 8 deletions cowrie/commands/which.py
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions cowrie/core/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@ def open(self, filename, openFlags, mode):
# 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' % \
Expand Down
6 changes: 3 additions & 3 deletions cowrie/dblog/hpfeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,16 @@ def handleLoginSucceeded(self, session, args):
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']
Expand Down
2 changes: 1 addition & 1 deletion twisted/plugins/cowrie_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def makeService(self, options):
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"])
Expand Down

0 comments on commit 5647738

Please sign in to comment.