Comments (6)
oh, i finally get what this is really about:
basically we have a number of different processes that all use the same proxychains config, and when launching those in the same second they're all seeded with the same value and return same rand() result and therefore select the same proxy from the list. i guess we can fix that by using clock_gettime() to initialize srand(). i'll look into writing a fix tomorrow.
from doxycannon.
@rofl0r thanks for the heads up. def fooled me.
unsure about the ng fork. i won't be able to check for a while, but I'll ping you again when life circumstances allow.
from doxycannon.
i suspect it will work as expected, because the original proxychains 3.1 code used a bogus method to get a random number, which we fixed. it should not be needed to reseed the rng all the time, a single srand() on startup should be sufficient.
from doxycannon.
hey @rofl0r
Sorry it took me so long to look at this. I built from today's master of your fork.
I used the following proxychain4.conf and seemed to be getting similar behavior to what I describe in the readme.
random_chain
quiet_mode
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 127.0.0.1 9000
socks5 127.0.0.1 9001
socks5 127.0.0.1 9002
socks5 127.0.0.1 9003
socks5 127.0.0.1 9004
socks5 127.0.0.1 9005
socks5 127.0.0.1 9006
socks5 127.0.0.1 9007
socks5 127.0.0.1 9008
socks5 127.0.0.1 9009
Inserting a sleep ensures a more random distribution between proxies:
$ while :; do curl ifconfig.io; sleep 1.1 ; done
185.112.146.85
185.220.100.254
104.244.75.80
185.220.100.254
198.144.120.234
107.189.10.119
$ while :; do curl ifconfig.io; done
185.191.124.151
185.191.124.151
185.220.100.254
185.220.100.254
185.220.100.254
185.112.146.85
185.112.146.85
107.189.10.119
from doxycannon.
This was the original patch on the haad fork
From bd207014a20b41554207fc9ac9457e61ab570429 Mon Sep 17 00:00:00 2001
From: Alex Flores <[email protected]>
Date: Fri, 30 Mar 2018 14:14:18 -0400
Subject: [PATCH] patch for better random proxy selection
---
src/core.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/core.c b/src/core.c
index c3a624d..b0e3f21 100644
--- a/src/core.c
+++ b/src/core.c
@@ -514,6 +514,19 @@ static int start_chain(int *fd, proxy_data * pd, char *begin_mark) {
return SOCKET_ERROR;
}
+unsigned int get_rand_int(unsigned int range){
+ static FILE *fp;
+ unsigned int randval;
+ if (!fp) {
+ fp = fopen("/dev/urandom", "r");
+ }
+ if(fread(&randval, sizeof(randval), 1, fp)) {
+ return (randval % range);
+ } else {
+ srand((unsigned int)time(NULL));
+ return (rand() % range);
+ }
+}
static proxy_data *select_proxy(select_type how, proxy_data * pd, unsigned int proxy_count, unsigned int *offset) {
unsigned int i = 0, k = 0;
@@ -522,10 +535,10 @@ static proxy_data *select_proxy(select_type how, proxy_data * pd, unsigned int p
return NULL;
switch (how) {
case RANDOMLY:
- srand((unsigned int)time(NULL));
+
do {
k++;
- i = 0 + (unsigned int) (proxy_count * 1.0 * rand() / (RAND_MAX + 1.0));
+ i = 0 + get_rand_int(proxy_count);
} while(pd[i].ps != PLAY_STATE && k < proxy_count * 100);
break;
case FIFOLY:
from doxycannon.
With my shitty C code (same from above) applied to your fork, I'm getting a more random distribution.
$ while :; do curl ifconfig.io; done
51.15.250.93
185.220.101.17
94.230.208.147
185.220.101.17
87.118.110.27
94.230.208.147
185.220.101.17
185.220.101.194
185.220.100.254
51.15.250.93
185.220.101.205
87.118.110.27
54.38.22.61
^C
from doxycannon.
Related Issues (18)
- add pre-reqs and docker installation docs HOT 2
- being able to start multiple single instances HOT 1
- Wiki Addition - ProtonVPN HOT 2
- Unable to resolve DNS names HOT 1
- Warn if Docker service is not started HOT 1
- [provider] - HideMyAss issues HOT 1
- Warn if Doxycannon (containers) are already running HOT 2
- Multiple VPN folders HOT 2
- **Automation** HOT 1
- Problem while building containers - doxycannon --build HOT 2
- dante won't start. How to troubleshoot? HOT 3
- A help wanted HOT 1
- NordVpn HOT 2
- access from outside localhost HOT 2
- Connection - "First Hop over Tor" HOT 8
- temp
- Add the option of setting only Tor exit nodes (no VPNs) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doxycannon.