Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/shellhazard/tcpint

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/shellhazard/tcpint

  • v0.0.0-20210524102809-f4dda85d1bd4
  • Source
  • Go
  • Socket score

Version published
Created
Source

tcp-intercept

Barebones intercepting TCP proxy written in Go. Based off this gist by ericflo. Intended for use with text-based protocols. Currently will only read and split data by a provided delimeter.

Example

package main

import (
	"fmt"

	"github.com/shellhazard/tcpint"
)

const (
	LocalServerAddress string = "127.0.0.1:1337"
	RemoteServerAddress string = "8.8.8.8:25565"
)

// From our client to our proxy, to our remote host
func handleOutgoing(b []byte) []byte {
	fmt.Println("incoming data:", string(b))
	return b
}

// From the remote host to our proxy, to our client
func handleIncoming(b []byte) []byte {
	fmt.Println("outgoing data:", string(b))
	return b
}

func main() {
	proxy := tcpint.NewProxy(
		LocalServerAddress,
		RemoteServerAddress,
		handleOutgoing,
		handleIncoming,
		tcpint.NULLBYTE
	)

	// Block
	for {
		select{}
	}
}

FAQs

Package last updated on 24 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc