Skip to content
HuskyHacks edited this page Feb 20, 2022 · 19 revisions

Setting Up A Listener Page

The "listener" is just a page in a Notion notebook. But you can set it up to catch the callbacks for your agents:

  1. Create your listener page. Add a new page to Notion, preferably in a notebook that's not being used for anything else:

  2. In the upper right corner, click "Share" and "Invite". Add your Notion Developer API account to this page:

  3. Copy the URL of your page down. If you're in the web browser Notion client, this can be taken from the URL of the page. In the desktop app, enter ctl-l to copy it to your clipboard.

  4. If your listener URL is:

https://www.notion.so/LISTENER-11223344556677889900112233445566                     

... then your parent page ID is the number after the name of the listener, split with hyphens into the following schema: 8-4-4-4-12. Meaning, your parent page ID would be: 11223344-5566-7788-9900-112233445566. This value is used to connect your agent to your listener, so keep track of it!

Python Installer Script (QuickStart)

Usage

$ sudo python3 main.py -h
usage: main.py [-h] [-o {linux,windows}] [-b {debug,release}] [-c]

OffensiveNotion Setup. Must be run as root. Generates the OffensiveNotion agent in a container.

optional arguments:
  -h, --help            show this help message and exit
  -o {linux,windows}, --os {linux,windows}
                        Target OS
  -b {debug,release}, --build {debug,release}
                        Binary build
  -c, --c2lint          C2 linter. Checks your C2 config by creating a test page on your Listener.

How To

The main.py script handles all setup and agent compilation. You need docker in order to use it. If you don't have docker already:

$ sudo apt-get install docker.io

Next, install the Python dependencies:

$ pip3 install poetry
$ poetry shell
$ poetry install

Then run the main script:

$ sudo python3 main.py [-h] [-o {linux,windows}] [-b {debug,release}] [-c]

...and follow the prompts to perform the installation. It creates a Docker container and creates the agent inside, then copies it to your physical host and deletes the container.

Agent Control

When your agent is built and dispatched to the target environment, it uses your secret key and the parent page ID to check in. Once this happens, a new page with the hostname of where the agent landed will appear as a child page of your listener:

When you click on this page, you are now in the agent's "session". Which is really just a notebook page for the most part, but has some special functions.

Running commands

Make a To Do block and add any shell command you want to run on the target. When you are ready to execute the command, add the bullseye emoji to the end: 🎯

When your agent checks in, the stdout of the command will be added to the notebook under the To Do block as code-syntax highlighted text.

Hey, remember this is a normal Notion page! Add some documentation for your operation while you go:

Why not stack up a bunch of commands to do initial check-in safety checks...

... and then run them all when an agent checks in?

Clone this wiki locally