● Notice //GitHub (@shehzade) is temporarily suspended pending an automated false-positive review. All tools are hosted on this Code Mirror and available on request (contact); GitHub links will return once reinstated.
PUBLIC MIRRORGo v1.0

Multi-protocol network egress assessment and DLP verification framework featuring automated L4 sweeps, corporate proxy traversal, and covert protocol smuggling across 20+ channels.

$ git clone https://shehzade.io/repos/contraband.git Copy
Source ZIP (1.93 MB)
Code 174 Commits 1
contraband / pkg / client / proxy / buffered_conn.go
← Back to directory
29 lines · 636 B
Raw
1package proxy
2
3import (
4 "bufio"
5 "io"
6 "net"
7)
8
9// bufferedConn wraps net.Conn with a buffered reader using io.MultiReader
10// so that any bytes read ahead by bufio.Reader during HTTP header parsing
11// are preserved and returned before reading directly from the underlying connection.
12type bufferedConn struct {
13 net.Conn
14 r io.Reader
15}
16
17func newBufferedConn(c net.Conn, br *bufio.Reader) net.Conn {
18 if br == nil || br.Buffered() == 0 {
19 return c
20 }
21 return &bufferedConn{
22 Conn: c,
23 r: io.MultiReader(io.LimitReader(br, int64(br.Buffered())), c),
24 }
25}
26
27func (b *bufferedConn) Read(p []byte) (int, error) {
28 return b.r.Read(p)
29}