• This repository has been archived on 09/Apr/2024
  • Stars
    star
    275
  • Rank 148,889 (Top 3 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A transparent proxy that can modify and drop traffic for arbitrary TCP connections.

Trudy

Trudy is a transparent proxy that can modify and drop traffic for arbitrary TCP connections. Trudy can be used to programmatically modify TCP traffic for proxy-unaware clients. Trudy creates a 2-way "pipe" for each connection it proxies. The device you are proxying (the "client") connects to Trudy (but doesn't know this) and Trudy connects to the client's intended destination (the "server"). Traffic is then passed between these pipes. Users can create Go functions to mangle data between pipes. See it in action! For a practical overview, check out @tsusanka's very good blog post on using Trudy to analyze Telegram's MTProto.

Trudy can also proxy TLS connections. Obviously, you will need a valid certificate or a client that does not validate certificates.

Trudy was designed for monitoring and modifying proxy-unaware devices that use non-HTTP protocols. If you want to monitor, intercept, and modify HTTP traffic, Burp Suite is probably the better option.

Author

Written by Kelby Ludwig (@kelbyludwig)

Why I Built This

I have done security research that involved sitting between a embedded device and a server and modifying some custom binary protocol on the fly. This usually is a slow process that involves sniffing legitimate traffic, and then rebuilding packets programmatically. Trudy enables Burp-like features for generalized TCP traffic.

Simple Setup

  1. Configure a virtual machine (Trudy has been tested on a 64-bit Debian 8 VM) to shove all traffic through Trudy. I personally use a Vagrant VM that sets this up for me. The Vagrant VM is available here. If you would like to use different --to-ports values, you can use Trudy's command line flags to change Trudy's listening ports.

    iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 8888 -m tcp -j REDIRECT --to-ports 8080

    iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -m tcp -j REDIRECT --to-ports 6443

    iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp -j REDIRECT --to-ports 6666

    ip route del 0/0

    route add default gw 192.168.1.1 dev eth1

    sysctl -w net.ipv4.ip_forward=1

  2. Clone the repo on the virtual machine and build the Trudy binary.

    git clone https://github.com/kelbyludwig/trudy.git

    cd trudy

    go install

  3. Run the Trudy binary as root. This starts the listeners. If you ran the iptables commands above, iptables will forward traffic destined for port 443 to port 6443. Trudy listens on this port and expects traffic coming into this port to be TLS. All other TCP connections will be forwarded through port 6666.

    sudo $GOPATH/bin/trudy

  4. Setup your host machine to use the virtual machine as its router. You should see connections being made in Trudy's console but not notice any traffic issues on the host machine (except TLS errors).

  5. In order to manipulate data, just implement whatever functions you might need within the module package. The default implementations for these functions are hands-off, so if they do not make sense for your situation, feel free to leave them as they are. More detailed documentation is in the module package and the data flow is detailed below.

  6. To access the interceptor, visit http://<IP ADDRESS OF VM>:8888/ in your web browser. The only gotcha here is you must visit the interceptor after starting Trudy but before Trudy receives a packet that it wants to intercept.

Data Flow

Module methods are called in this order. Downward arrows indicate a branch if the Do* function returns true.

Deserialize -> Drop -> DoMangle ->  DoIntercept -> DoPrint -> Serialize -> BeforeWriteTo(Server|Client) -> AfterWriteTo(Server|Client)
                         |         /                |        /
                         |_> Mangle                 |_> PrettyPrint

More Repositories

1

gokart

A static analysis tool for securing Go code
Go
2,175
star
2

noseyparker

Nosey Parker is a command-line program that finds secrets and sensitive information in textual data and Git history.
Rust
1,555
star
3

Hob0Rules

Password cracking rules for Hashcat based on statistics and industry patterns
1,404
star
4

pentestly

Python and Powershell internal penetration testing framework
Python
716
star
5

purple-team-attack-automation

Praetorian's public release of our Metasploit automation of MITRE ATT&CKâ„¢ TTPs
Ruby
713
star
6

DVRF

The Damn Vulnerable Router Firmware Project
HTML
661
star
7

PortBender

TCP Port Redirection Utility
C
657
star
8

fingerprintx

Standalone utility for service discovery on open ports!
Go
547
star
9

gato

GitHub Actions Pipeline Enumeration and Attack Tool
Python
488
star
10

pyshell

PyShell makes interacting with web-based command injection less painful, emulating the feel of an interactive shell as much as possible.
Python
255
star
11

mitm-vm

An easy-to-deploy virtual machine that can provide flexible man-in-the-middle capabilities.
Shell
191
star
12

gladius

Automated Responder/secretsdump.py cracking
Python
181
star
13

snowcat

a tool to audit the istio service mesh
Go
173
star
14

vulcan

a tool to make it easy and fast to test various forms of injection
C++
172
star
15

ADFSRelay

Proof of Concept Utilities Developed to Research NTLM Relaying Attacks Targeting ADFS
Go
172
star
16

trident

automated password spraying tool
Go
145
star
17

NTLMRecon

A tool for performing light brute-forcing of HTTP servers to identify commonly accessible NTLM authentication endpoints.
Go
78
star
18

epictreasure

radare, angr, pwndbg, binjitsu, ect in a box ready for pwning
Shell
74
star
19

INTRACTABLEGIRAFFE

A Proof of Concept Rootkit Demonstrating Keylogging and Virtual File System (VFS) Capabilities
C
69
star
20

proxylogon-exploit

Proof-of-concept exploit for CVE-2021-26855 and CVE-2021-27065. Unauthenticated RCE in Exchange.
Python
46
star
21

hashcatJS

An implementation of the hashcat rules engine in javascript
JavaScript
45
star
22

slack-c2bot

Slack C2bot that executes commands and returns the output.
Go
44
star
23

ruby_hashcat

Command line wrapper, Library, and Rest API for oclHashcat.
Ruby
40
star
24

dert

DNS Enumeration and Reconnaissance Tool
Ruby
37
star
25

Matryoshka

Matryoshka loader is a tool that red team operators can leverage to generate shellcode for Microsoft Office document phishing payloads.
C
36
star
26

Okta_Watering_Hole

Next Generation Phishing Tool For Internal / Red Teams
Python
35
star
27

ctf-writeups

Collection of Praetorian solutions to CTF challenges
OpenEdge ABL
25
star
28

chariot-ui

Chariot Offensive Security Platform
TypeScript
21
star
29

konstellation

Konstellation is a configuration-driven CLI tool to enumerate cloud resources and store the data into Neo4j.
Cypher
19
star
30

bsidesaustin

Python
14
star
31

burp-wcf-gzip

Burp extension for decoding WCF-gzipped requests.
Python
12
star
32

gcloud-lockdown

Scripts to demonstrate VPC Service Controls between tenant and shared projects
Shell
12
star
33

chariot-launch-nuclei-templates

11
star
34

highlight

Text file to BMP image with box drawing and blurring from the command line
C
9
star
35

log4j-detector

Log4j detector and reporting server for scalable detection of vulnerable running processes.
Go
8
star
36

praetorian-cli

The command line interface for Praetorian products and services
Python
7
star
37

aws-labs

Shell
5
star
38

tpm_bound_sa_key

Go
5
star
39

rpi-setup

set up rpi for zbwardrive
Python
5
star
40

sonicwall-nsv-decrypter

C
5
star
41

product-frontend-interview

JavaScript
3
star
42

zeroqlik-detect

A Nuclei template to detect ZeroQlik (CVE-2023-41265 and CVE-2023-41266)
3
star
43

product-backend-interview

Java
1
star