# NGROK

### Purpose

Ngrok allows us to share internal services to Internet facing systems. It's an incredibly useful way to access internal systems or create a way to directly access sensitive network systems.

### Setup

Visit [ngrok.com](https://ngrok.com) to get set up with an account.&#x20;

Download the tool at [`https://ngrok.com/download`](https://ngrok.com/download)

Configure the ngrok preferences with the applicable key

```
ngrok config add-authtoken ***REDACTED KEY***
```

### Usage

As always, we ask for help to learn what to do.

`ngrok help`

To start a listener, we can simply run the code below:

`ngrok http 9999`

This will result in a window similar to below:

![After starting the listener, this shows the web interface to reach the internal port](https://15634114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUBcWDIntFMCfIaMka5%2Fuploads%2FjmisW7ELFp3bbykCKzD5%2F123.png?alt=media\&token=2f0e45a9-a30a-4646-8d82-1d5994cc8c77)

In the example above, we can directly access the service on localhost:9999 by accessing the page at [`https://7807-52-22-69-233.ngrok.io`](https://7807-52-22-69-233.ngrok.io). This was a python3 simple http server on that port.

```
EXAMPLES:
    ngrok http 80                    # secure public URL for port 80 web server
    ngrok http -subdomain=baz 8080   # port 8080 available at baz.ngrok.io
    ngrok http foo.dev:80            # tunnel to host:port instead of localhost
    ngrok http https://localhost     # expose a local https server
    ngrok tcp 22                     # tunnel arbitrary TCP traffic to port 22
    ngrok tls -hostname=foo.com 443  # TLS traffic for foo.com to port 443
    ngrok start foo bar baz          # start tunnels from the configuration file

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.m4lwhere.org/offensive/ngrok.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
