Thanks to visit codestin.com
Credit goes to github.com

Skip to content

runetfreedom/force-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Force-Proxy

This is a DLL that hooks a few Winsock 2 APIs to redirect TCP and UDP sockets to a SOCKS5 proxy.

Both blocking and non-blocking sockets are supported.

SOCKS5 login/password authentication are supported.

Motivation

Sometimes there is a need to redirect traffic of some application to SOCKS5 proxy, which does not have such functionality.

This is an attempt to provide a free and fully open source alternative to commercial solutions for process proxification.

How it works

Once injected into the target process, this DLL hooks several Winsock 2 APIs using Microsoft Detours.

For TCP, just change the connection target to a proxy server and send a socks5 CONNECT request.

For UDP, socks5 UDP ASSOCIATE is requested during bind. All UDP packets are then encapsulated and sent to the associated port of the proxy server. For incoming packets, the correct sender is restored from the header and the packet is decapsulated.

Here is the list of Winsock 2 APIs that are hooked:

  1. connect - for TCP redirection
  2. bind - good time to request UDP ASSOCIATE
  3. sendto and WSASendTo - to encapsulate a UDP packet and redirect it to a proxy
  4. recvfrom and WSARecvFrom - to decapsulate a UDP packet and restore the sender field
  5. ioctlsocket and WSAEventSelect - to determine that socket is set to non-blocking mode
  6. closesocket - to cleanup

Limitations

Currently only IPv4 support is implemented.

Real usage examples

@runetfreedom/discord-voice-proxy - project that uses DLL Hijacking to load this DLL into Discord processes to redirect all traffic (including WebRTC) to the proxy.

Be careful

Do not try to inject this DLL into games protected by anti-cheat!

From an anti-cheat point of view, injecting an unsigned DLL and hooking system calls looks like typical cheat behavior, so you will most likely be banned.

Getting started

Just find any of the thousands of DLL injectors and inject that DLL into the target process.

You can pass parameters using environment variables:

  1. SOCKS5_PROXY_ADDRESS - proxy ip address
  2. SOCKS5_PROXY_PORT - proxy port
  3. SOCKS5_PROXY_TIMEOUT - proxy connection timeout (optional)
  4. SOCKS5_PROXY_LOGIN - proxy login (optional)
  5. SOCKS5_PROXY_PASSWORD - proxy password (optional)

About

A DLL that forwards TCP and UDP packets of any application to a SOCKS5 proxy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •