From bd72328bb3f37443b490e3143e0e5d7e21d26c3b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 28 May 2016 08:28:35 -0400 Subject: [PATCH] Cast port from string to int when starting REST service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The REST API won’t start due to a bug: ./empire --rest --username "emp" --password "emp" [*] Loading modules from: /mnt/hgfs/cjones/Empire/lib/modules/ Starting Empire RESTful API on port: 1337 RESTful API token: 2bjmeuwa6pr6yy4x0n88rauyyl1nve7cekdgkefh Traceback (most recent call last): File "/usr/lib/python2.7/logging/init.py", line 853, in emit msg = self.format(record) File "/usr/lib/python2.7/logging/init.py", line 726, in format return fmt.format(record) File "/usr/lib/python2.7/logging/init.py", line 465, in format record.message = record.getMessage() File "/usr/lib/python2.7/logging/init.py", line 329, in getMessage msg = msg % self.args TypeError: %d format: a number is required, not str Logged from file _internal.py, line 87 After casting the port from a string to an int, the REST service works. --- empire | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empire b/empire index e5d1952..70c7491 100755 --- a/empire +++ b/empire @@ -1182,7 +1182,7 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password # wrap the Flask connection in SSL and start it context = ('./data/empire.pem', './data/empire.pem') - app.run(host='0.0.0.0', port=port, ssl_context=context, threaded=True) + app.run(host='0.0.0.0', port=int(port), ssl_context=context, threaded=True)