Giter Club home page Giter Club logo

go-http-injector's Introduction

tcp-proxy

go-tcp-proxy CI Maintainability

A small TCP proxy written in Go

This project was intended for debugging text-based protocols. The next version will address binary protocols.

Install

Source

$ go get -v github.com/lutfailham96/go-http-injector/cmd/tcp-proxy

Usage

$ tcp-proxy --help
Usage of tcp-proxy:
  -c: output ansi colors
  -h: output hex
  -l="localhost:9999": local address
  -n: disable nagles algorithm
  -r="localhost:80": remote address
  -s="server address / sni address": server:443
  -rp="use as reverse proxy"
  -in-payload="payload to be used as incoming TCP packet"
  -out-payload="payload to be used as outbound TCP packet"
  -v: display server actions
  -vv: display server actions and all tcp data

Note: Regex match and replace only works on text strings and does NOT work across packet boundaries

Client Example

Use custom payload

$ go run cmd/tcp-proxy/main.go \
    -l 127.0.0.1:9999 \
    -r 127.0.0.1:10443 \
    -s myserver:443 \
    -out-payload="GET ws://cloudflare.com HTTP/1.1[crlf]Host: [host][crlf]Upgrade: websocket[crlf]Connection: keep-alive[crlf][crlf]"

Proxying from 127.0.0.1:9999 to 104.15.50.1:443

stunnel configuration

[ws]
client = yes
accept = 127.0.0.1:10443
connect = 104.15.50.5:443
sni = cloudflare.com
cert = /etc/stunnel/ssl/stunnel.pem

Tunnel over SSH conneciton

$ ssh -o "ProxyCommand=corkscrew 127.0.0.1 9999 %h %p" -v4ND 1080 my-user@localhost

Todo

  • Implement tcpproxy.Conn which provides accounting and hooks into the underlying net.Conn
  • Verify wire protocols by providing encoding.BinaryUnmarshaler to a tcpproxy.Conn
  • Modify wire protocols by also providing a map function
  • Implement SOCKS v5 to allow for user-decided remote addresses

go-http-injector's People

Contributors

ernesto-jimenez avatar flaccid avatar guitarbum722 avatar heewa avatar jpillora avatar lutfailham96 avatar mpodanow avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.