# tcpspy

> TCP Spy is a simple node.js library to intercept raw TCP connections. Mostly used to reverse engineer TCP protocols.

Latest version **0.1.3** (published 2016-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install tcpspy
pnpm add tcpspy
yarn add tcpspy
bun add tcpspy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2016-07-22 |
| First published | 2016-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.4.7 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sam Decrock |
| Maintainers | samdecrock |

## Links

- npm: https://www.npmjs.com/package/tcpspy
- Repository: https://github.com/SamDecrock/node-tcp-spy
- Homepage: https://github.com/SamDecrock/node-tcp-spy#readme
- Issues: https://github.com/SamDecrock/node-tcp-spy/issues
- npm.io page: https://npm.io/package/tcpspy

## Recent versions

- 0.1.3 (latest) — 2016-07-22
- 0.1.2 — 2016-07-22
- 0.1.0 — 2016-07-21

## README

TCP Spy
============

TCP Spy is a simple node.js library to intercept raw TCP connections. I use it to reverse engineer TCP protocols ;-)

## Install

You can install __tcpspy__ using the Node Package Manager (npm):

    npm install tcpspy

## Simple example
```js
var tcpspy = require('tcpspy');

var httpProxy = new TCPSpy(9000, "google.com", 80, "HTTP Proxy");
httpProxy.on('clientData', function (clientData) {
  console.log('clientData:', clientData);
});
httpProxy.on('serverData', function (serverData) {
  console.log('serverData:', serverData);
});
httpProxy.start();

console.log('Now go to http://localhost:9000 to test this out!');
```

## Simple example using an object as parameters
```js
var tcpspy = require('tcpspy');

var httpProxy = new TCPSpy({
  sourcePort: 9000,
  destinationIP: "google.com",
  destinationPort: 80,
  debugIdentifier: "HTTP Proxy"
});
httpProxy.on('clientData', function (clientData) {
  console.log('clientData:', clientData);
});
httpProxy.on('serverData', function (serverData) {
  console.log('serverData:', serverData);
});
httpProxy.start();

console.log('Now go to http://localhost:9000 to test this out!');
```

Note: if you leave out the `debugIdentifier`, no debugging info will be displayed.



## Fancy example with colors
```js
var tcpspy = require('tcpspy');

var colors = require('colors/safe');

if(!colors) console.log('Do "npm install https://github.com/grit96/colors.js" first.');

console.log(colors.red(' RED = client data'));
console.log(colors.blue('BLUE = server data'));


var httpProxy = new TCPSpy(9000, "google.com", 80, "HTTP Proxy");
httpProxy.on('clientData', function (clientData) {
  console.log(colors.red(clientData));
  console.log(colors.red(clientData.toString()));
});
httpProxy.on('serverData', function (serverData) {
  console.log(colors.blue(serverData));
  console.log(colors.blue(serverData.toString()));
});
httpProxy.start();

console.log('Now go to http://localhost:9000 to test this out!');
```

---
_Source: https://npm.io/package/tcpspy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
