trudy | transparent proxy that can modify and drop traffic | Proxy library
kandi X-RAY | trudy Summary
kandi X-RAY | trudy Summary
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.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of trudy
trudy Key Features
trudy Examples and Code Snippets
Community Discussions
Trending Discussions on trudy
QUESTION
I have a bit of a complicated iteration and joining problem, please allow me to provide context. I have two lists:
List #1 contains a list of users:
users = ['Alice', 'Bob, 'Gary', 'Trudy', 'Charles', 'Edith', ...]
List #2 are tuples representing an arbitrary ID and a Family Member:
relations = [('0', 'Sister'), ('1', 'Brother'), ('0', 'Grandmother'), ('1', 'Grandfather'), ('2', 'Mother'), ('3', 'Father'), ('4', 'Brother'), ('0', 'Mother'), ('1', 'Father'), ('2', 'Brother'), (...)]
The challenge is:
- relations for a User start when the ID is 0 in List #2
- and the end of their relations is marked when 0 is seen again
How can I combine them into one list where each Relation ID and Family Member has the User attached?
For example Alice would look like:
((Alice, ('0', 'Sister')), (Alice, ('1', 'Brother'))
While Bob's relations start right after at '0', 'Grandmother'
and end with '4', 'Brother')
, and Gary's relations follow-on with '0', Mother
. The user list and the relations list in this regard line up precisely.
So far what I've come up with is constructing some kind of loop where I check if the relations[i][0]
position is == '0'
but I'm not sure how to stop appending Alice when 0 comes up again and have it continue at that point iterating for user Bob, then Gary, and so on.
The unpredictability is that there is no maximum ID value or expected range, users have random numbers of relations.
...ANSWER
Answered 2021-Dec-09 at 15:59seems like a better structure would be a dict
, so you would have just one entry for each user:
QUESTION
I have a list of dictionaries like so
...ANSWER
Answered 2021-Mar-19 at 12:13I found a solution to my problem. I did it like so
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install trudy
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
Clone the repo on the virtual machine and build the Trudy binary. git clone https://github.com/kelbyludwig/trudy.git cd trudy go install
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
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).
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.
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.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page