Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

[!] Listener startup on port 443 failed: global name 'sys' is not defined #796

Closed
franccesco opened this issue Nov 2, 2017 · 3 comments
Closed

Comments

@franccesco
Copy link

franccesco commented Nov 2, 2017

Empire Version

2.3

OS Information (Linux flavor, Python version)

Ubuntu 16.04 Python 2.7.12

Expected behavior and description of the error, including any actions taken immediately prior to the error. The more detail the better.

Can't setup a listener with SSL. Everything works great without SSL. It throws this error:
[!] Listener startup on port 443 failed: global name 'sys' is not defined
import sys was missing?

I didn't had this issue before, I usually run a VPS on DigitalOcean with Ubuntu 16.04 X64, the installation works great, the only package it doesn't find is Powershell, which I successfully installed using the microsoft guide, after that everything installed and compile without an issue.

Am I missing a step? maybe I didn't setup something? It only happens with SSL though.

Screenshot of error, embedded text output, or Pastebin link to the error

================================================================
 [Empire]  Post-Exploitation Framework
================================================================
 [Version] 2.3 | [Web] https://github.com/empireProject/Empire
================================================================

   _______ .___  ___. .______    __  .______       _______
  |   ____||   \/   | |   _  \  |  | |   _  \     |   ____|
  |  |__   |  \  /  | |  |_)  | |  | |  |_)  |    |  |__
  |   __|  |  |\/|  | |   ___/  |  | |      /     |   __|
  |  |____ |  |  |  | |  |      |  | |  |\  \----.|  |____
  |_______||__|  |__| | _|      |__| | _| `._____||_______|


       280 modules currently loaded

       0 listeners currently active

       0 agents currently active


(Empire) > listeners
[!] No listeners currently active
(Empire: listeners) > uselistener http
(Empire: listeners/http) > set Name ssl_error
(Empire: listeners/http) > set Port 443
(Empire: listeners/http) > set CertPath /root/Empire/data/
(Empire: listeners/http) > info

    Name: HTTP[S]
Category: client_server

Authors:
  @harmj0y

Description:
  Starts a http[s] listener (PowerShell or Python) that uses a
  GET/POST approach.

HTTP[S] Options:

  Name              Required    Value                            Description
  ----              --------    -------                          -----------
  SlackToken        False                                        Your SlackBot API token to communicate with your Slack instance.
  ProxyCreds        False       default                          Proxy credentials ([domain\]username:password) to use for request (default, none, or other).
  KillDate          False                                        Date for the listener to exit (MM/dd/yyyy).
  Name              True        ssl_error                        Name for the listener.
  Launcher          True        powershell -noP -sta -w 1 -enc   Launcher string.
  DefaultDelay      True        5                                Agent delay/reach back interval (in seconds).
  DefaultLostLimit  True        60                               Number of missed checkins before exiting
  WorkingHours      False                                        Hours for the agent to operate (09:00-17:00).
  SlackChannel      False       #general                         The Slack channel or DM that notifications will be sent to.
  DefaultProfile    True        /admin/get.php,/news.php,/login/ Default communication profile for the agent.
                                process.php|Mozilla/5.0 (Windows
                                NT 6.1; WOW64; Trident/7.0;
                                rv:11.0) like Gecko
  Host              True        https://159.203.163.74:443       Hostname/IP for staging.
  CertPath          False       /root/Empire/data/               Certificate path for https listeners.
  DefaultJitter     True        0.0                              Jitter in agent reachback interval (0.0-1.0).
  Proxy             False       default                          Proxy to use for request (default, none, or other).
  UserAgent         False       default                          User-agent string to use for the staging request (default, none, or other).
  StagingKey        True        .hDx[YL}&g^fKpZ-A0%WNCcJUs~bydQI Staging key for initial agent negotiation.
  BindIP            True        0.0.0.0                          The IP to bind to on the control server.
  Port              True        443                              Port for the listener.
  ServerVersion     True        Microsoft-IIS/7.5                Server header for the control server.
  StagerURI         False                                        URI for the stager. Must use /download/. Example: /download/stager.php


(Empire: listeners/http) > execute
[*] Starting listener 'ssl_error'
[!] Listener startup on port 443 failed: global name 'sys' is not defined
[!] Listener failed to start!
(Empire: listeners/http) >

Any additional information

@dash1b
Copy link

dash1b commented Nov 2, 2017

line 974 in /lib/listeners/http.py refers to sys.version_info
pyversion = sys.version_info

add 'import sys' at the top of ../Empire/lib/listeners/http.py
recompile it:
python -m py_compile htty.py

reload and error is fixed.

@franccesco
Copy link
Author

Yup, it work :) import sys was missing.

(Empire) > listeners
[!] No listeners currently active
(Empire: listeners) > uselistener http
(Empire: listeners/http) > set Name ssl_test
(Empire: listeners/http) > set CertPath data/
(Empire: listeners/http) > set Port 443
(Empire: listeners/http) > execute
[*] Starting listener 'ssl_test'
[+] Listener successfully started!
(Empire: listeners/http) >

Thank you.

@xorrior
Copy link
Contributor

xorrior commented Nov 3, 2017

fixed in all relevant listeners. Master and Dev

@xorrior xorrior closed this as completed Nov 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants