https://github.com/schmichael/netdbg
Network protocol debugger
https://github.com/schmichael/netdbg
Last synced: about 1 year ago
JSON representation
Network protocol debugger
- Host: GitHub
- URL: https://github.com/schmichael/netdbg
- Owner: schmichael
- License: other
- Created: 2014-08-19T16:46:22.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-20T16:30:50.000Z (almost 12 years ago)
- Last Synced: 2025-02-11T10:59:06.864Z (over 1 year ago)
- Language: Go
- Size: 160 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
netdbg
------
Network protocol proxy/debugger. A transparent proxy between clients and
servers to ease protocol debugging and degenerate case testing.
Very early/experimental. Just a toy. Interfaces may change wildly.
```sh
go get github.com/schmichael/netdbg/cmd/netdbg
# Prints every time a packet is sent or received
netdbg prog,prog localhost:8080 google.com:80
# Prints escaped version of sent and received data
netdbg log,log localhost:8080 google.com:80
# Slow loris attack: send 1 byte per second and print progress
netdbg slow:prog,prog localhost:8080 google.com:80
# In another terminal
curl localhost:8080 > /dev/null
```
Filters
-------
Filters are implemented as an interface which implements Accept and
Close methods. However, the most important part of a filters
functionality is that it's given in and out chans for manipulating the
data stream.
Each filter can be used on data the *client sends* or on data the *server sends*.
To cleanly shutdown the filter pipeline a filter must close its `out`
chan when their `in` chan is closed.
Future
======
Implement Filters as WriteClosers, initialize in reverse, and give the next
filter in the chain to the filter new function. Last filter in chain would be
given actual net.Conn as writer.
**Pros**
* Clearer: Filter interface would make how to implement Filters clear again.
* Simpler: No more chan management.
* Reusable: Easy to reuse existing Writers (bzip, gzip, etc) in filters.
**Cons**
* Not always simpler: Write() methods would have to be reentrant as a prior
filter could be concurrently calling it. Makes races much easier to write on
filters with state.
*Could we provide both APIs?*