We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
TypeError in command "apt-get install"
**Describe the bug**

When using the command "apt-get install XY" while logged in per SSH in the cowrie honeypot, nothing happens.
If you look into the logs, the requested software couldn't be installed but a TypeError is thrown:

```Traceback (most recent call last):
	  File "/home/cowrie/github/cowrie/cowrie/shell/protocol.py", line 359, in call_command
	    HoneyPotBaseProtocol.call_command(self, pp, cmd, *args)
	  File "/home/cowrie/github/cowrie/cowrie/shell/protocol.py", line 216, in call_command
	    obj.start()
	  File "/home/cowrie/github/cowrie/cowrie/commands/apt.py", line 36, in start
	    self.do_install()
	  File "/home/cowrie/github/cowrie/cowrie-env/lib/python2.7/site-packages/twisted/internet/defer.py", line 1532, in unwindGenerator
	    return _inlineCallbacks(None, gen, Deferred())
	--- <exception caught here> ---
	  File "/home/cowrie/github/cowrie/cowrie-env/lib/python2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
	    result = g.send(result)
	  File "/home/cowrie/github/cowrie/cowrie/commands/apt.py", line 123, in do_install
	    'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),
	exceptions.TypeError: choice() takes exactly 2 arguments (3 given)

 ```

I investigated the source and saw what is actually wrong:
```
'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),
```
in which `random.choice(0, 1)` requires a sequence, so `random.choice([0, 1])` should work.

**To Reproduce**
Steps to reproduce the behavior:
1. Log in a cowrie honeypot per ssh: ssh -p 2222 root@honeypot
2. Try "sudo apt-get install vim"
3. See the error in the cowrie logs on your machine:  cowrie/logs/cowrie.log

**Expected behavior**

See some common apt-get messages, like "Reading package lists... Done\n", e.g. simulating to the attacker the command worked.

**Server (please complete the following information):**
 - OS: CentOS 7, x86_64
 - Python: Python 2.7.5 and Python 3.6.5

**Additional context**
-


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cowrie/commands/apt.py`
Content:
```
1 # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
2 # See the COPYRIGHT file for more information
3 
4 from __future__ import division, absolute_import
5 
6 import random
7 import re
8 
9 from twisted.internet import reactor, defer
10 from twisted.internet.defer import inlineCallbacks
11 
12 from cowrie.shell.command import HoneyPotCommand
13 
14 commands = {}
15 
16 class command_faked_package_class_factory(object):
17     @staticmethod
18     def getCommand(name):
19         class command_faked_installation(HoneyPotCommand):
20             def call(self):
21                 self.write(b"%s: Segmentation fault\n" % name)
22         return command_faked_installation
23 
24 class command_aptget(HoneyPotCommand):
25     """
26     apt-get fake
27     suppports only the 'install PACKAGE' command & 'moo'.
28     Any installed packages, places a 'Segfault' at /usr/bin/PACKAGE.'''
29     """
30     def start(self):
31         if len(self.args) == 0:
32             self.do_help()
33         elif len(self.args) > 0 and self.args[0] == '-v':
34             self.do_version()
35         elif len(self.args) > 0 and self.args[0] == 'install':
36             self.do_install()
37         elif len(self.args) > 0 and self.args[0] == 'moo':
38             self.do_moo()
39         else:
40             self.do_locked()
41 
42     def sleep(self, time, time2=None):
43         d = defer.Deferred()
44         if time2:
45             time = random.randint(time * 100, time2 * 100) / 100.0
46         reactor.callLater(time, d.callback, None)
47         return d
48 
49     def do_version(self):
50         self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06
51 Supported modules:
52 *Ver: Standard .deb
53 *Pkg:  Debian dpkg interface (Priority 30)
54  Pkg:  Debian APT solver interface (Priority -1000)
55  S.L: 'deb' Standard Debian binary tree
56  S.L: 'deb-src' Standard Debian source tree
57  Idx: Debian Source Index
58  Idx: Debian Package Index
59  Idx: Debian Translation Index
60  Idx: Debian dpkg status file
61  Idx: EDSP scenario file\n''')
62         self.exit()
63         return
64 
65     def do_help(self):
66         self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06
67 Usage: apt-get [options] command
68        apt-get [options] install|remove pkg1 [pkg2 ...]
69        apt-get [options] source pkg1 [pkg2 ...]
70 
71 apt-get is a simple command line interface for downloading and
72 installing packages. The most frequently used commands are update
73 and install.
74 
75 Commands:
76    update - Retrieve new lists of packages
77    upgrade - Perform an upgrade
78    install - Install new packages (pkg is libc6 not libc6.deb)
79    remove - Remove packages
80    autoremove - Remove automatically all unused packages
81    purge - Remove packages and config files
82    source - Download source archives
83    build-dep - Configure build-dependencies for source packages
84    dist-upgrade - Distribution upgrade, see apt-get(8)
85    dselect-upgrade - Follow dselect selections
86    clean - Erase downloaded archive files
87    autoclean - Erase old downloaded archive files
88    check - Verify that there are no broken dependencies
89    changelog - Download and display the changelog for the given package
90    download - Download the binary package into the current directory
91 
92 Options:
93   -h  This help text.
94   -q  Loggable output - no progress indicator
95   -qq No output except for errors
96   -d  Download only - do NOT install or unpack archives
97   -s  No-act. Perform ordering simulation
98   -y  Assume Yes to all queries and do not prompt
99   -f  Attempt to correct a system with broken dependencies in place
100   -m  Attempt to continue if archives are unlocatable
101   -u  Show a list of upgraded packages as well
102   -b  Build the source package after fetching it
103   -V  Show verbose version numbers
104   -c=? Read this configuration file
105   -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
106 See the apt-get(8), sources.list(5) and apt.conf(5) manual
107 pages for more information and options.
108                        This APT has Super Cow Powers.\n''')
109         self.exit()
110         return
111 
112     @inlineCallbacks
113     def do_install(self, *args):
114         if len(self.args) <= 1:
115             msg = '0 upgraded, 0 newly installed, 0 to remove and {0} not upgraded.\n'
116             self.write(msg.format(random.randint(200, 300)))
117             self.exit()
118             return
119 
120         packages = {}
121         for y in [re.sub('[^A-Za-z0-9]', '', x) for x in self.args[1:]]:
122             packages[y] = {
123                 'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),
124                 'size': random.randint(100, 900)
125             }
126         totalsize = sum([packages[x]['size'] for x in packages])
127 
128         self.write('Reading package lists... Done\n')
129         self.write('Building dependency tree\n')
130         self.write('Reading state information... Done\n')
131         self.write('The following NEW packages will be installed:\n')
132         self.write('  %s ' % ' '.join(packages) + '\n')
133         self.write('0 upgraded, %d newly installed, 0 to remove and 259 not upgraded.\n' % len(packages))
134         self.write('Need to get %s.2kB of archives.\n' % (totalsize))
135         self.write('After this operation, %skB of additional disk space will be used.\n' % (totalsize * 2.2,))
136         i = 1
137         for p in packages:
138             self.write('Get:%d http://ftp.debian.org stable/main %s %s [%s.2kB]\n' %
139                        (i, p, packages[p]['version'], packages[p]['size']))
140             i += 1
141             yield self.sleep(1, 2)
142         self.write('Fetched %s.2kB in 1s (4493B/s)\n' % (totalsize))
143         self.write('Reading package fields... Done\n')
144         yield self.sleep(1, 2)
145         self.write('Reading package status... Done\n')
146         self.write('(Reading database ... 177887 files and directories currently installed.)\n')
147         yield self.sleep(1, 2)
148         for p in packages:
149             self.write('Unpacking %s (from .../archives/%s_%s_i386.deb) ...\n' % (p, p, packages[p]['version']))
150             yield self.sleep(1, 2)
151         self.write('Processing triggers for man-db ...\n')
152         yield self.sleep(2)
153         for p in packages:
154             self.write('Setting up %s (%s) ...\n' % (p, packages[p]['version']))
155             self.fs.mkfile('/usr/bin/%s' % p, 0, 0, random.randint(10000, 90000), 33188)
156             self.protocol.commands['/usr/bin/%s' % p] = \
157                 command_faked_package_class_factory.getCommand(p)
158             yield self.sleep(2)
159         self.exit()
160 
161     def do_moo(self):
162         self.write('         (__)\n')
163         self.write('         (oo)\n')
164         self.write('   /------\\/\n')
165         self.write('  / |    ||\n')
166         self.write(' *  /\\---/\\ \n')
167         self.write('    ~~   ~~\n')
168         self.write('...."Have you mooed today?"...\n')
169         self.exit()
170 
171     def do_locked(self):
172         self.errorWrite('E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\n')
173         self.errorWrite('E: Unable to lock the list directory\n')
174         self.exit()
175 
176 commands['/usr/bin/apt-get'] = command_aptget
177 commands['apt-get'] = command_aptget
178
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cowrie/commands/apt.py b/cowrie/commands/apt.py
--- a/cowrie/commands/apt.py
+++ b/cowrie/commands/apt.py
@@ -120,7 +120,7 @@
         packages = {}
         for y in [re.sub('[^A-Za-z0-9]', '', x) for x in self.args[1:]]:
             packages[y] = {
-                'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),
+                'version': '{0}.{1}-{2}'.format(random.choice([0, 1]), random.randint(1, 40), random.randint(1, 10)),
                 'size': random.randint(100, 900)
             }
         totalsize = sum([packages[x]['size'] for x in packages])

{"golden_diff": "diff --git a/cowrie/commands/apt.py b/cowrie/commands/apt.py\n--- a/cowrie/commands/apt.py\n+++ b/cowrie/commands/apt.py\n@@ -120,7 +120,7 @@\n         packages = {}\n         for y in [re.sub('[^A-Za-z0-9]', '', x) for x in self.args[1:]]:\n             packages[y] = {\n-                'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),\n+                'version': '{0}.{1}-{2}'.format(random.choice([0, 1]), random.randint(1, 40), random.randint(1, 10)),\n                 'size': random.randint(100, 900)\n             }\n         totalsize = sum([packages[x]['size'] for x in packages])\n", "issue": "TypeError in command \"apt-get install\"\n**Describe the bug**\r\n\r\nWhen using the command \"apt-get install XY\" while logged in per SSH in the cowrie honeypot, nothing happens.\r\nIf you look into the logs, the requested software couldn't be installed but a TypeError is thrown:\r\n\r\n```Traceback (most recent call last):\r\n\t  File \"/home/cowrie/github/cowrie/cowrie/shell/protocol.py\", line 359, in call_command\r\n\t    HoneyPotBaseProtocol.call_command(self, pp, cmd, *args)\r\n\t  File \"/home/cowrie/github/cowrie/cowrie/shell/protocol.py\", line 216, in call_command\r\n\t    obj.start()\r\n\t  File \"/home/cowrie/github/cowrie/cowrie/commands/apt.py\", line 36, in start\r\n\t    self.do_install()\r\n\t  File \"/home/cowrie/github/cowrie/cowrie-env/lib/python2.7/site-packages/twisted/internet/defer.py\", line 1532, in unwindGenerator\r\n\t    return _inlineCallbacks(None, gen, Deferred())\r\n\t--- <exception caught here> ---\r\n\t  File \"/home/cowrie/github/cowrie/cowrie-env/lib/python2.7/site-packages/twisted/internet/defer.py\", line 1386, in _inlineCallbacks\r\n\t    result = g.send(result)\r\n\t  File \"/home/cowrie/github/cowrie/cowrie/commands/apt.py\", line 123, in do_install\r\n\t    'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),\r\n\texceptions.TypeError: choice() takes exactly 2 arguments (3 given)\r\n\r\n ```\r\n\r\nI investigated the source and saw what is actually wrong:\r\n```\r\n'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),\r\n```\r\nin which `random.choice(0, 1)` requires a sequence, so `random.choice([0, 1])` should work.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Log in a cowrie honeypot per ssh: ssh -p 2222 root@honeypot\r\n2. Try \"sudo apt-get install vim\"\r\n3. See the error in the cowrie logs on your machine:  cowrie/logs/cowrie.log\r\n\r\n**Expected behavior**\r\n\r\nSee some common apt-get messages, like \"Reading package lists... Done\\n\", e.g. simulating to the attacker the command worked.\r\n\r\n**Server (please complete the following information):**\r\n - OS: CentOS 7, x86_64\r\n - Python: Python 2.7.5 and Python 3.6.5\r\n\r\n**Additional context**\r\n-\r\n\n", "before_files": [{"content": "# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>\n# See the COPYRIGHT file for more information\n\nfrom __future__ import division, absolute_import\n\nimport random\nimport re\n\nfrom twisted.internet import reactor, defer\nfrom twisted.internet.defer import inlineCallbacks\n\nfrom cowrie.shell.command import HoneyPotCommand\n\ncommands = {}\n\nclass command_faked_package_class_factory(object):\n    @staticmethod\n    def getCommand(name):\n        class command_faked_installation(HoneyPotCommand):\n            def call(self):\n                self.write(b\"%s: Segmentation fault\\n\" % name)\n        return command_faked_installation\n\nclass command_aptget(HoneyPotCommand):\n    \"\"\"\n    apt-get fake\n    suppports only the 'install PACKAGE' command & 'moo'.\n    Any installed packages, places a 'Segfault' at /usr/bin/PACKAGE.'''\n    \"\"\"\n    def start(self):\n        if len(self.args) == 0:\n            self.do_help()\n        elif len(self.args) > 0 and self.args[0] == '-v':\n            self.do_version()\n        elif len(self.args) > 0 and self.args[0] == 'install':\n            self.do_install()\n        elif len(self.args) > 0 and self.args[0] == 'moo':\n            self.do_moo()\n        else:\n            self.do_locked()\n\n    def sleep(self, time, time2=None):\n        d = defer.Deferred()\n        if time2:\n            time = random.randint(time * 100, time2 * 100) / 100.0\n        reactor.callLater(time, d.callback, None)\n        return d\n\n    def do_version(self):\n        self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06\nSupported modules:\n*Ver: Standard .deb\n*Pkg:  Debian dpkg interface (Priority 30)\n Pkg:  Debian APT solver interface (Priority -1000)\n S.L: 'deb' Standard Debian binary tree\n S.L: 'deb-src' Standard Debian source tree\n Idx: Debian Source Index\n Idx: Debian Package Index\n Idx: Debian Translation Index\n Idx: Debian dpkg status file\n Idx: EDSP scenario file\\n''')\n        self.exit()\n        return\n\n    def do_help(self):\n        self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06\nUsage: apt-get [options] command\n       apt-get [options] install|remove pkg1 [pkg2 ...]\n       apt-get [options] source pkg1 [pkg2 ...]\n\napt-get is a simple command line interface for downloading and\ninstalling packages. The most frequently used commands are update\nand install.\n\nCommands:\n   update - Retrieve new lists of packages\n   upgrade - Perform an upgrade\n   install - Install new packages (pkg is libc6 not libc6.deb)\n   remove - Remove packages\n   autoremove - Remove automatically all unused packages\n   purge - Remove packages and config files\n   source - Download source archives\n   build-dep - Configure build-dependencies for source packages\n   dist-upgrade - Distribution upgrade, see apt-get(8)\n   dselect-upgrade - Follow dselect selections\n   clean - Erase downloaded archive files\n   autoclean - Erase old downloaded archive files\n   check - Verify that there are no broken dependencies\n   changelog - Download and display the changelog for the given package\n   download - Download the binary package into the current directory\n\nOptions:\n  -h  This help text.\n  -q  Loggable output - no progress indicator\n  -qq No output except for errors\n  -d  Download only - do NOT install or unpack archives\n  -s  No-act. Perform ordering simulation\n  -y  Assume Yes to all queries and do not prompt\n  -f  Attempt to correct a system with broken dependencies in place\n  -m  Attempt to continue if archives are unlocatable\n  -u  Show a list of upgraded packages as well\n  -b  Build the source package after fetching it\n  -V  Show verbose version numbers\n  -c=? Read this configuration file\n  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\nSee the apt-get(8), sources.list(5) and apt.conf(5) manual\npages for more information and options.\n                       This APT has Super Cow Powers.\\n''')\n        self.exit()\n        return\n\n    @inlineCallbacks\n    def do_install(self, *args):\n        if len(self.args) <= 1:\n            msg = '0 upgraded, 0 newly installed, 0 to remove and {0} not upgraded.\\n'\n            self.write(msg.format(random.randint(200, 300)))\n            self.exit()\n            return\n\n        packages = {}\n        for y in [re.sub('[^A-Za-z0-9]', '', x) for x in self.args[1:]]:\n            packages[y] = {\n                'version': '{0}.{1}-{2}'.format(random.choice(0, 1), random.randint(1, 40), random.randint(1, 10)),\n                'size': random.randint(100, 900)\n            }\n        totalsize = sum([packages[x]['size'] for x in packages])\n\n        self.write('Reading package lists... Done\\n')\n        self.write('Building dependency tree\\n')\n        self.write('Reading state information... Done\\n')\n        self.write('The following NEW packages will be installed:\\n')\n        self.write('  %s ' % ' '.join(packages) + '\\n')\n        self.write('0 upgraded, %d newly installed, 0 to remove and 259 not upgraded.\\n' % len(packages))\n        self.write('Need to get %s.2kB of archives.\\n' % (totalsize))\n        self.write('After this operation, %skB of additional disk space will be used.\\n' % (totalsize * 2.2,))\n        i = 1\n        for p in packages:\n            self.write('Get:%d http://ftp.debian.org stable/main %s %s [%s.2kB]\\n' %\n                       (i, p, packages[p]['version'], packages[p]['size']))\n            i += 1\n            yield self.sleep(1, 2)\n        self.write('Fetched %s.2kB in 1s (4493B/s)\\n' % (totalsize))\n        self.write('Reading package fields... Done\\n')\n        yield self.sleep(1, 2)\n        self.write('Reading package status... Done\\n')\n        self.write('(Reading database ... 177887 files and directories currently installed.)\\n')\n        yield self.sleep(1, 2)\n        for p in packages:\n            self.write('Unpacking %s (from .../archives/%s_%s_i386.deb) ...\\n' % (p, p, packages[p]['version']))\n            yield self.sleep(1, 2)\n        self.write('Processing triggers for man-db ...\\n')\n        yield self.sleep(2)\n        for p in packages:\n            self.write('Setting up %s (%s) ...\\n' % (p, packages[p]['version']))\n            self.fs.mkfile('/usr/bin/%s' % p, 0, 0, random.randint(10000, 90000), 33188)\n            self.protocol.commands['/usr/bin/%s' % p] = \\\n                command_faked_package_class_factory.getCommand(p)\n            yield self.sleep(2)\n        self.exit()\n\n    def do_moo(self):\n        self.write('         (__)\\n')\n        self.write('         (oo)\\n')\n        self.write('   /------\\\\/\\n')\n        self.write('  / |    ||\\n')\n        self.write(' *  /\\\\---/\\\\ \\n')\n        self.write('    ~~   ~~\\n')\n        self.write('....\"Have you mooed today?\"...\\n')\n        self.exit()\n\n    def do_locked(self):\n        self.errorWrite('E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\\n')\n        self.errorWrite('E: Unable to lock the list directory\\n')\n        self.exit()\n\ncommands['/usr/bin/apt-get'] = command_aptget\ncommands['apt-get'] = command_aptget\n", "path": "cowrie/commands/apt.py"}], "after_files": [{"content": "# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>\n# See the COPYRIGHT file for more information\n\nfrom __future__ import division, absolute_import\n\nimport random\nimport re\n\nfrom twisted.internet import reactor, defer\nfrom twisted.internet.defer import inlineCallbacks\n\nfrom cowrie.shell.command import HoneyPotCommand\n\ncommands = {}\n\nclass command_faked_package_class_factory(object):\n    @staticmethod\n    def getCommand(name):\n        class command_faked_installation(HoneyPotCommand):\n            def call(self):\n                self.write(b\"%s: Segmentation fault\\n\" % name)\n        return command_faked_installation\n\nclass command_aptget(HoneyPotCommand):\n    \"\"\"\n    apt-get fake\n    suppports only the 'install PACKAGE' command & 'moo'.\n    Any installed packages, places a 'Segfault' at /usr/bin/PACKAGE.'''\n    \"\"\"\n    def start(self):\n        if len(self.args) == 0:\n            self.do_help()\n        elif len(self.args) > 0 and self.args[0] == '-v':\n            self.do_version()\n        elif len(self.args) > 0 and self.args[0] == 'install':\n            self.do_install()\n        elif len(self.args) > 0 and self.args[0] == 'moo':\n            self.do_moo()\n        else:\n            self.do_locked()\n\n    def sleep(self, time, time2=None):\n        d = defer.Deferred()\n        if time2:\n            time = random.randint(time * 100, time2 * 100) / 100.0\n        reactor.callLater(time, d.callback, None)\n        return d\n\n    def do_version(self):\n        self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06\nSupported modules:\n*Ver: Standard .deb\n*Pkg:  Debian dpkg interface (Priority 30)\n Pkg:  Debian APT solver interface (Priority -1000)\n S.L: 'deb' Standard Debian binary tree\n S.L: 'deb-src' Standard Debian source tree\n Idx: Debian Source Index\n Idx: Debian Package Index\n Idx: Debian Translation Index\n Idx: Debian dpkg status file\n Idx: EDSP scenario file\\n''')\n        self.exit()\n        return\n\n    def do_help(self):\n        self.write('''apt 1.0.9.8.1 for amd64 compiled on Jun 10 2015 09:42:06\nUsage: apt-get [options] command\n       apt-get [options] install|remove pkg1 [pkg2 ...]\n       apt-get [options] source pkg1 [pkg2 ...]\n\napt-get is a simple command line interface for downloading and\ninstalling packages. The most frequently used commands are update\nand install.\n\nCommands:\n   update - Retrieve new lists of packages\n   upgrade - Perform an upgrade\n   install - Install new packages (pkg is libc6 not libc6.deb)\n   remove - Remove packages\n   autoremove - Remove automatically all unused packages\n   purge - Remove packages and config files\n   source - Download source archives\n   build-dep - Configure build-dependencies for source packages\n   dist-upgrade - Distribution upgrade, see apt-get(8)\n   dselect-upgrade - Follow dselect selections\n   clean - Erase downloaded archive files\n   autoclean - Erase old downloaded archive files\n   check - Verify that there are no broken dependencies\n   changelog - Download and display the changelog for the given package\n   download - Download the binary package into the current directory\n\nOptions:\n  -h  This help text.\n  -q  Loggable output - no progress indicator\n  -qq No output except for errors\n  -d  Download only - do NOT install or unpack archives\n  -s  No-act. Perform ordering simulation\n  -y  Assume Yes to all queries and do not prompt\n  -f  Attempt to correct a system with broken dependencies in place\n  -m  Attempt to continue if archives are unlocatable\n  -u  Show a list of upgraded packages as well\n  -b  Build the source package after fetching it\n  -V  Show verbose version numbers\n  -c=? Read this configuration file\n  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\nSee the apt-get(8), sources.list(5) and apt.conf(5) manual\npages for more information and options.\n                       This APT has Super Cow Powers.\\n''')\n        self.exit()\n        return\n\n    @inlineCallbacks\n    def do_install(self, *args):\n        if len(self.args) <= 1:\n            msg = '0 upgraded, 0 newly installed, 0 to remove and {0} not upgraded.\\n'\n            self.write(msg.format(random.randint(200, 300)))\n            self.exit()\n            return\n\n        packages = {}\n        for y in [re.sub('[^A-Za-z0-9]', '', x) for x in self.args[1:]]:\n            packages[y] = {\n                'version': '{0}.{1}-{2}'.format(random.choice([0, 1]), random.randint(1, 40), random.randint(1, 10)),\n                'size': random.randint(100, 900)\n            }\n        totalsize = sum([packages[x]['size'] for x in packages])\n\n        self.write('Reading package lists... Done\\n')\n        self.write('Building dependency tree\\n')\n        self.write('Reading state information... Done\\n')\n        self.write('The following NEW packages will be installed:\\n')\n        self.write('  %s ' % ' '.join(packages) + '\\n')\n        self.write('0 upgraded, %d newly installed, 0 to remove and 259 not upgraded.\\n' % len(packages))\n        self.write('Need to get %s.2kB of archives.\\n' % (totalsize))\n        self.write('After this operation, %skB of additional disk space will be used.\\n' % (totalsize * 2.2,))\n        i = 1\n        for p in packages:\n            self.write('Get:%d http://ftp.debian.org stable/main %s %s [%s.2kB]\\n' %\n                       (i, p, packages[p]['version'], packages[p]['size']))\n            i += 1\n            yield self.sleep(1, 2)\n        self.write('Fetched %s.2kB in 1s (4493B/s)\\n' % (totalsize))\n        self.write('Reading package fields... Done\\n')\n        yield self.sleep(1, 2)\n        self.write('Reading package status... Done\\n')\n        self.write('(Reading database ... 177887 files and directories currently installed.)\\n')\n        yield self.sleep(1, 2)\n        for p in packages:\n            self.write('Unpacking %s (from .../archives/%s_%s_i386.deb) ...\\n' % (p, p, packages[p]['version']))\n            yield self.sleep(1, 2)\n        self.write('Processing triggers for man-db ...\\n')\n        yield self.sleep(2)\n        for p in packages:\n            self.write('Setting up %s (%s) ...\\n' % (p, packages[p]['version']))\n            self.fs.mkfile('/usr/bin/%s' % p, 0, 0, random.randint(10000, 90000), 33188)\n            self.protocol.commands['/usr/bin/%s' % p] = \\\n                command_faked_package_class_factory.getCommand(p)\n            yield self.sleep(2)\n        self.exit()\n\n    def do_moo(self):\n        self.write('         (__)\\n')\n        self.write('         (oo)\\n')\n        self.write('   /------\\\\/\\n')\n        self.write('  / |    ||\\n')\n        self.write(' *  /\\\\---/\\\\ \\n')\n        self.write('    ~~   ~~\\n')\n        self.write('....\"Have you mooed today?\"...\\n')\n        self.exit()\n\n    def do_locked(self):\n        self.errorWrite('E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\\n')\n        self.errorWrite('E: Unable to lock the list directory\\n')\n        self.exit()\n\ncommands['/usr/bin/apt-get'] = command_aptget\ncommands['apt-get'] = command_aptget\n", "path": "cowrie/commands/apt.py"}]}