diff --git a/cowrie/commands/__init__.py b/cowrie/commands/__init__.py index 3b4ea55..1fc829e 100644 --- a/cowrie/commands/__init__.py +++ b/cowrie/commands/__init__.py @@ -20,6 +20,7 @@ __all__ = [ 'nohup', 'ping', 'scp', + 'service', 'sleep', 'ssh', 'sudo', diff --git a/cowrie/commands/service.py b/cowrie/commands/service.py new file mode 100644 index 0000000..e210ac3 --- /dev/null +++ b/cowrie/commands/service.py @@ -0,0 +1,120 @@ +# Copyright (c) 2015 Michel Oosterhof +# All rights reserved. + +""" +This module contains the service commnad +""" + +from cowrie.core.honeypot import HoneyPotCommand +import getopt +from twisted.python import log + +commands = {} + + +class command_service(HoneyPotCommand): + """ + By Giannis Papaioannou + """ + def status_all(self): + """ + more services can be added here. + """ + output = ( + '[ + ] acpid', + '[ - ] alsa-utils', + '[ + ] anacron', + '[ + ] apparmor', + '[ + ] apport', + '[ + ] avahi-daemon', + '[ + ] bluetooth', + '[ - ] bootmisc.sh', + '[ - ] brltty', + '[ - ] checkfs.sh', + '[ - ] checkroot-bootclean.sh', + '[ - ] checkroot.sh', + '[ + ] console-setup', + '[ + ] cron', + '[ + ] cups', + '[ + ] cups-browsed', + '[ + ] dbus', + '[ - ] dns-clean', + '[ + ] grub-common', + '[ - ] hostname.sh', + '[ - ] hwclock.sh', + '[ + ] irqbalance', + '[ - ] kerneloops', + '[ - ] killprocs', + '[ + ] kmod', + '[ + ] lightdm', + '[ - ] mountall-bootclean.sh', + '[ - ] mountall.sh', + '[ - ] mountdevsubfs.sh', + '[ - ] mountkernfs.sh', + '[ - ] mountnfs-bootclean.sh', + '[ - ] mountnfs.sh', + '[ + ] network-manager', + '[ + ] networking', + '[ + ] ondemand', + '[ + ] open-vm-tools', + '[ - ] plymouth', + '[ - ] plymouth-log', + '[ - ] pppd-dns', + '[ + ] procps', + '[ - ] rc.local', + '[ + ] resolvconf', + '[ - ] rsync', + '[ + ] rsyslog', + '[ - ] saned', + '[ - ] sendsigs', + '[ + ] speech-dispatcher', + '[ + ] thermald', + '[ + ] udev', + '[ + ] ufw', + '[ - ] umountfs', + '[ - ] umountnfs.sh', + '[ - ] umountroot', + '[ - ] unattended-upgrades', + '[ + ] urandom', + '[ - ] uuidd', + '[ + ] whoopsie', + '[ - ] x11-common') + for l in output: + self.write(l + '\n') + + + def help(self): + output = 'Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]' + self.write(output + '\n') + + + def start(self): + """ + """ + try: + opts, args = getopt.gnu_getopt(self.args, '', ['help', 'status-all', 'full-restart']) + except getopt.GetoptError as err: + self.help() + self.exit() + return + + # Parse options + print(opts) + for o, a in opts: + if o in ("--help") or o in ('-h'): + self.help() + elif o in ('--status-all'): + self.status_all() + """ + Ubuntu shows no response when stopping, starting + leviathan@ubuntu:~$ sudo service ufw stop + leviathan@ubuntu:~$ sudo service ufw start + leviathan@ubuntu:~$ + """ + self.exit() + return + + +commands['service'] = command_service + +# vim: set sw=4 et tw=0: