mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-18 06:24:20 +01:00
remove trailing whitespace
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
* default behaviour is changed to disable the exit jail
|
* default behaviour is changed to disable the exit jail
|
||||||
* sftp support
|
* sftp support
|
||||||
* exec 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'
|
to support commands like 'cat >file; ./file'
|
||||||
* allow wget download over non-80 port
|
* allow wget download over non-80 port
|
||||||
* simple JSON logging added
|
* simple JSON logging added
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
* add 'bash -c' support (no effect option)
|
* add 'bash -c' support (no effect option)
|
||||||
* enable support for && multiple commands
|
* enable support for && multiple commands
|
||||||
* create uuid to uniquely identify each session
|
* create uuid to uniquely identify each session
|
||||||
* log and deny direct-tcpip attempts
|
* log and deny direct-tcpip attempts
|
||||||
* add "chattr" command
|
* add "chattr" command
|
||||||
* support emacs keybindings (c-a, c-b, c-f, c-p, c-n, c-e)
|
* support emacs keybindings (c-a, c-b, c-f, c-p, c-n, c-e)
|
||||||
* add "sync" command
|
* add "sync" command
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ filesystem_file = data/fs.pickle
|
|||||||
data_path = data
|
data_path = data
|
||||||
|
|
||||||
# Class that implements the checklogin() method.
|
# Class that implements the checklogin() method.
|
||||||
#
|
#
|
||||||
# Class must be defined in cowrie/core/auth.py
|
# Class must be defined in cowrie/core/auth.py
|
||||||
# Default is the 'UserDB' class which uses the password database.
|
# 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.
|
# It will also cache username/password combinations that allow login.
|
||||||
#
|
#
|
||||||
auth_class = UserDB
|
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>
|
# auth_class_parameters: <min try>, <max try>, <maxcache>
|
||||||
# for example: 2, 5, 10 = allows access after randint(2,5) attempts
|
# for example: 2, 5, 10 = allows access after randint(2,5) attempts
|
||||||
# and cache 10 combinations.
|
# and cache 10 combinations.
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.""",
|
|||||||
COLLECT_GCC=gcc
|
COLLECT_GCC=gcc
|
||||||
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
|
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
|
||||||
Target: 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
|
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
|
Thread model: posix
|
||||||
gcc version %s (Debian %s-5)""" % (version, version_short, version_short, version_short, version, version))
|
gcc version %s (Debian %s-5)""" % (version, version_short, version_short, version_short, version, version))
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ Perhaps iptables or your kernel needs to be upgraded.""" % (command_iptables.APP
|
|||||||
def show_help(self):
|
def show_help(self):
|
||||||
""" Show help and exit """
|
""" Show help and exit """
|
||||||
|
|
||||||
self.writeln( """%s %s'
|
self.writeln( """%s %s'
|
||||||
|
|
||||||
Usage: iptables -[AD] chain rule-specification [options]
|
Usage: iptables -[AD] chain rule-specification [options]
|
||||||
iptables -I chain [rulenum] 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):
|
def no_command(self):
|
||||||
""" Print no command message and exit """
|
""" Print no command message and exit """
|
||||||
|
|
||||||
self.writeln( """%s %s: no command specified'
|
self.writeln( """%s %s: no command specified'
|
||||||
Try `iptables -h\' or \'iptables --help\' for more information."""
|
Try `iptables -h\' or \'iptables --help\' for more information."""
|
||||||
% (command_iptables.APP_NAME, command_iptables.APP_VERSION) )
|
% (command_iptables.APP_NAME, command_iptables.APP_VERSION) )
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def unknown_option(self, option):
|
def unknown_option(self, option):
|
||||||
""" Print unknown option message and exit """
|
""" Print unknown option message and exit """
|
||||||
|
|
||||||
self.writeln( """%s %s: unknown option \'%s\''
|
self.writeln( """%s %s: unknown option \'%s\''
|
||||||
Try `iptables -h\' or \'iptables --help\' for more information."""
|
Try `iptables -h\' or \'iptables --help\' for more information."""
|
||||||
% (command_iptables.APP_NAME, command_iptables.APP_VERSION, option) )
|
% (command_iptables.APP_NAME, command_iptables.APP_VERSION, option) )
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ Try `iptables -h\' or \'iptables --help\' for more information."""
|
|||||||
""" Print bad argument and exit """
|
""" Print bad argument and exit """
|
||||||
|
|
||||||
self.writeln( """Bad argument \'%s\'' % argument,
|
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 )
|
% argument )
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
<Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom
|
||||||
<AF>=Use \'-6|-4\' or \'-A <af>\' or \'--<af>\'; default: inet
|
<AF>=Use \'-6|-4\' or \'-A <af>\' or \'--<af>\'; default: inet
|
||||||
List of possible address families (which support routing):
|
List of possible address families (which support routing):
|
||||||
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
|
inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25)
|
||||||
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
|
netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)
|
||||||
x25 (CCITT X.25)""")
|
x25 (CCITT X.25)""")
|
||||||
self.exit()
|
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 6807 @/com/ubuntu/upstart
|
||||||
unix 2 [ ACC ] STREAM LISTENING 7299 /var/run/dbus/system_bus_socket
|
unix 2 [ ACC ] STREAM LISTENING 7299 /var/run/dbus/system_bus_socket
|
||||||
unix 2 [ ACC ] SEQPACKET LISTENING 7159 /run/udev/control
|
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 7348 /var/run/dbus/system_bus_socket
|
||||||
unix 3 [ ] STREAM CONNECTED 7330
|
unix 3 [ ] STREAM CONNECTED 7330
|
||||||
unix 2 [ ] DGRAM 8966
|
unix 2 [ ] DGRAM 8966
|
||||||
unix 3 [ ] STREAM CONNECTED 7424 /var/run/dbus/system_bus_socket
|
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 [ ] STREAM CONNECTED 7145 @/com/ubuntu/upstart
|
||||||
unix 3 [ ] DGRAM 7199
|
unix 3 [ ] DGRAM 7199
|
||||||
unix 3 [ ] STREAM CONNECTED 7347
|
unix 3 [ ] STREAM CONNECTED 7347
|
||||||
unix 3 [ ] STREAM CONNECTED 8594
|
unix 3 [ ] STREAM CONNECTED 8594
|
||||||
unix 3 [ ] STREAM CONNECTED 7331
|
unix 3 [ ] STREAM CONNECTED 7331
|
||||||
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
|
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
|
||||||
unix 3 [ ] STREAM CONNECTED 7423
|
unix 3 [ ] STREAM CONNECTED 7423
|
||||||
unix 3 [ ] DGRAM 7198
|
unix 3 [ ] DGRAM 7198
|
||||||
unix 2 [ ] DGRAM 9570
|
unix 2 [ ] DGRAM 9570
|
||||||
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
|
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
|
||||||
else:
|
else:
|
||||||
self.honeypot.writeln("""unix 4 [ ] DGRAM 7445 /dev/log
|
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 7348 /var/run/dbus/system_bus_socket
|
||||||
unix 3 [ ] STREAM CONNECTED 7330
|
unix 3 [ ] STREAM CONNECTED 7330
|
||||||
unix 2 [ ] DGRAM 8966
|
unix 2 [ ] DGRAM 8966
|
||||||
unix 3 [ ] STREAM CONNECTED 7424 /var/run/dbus/system_bus_socket
|
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 [ ] STREAM CONNECTED 7145 @/com/ubuntu/upstart
|
||||||
unix 3 [ ] DGRAM 7199
|
unix 3 [ ] DGRAM 7199
|
||||||
unix 3 [ ] STREAM CONNECTED 7347
|
unix 3 [ ] STREAM CONNECTED 7347
|
||||||
unix 3 [ ] STREAM CONNECTED 8594
|
unix 3 [ ] STREAM CONNECTED 8594
|
||||||
unix 3 [ ] STREAM CONNECTED 7331
|
unix 3 [ ] STREAM CONNECTED 7331
|
||||||
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
|
unix 3 [ ] STREAM CONNECTED 7364 @/com/ubuntu/upstart
|
||||||
unix 3 [ ] STREAM CONNECTED 7423
|
unix 3 [ ] STREAM CONNECTED 7423
|
||||||
unix 3 [ ] DGRAM 7198
|
unix 3 [ ] DGRAM 7198
|
||||||
unix 2 [ ] DGRAM 9570
|
unix 2 [ ] DGRAM 9570
|
||||||
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
|
unix 3 [ ] STREAM CONNECTED 8619 @/com/ubuntu/upstart""")
|
||||||
|
|
||||||
def call(self):
|
def call(self):
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class command_sleep(HoneyPotCommand):
|
|||||||
_time = int( self.args[0] )
|
_time = int( self.args[0] )
|
||||||
self.scheduled = reactor.callLater(_time, self.done)
|
self.scheduled = reactor.callLater(_time, self.done)
|
||||||
else:
|
else:
|
||||||
self.writeln('usage: sleep seconds')
|
self.writeln('usage: sleep seconds')
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from cowrie.core.honeypot import HoneyPotCommand
|
from cowrie.core.honeypot import HoneyPotCommand
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
# Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
|
# Copyright (c) 2013 Bas Stottelaar <basstottelaar [AT] gmail [DOT] com>
|
||||||
|
|
||||||
from cowrie.core.honeypot import HoneyPotCommand
|
from cowrie.core.honeypot import HoneyPotCommand
|
||||||
|
|
||||||
commands = {}
|
commands = {}
|
||||||
|
|
||||||
class command_which(HoneyPotCommand):
|
class command_which(HoneyPotCommand):
|
||||||
# Do not resolve args
|
# Do not resolve args
|
||||||
resolve_args = False
|
resolve_args = False
|
||||||
|
|
||||||
def call(self):
|
def call(self):
|
||||||
""" Look up all the arguments on PATH and print each (first) result """
|
""" Look up all the arguments on PATH and print each (first) result """
|
||||||
|
|
||||||
# No arguments, just exit
|
# No arguments, just exit
|
||||||
if not len(self.args) or not 'PATH' in self.env:
|
if not len(self.args) or not 'PATH' in self.env:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Look up each file
|
# Look up each file
|
||||||
for f in self.args:
|
for f in self.args:
|
||||||
for path in self.env['PATH'].split(':'):
|
for path in self.env['PATH'].split(':'):
|
||||||
resolved = self.fs.resolve_path(f, path)
|
resolved = self.fs.resolve_path(f, path)
|
||||||
|
|
||||||
if self.fs.exists(resolved):
|
if self.fs.exists(resolved):
|
||||||
self.writeln("%s/%s" % (path, f))
|
self.writeln("%s/%s" % (path, f))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Definition
|
# Definition
|
||||||
commands['/bin/which'] = command_which
|
commands['/bin/which'] = command_which
|
||||||
|
|||||||
@@ -219,9 +219,14 @@ class HoneyPotFilesystem(object):
|
|||||||
# log.msg("fs.open excl")
|
# log.msg("fs.open excl")
|
||||||
|
|
||||||
# treat O_RDWR same as O_WRONLY
|
# 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:
|
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
|
# ensure we do not save with executable bit set
|
||||||
realmode = mode & ~(stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
|
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")
|
#log.msg("fs.open wronly")
|
||||||
tempfile = '%s/%s_%s' % \
|
tempfile = '%s/%s_%s' % \
|
||||||
|
|||||||
@@ -231,16 +231,16 @@ class DBLogger(dblog.DBLogger):
|
|||||||
def handleCommand(self, session, args):
|
def handleCommand(self, session, args):
|
||||||
c = args['input']
|
c = args['input']
|
||||||
self.meta[session]['commands'].append(c)
|
self.meta[session]['commands'].append(c)
|
||||||
|
|
||||||
def handleUnknownCommand(self, session, args):
|
def handleUnknownCommand(self, session, args):
|
||||||
uc = args['input']
|
uc = args['input']
|
||||||
self.meta[session]['unknownCommands'].append(uc)
|
self.meta[session]['unknownCommands'].append(uc)
|
||||||
|
|
||||||
def handleInput(self, session, args):
|
def handleInput(self, session, args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def handleTerminalSize(self, session, args):
|
def handleTerminalSize(self, session, args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def handleClientVersion(self, session, args):
|
def handleClientVersion(self, session, args):
|
||||||
v = args['version']
|
v = args['version']
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class CowrieServiceMaker(object):
|
|||||||
listen_addr = cfg.get('honeypot', 'listen_addr')
|
listen_addr = cfg.get('honeypot', 'listen_addr')
|
||||||
else:
|
else:
|
||||||
listen_addr = '0.0.0.0'
|
listen_addr = '0.0.0.0'
|
||||||
|
|
||||||
# preference: 1, option, 2, config, 3, default of 2222
|
# preference: 1, option, 2, config, 3, default of 2222
|
||||||
if options['port'] != 0:
|
if options['port'] != 0:
|
||||||
listen_port = int(options["port"])
|
listen_port = int(options["port"])
|
||||||
|
|||||||
Reference in New Issue
Block a user