Listener

A listener is the component that waits for an incoming connection from an exploited system. You must set up a listener if you intend to establish a connection between your Metasploit server and the exploited machine. For example, if you have delivered an executable to a target host, you will need to set up a listener to wait for a connection from it. When the host connects to the listener, a session opens on their machine, which will enable you to interact with it to do things like collect evidence from their system.

In Metasploit Pro, you can set up persistent listeners, which will continuously listen for connections back from a compromised host. You can set up a persistent listener from the "Global Settings" area of the web interface. Each listener is bound to a specific project..

To set up a listener, you will need to define the listening host, listening port, and payload type. You can also assign a post-exploitation macro to the listener, so that when the exploited system makes a connection back to the listener, Metasploit Pro runs the macro.

Use a listeners when creating a social engineering campaign, using the Payload Generator or anytime you have deployed an executable.

Set Up a Listener

  1. Select Administration > Global Settings.
  2. Go to the Persistent Listeners tab.
  3. Click the** New Listener** button.
  4. When the “Create a Listener” form appears, specify the following:
    • Associated Project - Choose the project you want to use to access and manage open sessions.
    • Listener Payload - Choose the post-exploitation payload for the listener.
    • Listener Address - Specify the IP address that you want the payload to connect back to (e.g., the IP address of the Metasploit server).
    • Listener Port - Specify the port.
    • **Enabled - **If the listener is active.
  5. Save the listener.

Assign a Listener to a Macro

  1. Select Administration > Global Settings.
  2. Go to the Macros tab.
  3. Select New Macro.
  4. Fill in the following information: 5. Macro name - The name of the macro. Required. 6. Description - The description of the macro. 7. Time limit (seconds) - Amount of time the macro will attempt to run.
  5. Click Save.
  6. After saving a second menu will become available.
  7. Under Modules select the post-exploitation modules you want to run. 7. Some modules require secondary configuration.
  8. Any modules added will appear under "Actions".
  9. Click Update Macro.
  1. Go back to Global Settings.
  2. Go to the Persistent Listeners tab.
  3. Click on an existing macro.
  4. In the "Auto Launch Macro" drop-down, select the macro created.
  5. To save, click Update Listener