@ice3man543/interactsh-node
Version: 
Node.js client for Interactsh - A tool for detecting out-of-band interactions
219 lines (162 loc) • 7.97 kB
Markdown
interactsh-cli is a NODE client of GO based tool [Interactsh](https://github.com/projectdiscovery/interactsh).
```bash
npm install @ice3man543/interactsh-node
```
```bash
npm install -g @ice3man543/interactsh-node
```
```javascript
import { register, poll, deregister } from '@ice3man543/interactsh-node';
// Register with interactsh server
const data = await register('oast.fun', 5, 'your-token');
console.log('URLs:', data[0].payloads.map(p => p.url));
// Poll for interactions
const config = {
  host: 'oast.fun',
  correlationId: data[0].correlationId,
  secretKey: data[0].secret,
  privateKey: data[0].priv,
  token: 'your-token',
  aesKey: '',
  data: [],
  pollInterval: 4000,
};
// Start polling
setInterval(() => {
  poll(config.correlationId, config.secretKey, config.host, config.token)
    .then(response => {
      console.log('Interactions received:', response);
    });
}, config.pollInterval);
// Deregister when done
await deregister(config.secretKey, config.correlationId, config.host, config.token);
```
```interactsh-cli -h```
This will display help for the tool. Here are all the switches it supports.
- `register(host, payloadCount, token)` - Register with Interactsh server
- `poll(correlationId, secretKey, host, token)` - Poll for interactions
- `deregister(secretKey, correlationId, host, token)` - Deregister from server
- `processData(aesKey, polledData)` - Process and decrypt interaction data
- `generateUrl(correlationId, payloadCount, host)` - Generate payload URLs
All TypeScript types are exported:
- `ConfigData`
- `StoredData` 
- `Interaction`
- `Data`
- `Protocol`
- `ID`
```
Usage:
  ./interactsh-cli [flags]
Flags:
INPUT:
   -s, --server string  interactsh server(s) to use (default "oast.pro,oast.live,oast.site,oast.online,oast.fun,oast.me")
CONFIG:
   --config string                           flag configuration file (default "$HOME/.config/interactsh-cli/config.yaml")
   -n, --number int                          number of interactsh payload to generate (default 1)
   -t, --token string                        authentication token to connect protected interactsh server
   --poll-interval int                      poll interval in seconds to pull interaction data (default 5)
FILTER:
   --dns-only   display only dns interaction in CLI output
   --http-only  display only http interaction in CLI output
   --smtp-only  display only smtp interactions in CLI output
OUTPUT:
   -o string  output file to write interaction data
   -json      write output in JSONL(ines) format
   -v         display verbose interaction
```
## Interactsh Client
Install using NPM
```sh
npm install @projectdiscovery/interactsh-cli
```
Install using yarn
```sh
yarn add @projectdiscovery/interactsh-cli
```
### Default Run
This will generate a unique payload that can be used for OOB testing with minimal interaction information in the output.
```console
interactsh-cli
┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│   ___  _   _  _____  _____  ____      _     ____  _____  ____   _   _   │
│  |_ _|| \ | ||_   _|| ____||  _ \    / \   / ___||_   _|/ ___| | | | |  │
│   | | |  \| |  | |  |  _|  | |_) |  / _ \ | |      | |  \___ \ | |_| |  │
│   | | | |\  |  | |  | |___ |  _ <  / ___ \| |___   | |   ___) ||  _  |  │
│  |___||_| \_|  |_|  |_____||_| \_\/_/   \_\\____|  |_|  |____/ |_| |_|  │
│                                                                         │
│                           projectdiscovery.io                           │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘
✓ Registered successfully.
[INF] Listing 1 payload for OOB Testing
[INF] 1.(caqdjfsp25ca04rrcybggfms38hyyyyyb.oast.pro)
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (AAAA) from 172.247.34.69 at 2022-06-19_13:37
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (undefined) from 172.247.34.69 at 2022-06-19_13:37
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (A) from 172.247.34.69 at 2022-06-19_13:37
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (A) from 172.247.34.69 at 2022-06-19_13:37
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (AAAA) from 172.247.34.69 at 2022-06-19_13:37
[caqdjfsp25ca04rrcybggfms38hyyyyyb] Received DNS interaction (undefined) from 172.247.34.69 at 2022-06-19_13:37
```
<!-- ### Verbose Mode
Running the `interactsh-cli` in **verbose mode** (v) to see the whole request and response, along with an output file to analyze afterwards.
```console
interactsh-cli -v -o interactsh-logs.txt
    _       __                       __       __  
   (_)___  / /____  _________ ______/ /______/ /_ 
  / / __ \/ __/ _ \/ ___/ __ '/ ___/ __/ ___/ __ \
 / / / / / /_/  __/ /  / /_/ / /__/ /_(__  ) / / /
/_/_/ /_/\__/\___/_/   \__,_/\___/\__/____/_/ /_/ 1.0.3
    projectdiscovery.io
[INF] Listing 1 payload for OOB Testing
[INF] c58bduhe008dovpvhvugcfemp9yyyyyyn.oast.pro
[c58bduhe008dovpvhvugcfemp9yyyyyyn] Received HTTP interaction from 103.22.142.211 at 2021-09-26 18:08:07
------------
HTTP Request
------------
GET /favicon.ico HTTP/2.0
Host: c58bduhe008dovpvhvugcfemp9yyyyyyn.oast.pro
Referer: https://c58bduhe008dovpvhvugcfemp9yyyyyyn.oast.pro
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
-------------
HTTP Response
-------------
HTTP/1.1 200 OK
Connection: close
Content-Type: text/html; charset=utf-8
Server: oast.pro
<html><head></head><body>nyyyyyy9pmefcguvhvpvod800ehudb85c</body></html>
``` -->
Using the `server` flag, [`interactsh-cli`](https://github.com/projectdiscovery/interactsh-node) can be configured to connect with a self-hosted Interactsh server, this flag accepts single or multiple server separated by comma.
```sh
interactsh-cli --server hackwithautomation.com
```
We maintain a list of default Interactsh servers to use with [`interactsh-cli`](https://github.com/projectdiscovery/interactsh-node):
- oast.pro
- oast.live
- oast.site
- oast.online
- oast.fun
- oast.me
Default servers are subject to change/rotate/down at any time, thus we recommend using a self-hosted interactsh server if you are experiencing issues with the default server.
Using the `token` flag, [`interactsh-cli`](https://github.com/projectdiscovery/interactsh-node) can connect to a self-hosted Interactsh server that is protected with authentication.
```sh
interactsh-cli --server hackwithautomation.com --token XXX
```
[](https://github.com/projectdiscovery/interactsh-web) is a free and open-source web client that displays Interactsh interactions in a well-managed dashboard in your browser. It uses the browser's local storage to store and display all incoming interactions. By default, the web client is configured to use **interact.sh** as default interactsh server, and supports other self-hosted public/authencaited interactsh servers as well.
A hosted instance of **interactsh-web** client is available at https://app.interactsh.com
<img width="2032" alt="interactsh-web" src="https://user-images.githubusercontent.com/8293321/136621531-d72c9ece-0076-4db1-98c9-21dcba4ba09c.png">