-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add proxychains-cli to help using inline config #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 3d5acf9.
README-CLI.md
Outdated
| proxychains-cli -P "socks5 127.0.0.1 1080" curl example.com | ||
| ``` | ||
|
|
||
| **Config passed to proxychains4 (fd 3):** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which fd it's using is irrelevant to a user, it's an implementation detail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to update this README, when using fd, I can not pass content to child process in this case:
1. main.c exec node (nodejs) with PROXYCHAINS_CONFIG_FD=3
↓
2. dyld loads libproxychains4.dylib (DYLD_INSERT_LIBRARIES)
↓
3. gcc_init() constructor run BEFORE main()
↓
4. do_init() → get_chain_data() → setenv("PROXYCHAINS_CONFIG_FD", "5", 1) (nodejs used fd 3, 4 => we use 5)
↓
5. [proxychains] DLL init: proxychains-ng... ← log printed
↓
6. node main() started
↓
7. Debugger listening... ← node start debugger
↓
8. [proxychains] failed to read... ← debugger subprocess still see PROXYCHAINS_CONFIG_FD is 3
it happened because
┌─────────────────────────────────────────────────────────────┐
│ Library loading (before main) │
├─────────────────────────────────────────────────────────────┤
│ 1. libc.dylib loads │
│ 2. libnode.dylib loads ──► Node's C++ static init │
│ └── NodeJS snapshot environment HERE! │
│ 3. libproxychains4.dylib loads │
│ └── run, clone fd, write new value to env but late │
└─────────────────────────────────────────────────────────────┘
↓
main() starts
ofcourse I can use a larger fd() but not sure that program dont use that fd
=> I decided to use env PROXYCHAINS_CONFIG_DATA_ENV_VAR to handle config data
will update README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean the issue is the quiet mode ? just pass the right env var just like main.c does then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not related to quiet mode.
proxychains4 uses env var to pass data to libproxychains, which is injected and runs before the program's main().
Everything works when the program doesn't spawn child processes, example: I'm using fd3 with PROXYCHAINS_DATA_FD=3.
But when the main program creates child processes, it may forward fd3/fd4 to them. In that case, I must switch libproxychains to use fd5 to avoid conflict with the child process behavior, and update the env to PROXYCHAINS_DATA_FD=5.
The issue when use proxychains to run Node.js (node) in debug mode:
node takes a snapshot of all env at startup and uses that snapshot for all child processes. As a result, child processes still receive PROXYCHAINS_DATA_FD=3 instead of 5, causing parsing errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see. will think about the best solution for that.
README-CLI.md
Outdated
| ### Example 1: Basic SOCKS5 proxy | ||
|
|
||
| ```bash | ||
| proxychains-cli -P "socks5 127.0.0.1 1080" curl example.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo we should only advertise protocol://[user:pass@]ip:port syntax in the cli tool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok lets implement this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented in proxychains4-cli, take a look
https://github.com/rofl0r/proxychains-ng/pull/610/files#diff-69fcc264dd1c66e96beb0fc7c26abb4947649d95ad777a2301adb8dd532f4577R72-R128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rofl0r should cli resolve hostname if URL using hostname:port instead of ip:port?
|
ok, as usual all your AI generated content again makes this a huge PR, which takes every reload take half a minute. for now, exclude all your README and zsh etc additions until we got the proxychains4-cli, Makefile, and libproxychains.c right so i dont have to waste my time with secondary stuff until the primary stuff is right. |
- remove zsh completions - remove test - remove README-CLI.md - minimal changes to Makefile - rename cli to proxychains4-cli
proxychains4that will be used to get content and parse before using file parsing (default behavior)proxychains-clithat take and parse inline config to fd(3) then pipe toproxychains4/tests/cli/test-cli.shuninstallto Makefile_proxychains-clitocomplications/zshOptions
-h, --help-v, --version-c, --chain MODE-l, --chain-len N-q, --quiet-d, --dns MODE-S, --dns-subnet N-R, --read-timeout MS-T, --connect-timeout MS-n, --localnet CIDR--dnat "SRC DST"-P, --proxy "IP PORT [ USER PASS ]"--config--proxychains-path PATH