91 Commits

Author SHA1 Message Date
Adam Hamsik 2ec9e1d7ca Install proxyresolv and proxychains script along with proxychains library and proxychains4 binary. 2024-01-02 12:23:22 +01:00
Adam Hamsik b42945b771 Add labels to keep issues/pr from stale 2024-01-02 10:13:18 +01:00
Adam Hamsik 80dc652d55 Some fixes 2023-12-29 02:10:25 +01:00
Adam Hamsik bc653b680b change linux ping args 2023-12-29 01:38:31 +01:00
Adam Hamsik 5cd04b70ca Fix issue with libproxychains library naming on mac os. 2023-12-29 01:35:27 +01:00
Adam Hamsik 87733ca08a Fix config 2023-12-29 01:08:17 +01:00
Adam Hamsik e04cdc351f Add some tests 2023-12-29 01:05:13 +01:00
Adam Hamsik 564bb6ac03 Remove travis ci, update readme badge 2023-12-29 00:31:28 +01:00
Adam Hamsik c7181350f5 add macos-latest build 2023-12-29 00:20:47 +01:00
Adam Hamsik 4993ada3e5 Add mac os build 2023-12-29 00:01:59 +01:00
Adam Hamsik 357e4235ed Add version flag. 2023-12-28 23:57:40 +01:00
Adam Hamsik ccd3c34662 Update issue templates 2023-12-28 20:22:51 +01:00
Adam Hamsik 8d666c81b0 Create stale.yml 2023-12-28 19:46:45 +01:00
Adam Hamsik 1103af27b0 Update github build-ci workflow, add support for multiple macos archs[done by @thehappydinoa] 2023-12-28 19:39:55 +01:00
Adam Hamsik 59326e6bc3 Create super-linter.yml 2023-12-28 19:37:55 +01:00
Adam Hamsik 912c63136b Create buildci.yml 2023-12-28 19:37:23 +01:00
Adam Hamsik 96c9f917c0 Print version string if not arguments are given. 2023-12-28 19:21:50 +01:00
Adam Hamsik 0362e8a560 Merge pull request #132 from BlueSkyDetector/pr-update_readme_about_socks5_vars
Update README.adoc about socks5 environment variable
2023-12-28 19:07:01 +01:00
Adam Hamsik e3e27132b4 Merge pull request #150 from Freed-Wu/master
Add zsh completion script
2023-12-28 19:04:37 +01:00
Wu Zhenyu 02409fba79 Add zsh completion script
Refer <https://www.gnu.org/software/automake/manual/automake.html#Third_002dParty-Makefiles>, use install-exec
2023-04-05 18:30:55 +08:00
Takanori Suzuki a6d99f7dbe Update README.adoc about socks5 environment variable 2022-05-06 07:43:40 +09:00
Adam Hamsik 1f04b93d35 Merge pull request #129 from sosamuel/patch-1
Update README.adoc
2022-03-26 12:00:31 +01:00
Adam Hamsik 5597c2a5a2 Merge pull request #115 from 7c6f434c/patch-1
Reinitialise i before using it for iterating over dll_dirs
2022-03-26 12:00:18 +01:00
Adam Hamsik 0ef3d6d5c8 Merge pull request #112 from sorki/fixWarnings
fix GCC strncpy warnings
2022-03-26 11:58:34 +01:00
Adam Hamsik 8aa0ed2549 Merge pull request #121 from specialpointcentral/master
Fix GCC errors in DEBUG mode
2022-03-26 11:57:59 +01:00
Samuel Chia a00e7386f6 Update README.adoc
update pkgsrc-wip  homepage link.
2022-03-25 16:28:07 +08:00
Jack Hu d99c64bb78 Fix GCC errors in DEBUG mode
When we open debug mode(`./configure --devel`),
GCC will check `sign-conversion` and `conversion`.
It will cause some warnings.

Also add `-DDEBUG` to `CFLAGS` if we open debug
mode. This can open `PDEBUG()` and help you to get
detail information.

Signed-off-by: Jack Hu <spcreply@126.com>
2021-09-05 17:13:12 +08:00
Michael Raskin 3b1aac2084 Reinitialise i before using it for iterating over dll_dirs
Previously, the value of it was kept from the loop over all the command-line arguments; as `/usr/lib` or `/lib` were far enough in the list, on many systems there was no difference, but `own_dir` and `LIB_DIR` could be ignored or not based on the argument count, which was confusing.
2021-03-31 07:46:58 +00:00
Richard Marko 412ef4235b fix GCC strncpy warnings
Recent GCC added checks for this and it triggers `Werror` with

```
In function 'strncpy',
    inlined from 'proxy_gethostbyname' at src/core.c:832:2:
/nix/store/hayaj8q9rc7swx4llcjqymmg3zr525lx-glibc-2.32-25-dev/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound 8192 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Werror=stringop-truncation8;;]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'proxy_getaddrinfo' at src/core.c:917:3:
/nix/store/hayaj8q9rc7swx4llcjqymmg3zr525lx-glibc-2.32-25-dev/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Werror=stringop-truncation8;;]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
2021-02-13 11:14:08 +01:00
Adam Hamsik 148b851d10 Update mac os build. 2021-02-08 11:36:04 +01:00
Adam Hamsik ea89ca551a Merge pull request #109 from aviau/patch-1
proxychains.conf: mention `raw` type
2020-12-11 15:41:37 +01:00
Alexandre Viau d27fcbff9b proxychains.conf: mention raw type 2020-12-10 11:42:49 -05:00
Adam Hamsik 4c31f32dc9 Update version string 2020-12-10 14:05:01 +01:00
Adam Hamsik 5320c1bc22 Bump version string to 4.3.0 2020-12-10 14:04:16 +01:00
Adam Hamsik 2d2ba1c921 Merge pull request #108 from aviau/aviau/raw-proxy
support 'raw' proxy type
2020-12-10 14:02:52 +01:00
Adam Hamsik ed75dfa6e2 Merge pull request #104 from ChuanfengZhang/master
docs: fix link of pkgsrc
2020-12-10 14:00:53 +01:00
aviau 7b24b954c8 support 'raw' proxy type 2020-10-27 15:23:40 -04:00
zhangcf e8247feeda docs: fix link of pkgsrc 2020-09-14 15:30:42 +08:00
Adam Hamsik 99af45703e Update libproxychains.c
Fix redundant parenthesis.
2020-07-28 16:15:00 +02:00
Adam Hamsik 5dd8450452 Merge pull request #99 from tomgilon/dnat
Add dnat feature
2020-07-21 22:41:19 +02:00
Adam Hamsik 8dea4f9297 Merge pull request #98 from AdamVanScyoc/fix_conf_file_typo
Fix type on proxychains.conf fix_conf_file_type
2020-07-21 22:39:39 +02:00
Adam Hamsik 48c7a005e6 Merge pull request #100 from 0xflotus/patch-1
(docs): fixed possible typo error
2020-07-21 22:38:47 +02:00
0xflotus 7efa291d90 (docs): fixed possible typo error
in www.insecure.org/nmap
2020-05-24 14:22:02 +02:00
tom gilon d7096b4f98 Add option to change tcp destination port and ip before sending to proxy server 2020-05-07 00:10:59 +03:00
Adam Van Scyoc 6d1e0e8af6 Fix type on proxychains.conf fix_conf_file_type 2020-04-14 22:28:44 -04:00
Adam Hamsik e7a2b9d79a Merge pull request #88 from Mister-Meeseeks/master
Allow user to override default DNS server
2020-01-10 13:39:06 +01:00
Adam Hamsik f1ffbd4b94 Merge pull request #75 from tinyzimmer/master
optional set host on easy socks5 env var
2020-01-10 13:38:20 +01:00
Adam Hamsik 87ec01c762 Merge pull request #95 from theosotr/fix
Add missing Make dependencies
2020-01-10 13:36:38 +01:00
Thodoris Sotiropoulos 8df5b3f11d Add missing Make dependencies 2020-01-02 21:52:50 +02:00
Douglas R Colkitt 0416c2b7ea Fix issue with POSIX portability in proxyresolv script 2019-04-13 15:48:24 +00:00
Douglas R Colkitt 98e9326534 Allow user to override default DNS server
Implements support for an environmnet variable (PROXY_DNS_SERVER) whereby
the user can specify a DNS server. If not set defaults to the hardcoded
OpenDNS default.
2019-04-13 15:41:07 +00:00
Adam Hamsik 14e15aa2c1 Merge pull request #85 from Intika-Linux-Network/master
Fix security issue CVE-2015-3887
2019-01-22 18:45:29 +01:00
intika 9f99278525 Fix security issue CVE-2015-3887 2019-01-22 13:25:35 +00:00
tinyzimmer f3b07370fb require cdefs 2018-04-22 21:42:33 -07:00
tinyzimmer dbe328efdd dont require cdefs 2018-04-22 21:36:52 -07:00
tinyzimmer f88610077c allow dynamic host for simple socks env var 2018-04-22 20:40:26 -07:00
Alex Flores fbfdd995db Merge pull request #73 from audibleblink/master
patch for random proxy selection
2018-04-12 21:55:02 -04:00
Alex Flores bd207014a2 patch for better random proxy selection 2018-04-12 21:35:23 -04:00
Adam Hamsik 2bdf74d5a6 Merge pull request #66 from julian-klode/pu/fix-pbuf-null
Fix compilation error in get_config_path()
2018-04-04 12:36:16 +02:00
Julian Andres Klode e8e0b93b37 Fix compilation error in get_config_path()
When inlining check_path(), gcc sees after the first snprintf()
call that pbuf might be null, and subsequently generates a warning
for the next snprintf() call. Since the code (erroneously) builds
with -Werror, this causes it to fail.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83139
2017-11-24 11:10:28 +01:00
Adam Hamsik c38374ab5b Merge pull request #59 from leggiero/patch-1
Minor typo
2017-09-03 12:40:06 +02:00
Eduardo Leggiero 67aa8eae24 Minor typo 2017-07-25 13:47:39 +01:00
Adam Hamsik 0f61bd0713 Remove superfluos ] 2016-02-14 21:58:19 +01:00
Adam Hamsik 581f0ff31a Some updates 2016-02-14 21:57:34 +01:00
Adam Hamsik 7d160b9015 Rewrite README as proper asciidoc 2016-02-14 21:55:59 +01:00
Adam Hamsik 138481b410 Test build on osx too 2016-02-14 21:09:33 +01:00
Adam Hamsik bf833e216b Add travis.yml 2016-02-14 21:06:34 +01:00
Adam Hamsik 60bcee08c9 Merge branch 'hutchinson-linux_fix'
* hutchinson-linux_fix:
  Fix Linux compile issue
2016-02-14 21:00:47 +01:00
Adam Hamsik 8623b26a72 Merge branch 'linux_fix' of https://github.com/hutchinson/proxychains into hutchinson-linux_fix
* 'linux_fix' of https://github.com/hutchinson/proxychains:
  Fix Linux compile issue
2016-02-14 21:00:35 +01:00
Adam Hamsik 3b52a10c54 Merge pull request #37 from douglasanpa/master
Fix to compile on Ubuntu 13:04
2015-12-29 13:32:12 +01:00
Adam Hamsik ec404a9e61 Merge pull request #45 from netroby/feature/drill-opendns
Using OpenDNS and Drill (ldns-utils)
2014-12-08 15:41:49 +01:00
ZhiFeng Hu fdbce6cf24 Using OpenDNS and Drill (ldns-utils) 2014-11-28 13:45:02 +08:00
Adam Hamsik 0c39bb25a6 Merge pull request #44 from hmgle/fix_usage
fix #43
2014-06-30 16:13:36 +02:00
mingang.he a1ff3e0426 fix #43
"-t" should be "-f"
2014-06-30 20:18:14 +08:00
Dan Hutchinson 86dfc828f1 Fix Linux compile issue 2014-04-21 20:42:14 +01:00
douglasanpa 33805b3375 Fix to compile on Ubuntu 13:04
With this modification the proxychains compiles successfully on Ubuntu 13:04
2013-04-17 04:09:02 -03:00
Adam Hamsik dcbafb0279 Make linux and mac options similar. 2012-10-15 14:16:38 +02:00
Adam Hamsik 93bbad6ccb Use same LD parameters where is it possible. 2012-10-15 11:41:33 +02:00
Adam Hamsik f52a3001e1 Merge tomsawyer changes while, Makefile changes were fixed in my previous commit.
Merge branch 'main_fixes' of git://github.com/tomsawyer/proxychains into tomsawyer-main_fixes

Conflicts:
	Makefile
2012-10-15 11:27:51 +02:00
Adam Hamsik 92ab117a9e Merge branch 'master' of github.com:haad/proxychains 2012-10-15 11:05:17 +02:00
Adam Hamsik fb30a834a7 Add OS specific LD, C flags this enables use to use -pthread and -lpthread for different platforms. 2012-10-15 11:03:59 +02:00
Adam Hamsik caa76df519 Merge pull request #30 from benizi/add-socks5-mode
Add simple SOCKS5 mode
2012-10-15 01:02:17 -07:00
Benjamin R. Haskell 2ac7066abd Add README changes for simple SOCKS5 mode 2012-10-12 15:39:13 -04:00
Benjamin R. Haskell d3516a1c28 Add simple SOCKS5 proxy mode
If the environment variable PROXYCHAINS_SOCKS5 is set to a port number,
the configuration will be a single chain with a SOCKS5 proxy on
localhost:{that port}.

Additionally, setting the PROXYCHAINS_DNS environment variable (to any
value at all) will cause DNS queries to be proxied.
2012-10-12 15:39:03 -04:00
Semion Laptev 7aa95f9304 gethostbyname() and Makefile fixes 2012-10-10 19:19:12 +04:00
Adam Hamsik c4decf6da2 Mention homebrew formula in README. 2012-10-10 13:26:57 +02:00
Adam Hamsik 2eb641758b Fix library settings. 2012-10-10 03:27:57 -07:00
Adam Hamsik 4678bae604 Fix wrong glibc prototype. 2012-10-10 03:27:25 -07:00
Adam Hamsik 6fe50f2b29 Merge pull request #25 from xiezhenye/patch-1
Update src/proxyresolv
2012-09-22 07:23:22 -07:00
Xie Zhenye d69f46afc5 Update src/proxyresolv
resolve hostname by local /etc/hosts file first
2012-09-22 22:17:53 +08:00
Adam Hamsik f9a2ac0456 Add more documentation updates about BSD support and using pkgsrc to install proxychains. 2012-08-10 02:19:54 +02:00
25 changed files with 652 additions and 170 deletions
+24
View File
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run command
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+55
View File
@@ -0,0 +1,55 @@
name: Makefile CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-linux-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: ./configure
- name: Build Proxychains
run: make
- name: Run Proxychains
run: ./proxychains4 -v
- name: Run tests
run: ./src/proxychains -f dist/proxychains.conf on
# - name: Run tests
# run: ./src/proxychains -f dist/proxychains.conf curl -o /dev/null -v https://sme.sk
# - name: Run tests
# run: ./src/proxychains -f dist/proxychains.conf ping -c 1 sme.sk
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: ./configure
- name: Build Proxychains
run: make
- name: Run Proxychains
run: ./proxychains4 -v
- name: Run tests
run: ./src/proxychains -f dist/proxychains.conf on
# - name: Run tests
# run: ./src/proxychains -f dist/proxychains.conf curl -o /dev/null -v https://sme.sk
# - name: Run tests
# run: ./src/proxychains -f dist/proxychains.conf ping -t 1 sme.sk
+31
View File
@@ -0,0 +1,31 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
- cron: '24 3 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-stale: 90
days-before-close: 120
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
stale-pr-message: 'Stale pull request message'
stale-issue-label: 'no-issue-activity'
exempt-issue-labels: 'docu,roadmap,bug,possible-feature'
stale-pr-label: 'no-pr-activity'
exempt-pr-labels: 'feature'
+29
View File
@@ -0,0 +1,29 @@
# This workflow executes several linters on changed files based on languages used in your code base whenever
# you push a code or open a pull request.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/github/super-linter
name: Lint Code Base
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: "master"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -1
View File
@@ -5,7 +5,7 @@
.deps/
.libs/
.*
src/*.d
# Autoconf stuff
libtool
config.*
+2 -2
View File
@@ -7,8 +7,8 @@ main.c, remote-dns, thread safety, bugfixes, build system, cleanups
rofl0r.
https://github.com/rofl0r/proxychains
localnet, bugfixes, macos x support
adam hamsik.
localnet, bugfixes, macos x support, bsd support, packaging
haad.
https://github.com/haad/proxychains
localnet-port, bugfixes
+6
View File
@@ -1,6 +1,12 @@
ProxyChains version history (public releases)
====================
ver 4.2
* Introduce BSD support make proxychains available on (NetBSD, FreeBSD ,OpenBSD and DragonFlyBSD)
* Update pkgsrc-wip proxychains package to 4.2.0 release and make easy to install and use
proxychains
-------------------------------------------------------------------------
ver 4.1
* Mac OS X support, create install script.
* thread-safe fixes by @rofl0r
+33 -13
View File
@@ -9,55 +9,73 @@ prefix = /usr/local
includedir = $(prefix)/include
libdir = $(prefix)/lib
confdir = $(prefix)/etc
datadir = $(prefix)/share
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
zshcompdir = $(datadir)/zsh/site-functions
SRCS = $(sort $(wildcard src/*.c))
OBJS = $(SRCS:.c=.o)
LOBJS = src/core.o src/common.o src/libproxychains.o
DEPS = $(OBJS:.o=.d)
CCFLAGS = -Wall -O2 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE -Werror
LDFLAGS = -shared -fPIC -lpthread
INC =
CCFLAGS = -MD -Wall -O2 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE -Werror
LDFLAGS = -shared -fPIC
INC =
PIC = -fPIC
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
LDSO_SUFFIX = so
LD_SET_SONAME = -Wl,-soname=
LD_SET_SONAME = -Wl
INSTALL_FLAGS = -D -m
-include config.mak
LDSO_PATHNAME = libproxychains4.$(LDSO_SUFFIX)
SHARED_LIBS = $(LDSO_PATHNAME)
ALL_LIBS = $(SHARED_LIBS)
PXCHAINS = proxychains4
ALL_TOOLS = $(PXCHAINS)
CCFLAGS+=$(USER_CFLAGS) $(MAC_CFLAGS)
LDFLAGS+=$(USER_LDFLAGS) $(MAC_LDFLAGS)
CXXFLAGS+=$(CCFLAGS) $(USER_CFLAGS) $(MAC_CFLAGS)
CCFLAGS+=$(USER_CFLAGS) $(OS_CFLAGS)
LDFLAGS+=$(USER_LDFLAGS) $(OS_LDFLAGS)
CXXFLAGS+=$(CCFLAGS) $(USER_CFLAGS) $(OS_CFLAGS)
CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\" -DINSTALL_PREFIX=\"$(prefix)\" -DDLL_NAME=\"$(LDSO_PATHNAME)\" -DSYSCONFDIR=\"$(confdir)\"
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LDSO_PATHNAME = libproxychains.$(LDSO_SUFFIX)
LDSO_SUFFIX = so.4
endif
ifeq ($(UNAME_S),Darwin)
LDSO_PATHNAME = libproxychains4.$(LDSO_SUFFIX)
LDSO_SUFFIX = dylib
endif
all: $(ALL_LIBS) $(ALL_TOOLS)
#install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(DESTDIR)$(LDSO_PATHNAME)
install:
install: install-exec install-config install-zsh-completion
install-exec:
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(confdir) $(DESTDIR)/$(includedir)
install $(INSTALL_FLAGS) 755 $(ALL_TOOLS) $(DESTDIR)/$(bindir)/
install $(INSTALL_FLAGS) 755 $(ALL_TOOLS) src/proxychains src/proxyresolv $(DESTDIR)/$(bindir)/
install $(INSTALL_FLAGS) 644 $(ALL_LIBS) $(DESTDIR)/$(libdir)/
install-config:
install -d $(DESTDIR)/$(confdir)
install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)/$(confdir)/
install-zsh-completion:
install -d $(DESTDIR)/$(zshcompdir)
install $(INSTALL_FLAGS) 644 completions/zsh/_proxychains4 -t $(DESTDIR)/$(zshcompdir)
clean:
rm -f $(ALL_LIBS)
rm -f $(ALL_TOOLS)
rm -f $(OBJS)
rm -f $(DEPS)
%.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $<
@@ -68,4 +86,6 @@ $(LDSO_PATHNAME): $(LOBJS)
$(ALL_TOOLS): $(OBJS)
$(CC) src/main.o src/common.o -o $(PXCHAINS)
.PHONY: all clean install install-config
.PHONY: all clean install install-exec install-config install-zsh-completion
-include $(DEPS)
-115
View File
@@ -1,115 +0,0 @@
ProxyChains ver 4.0 README
==========================
ProxyChains is a UNIX program, that hooks network-related libc functions
in dynamically linked programs via a preloaded DLL and redirects the
connections through SOCKS4a/5 or HTTP proxies.
*********** ATTENTION ***********
this program works only on dynamically linked programs.
also both proxychains and the program to call must use
the same dynamic linker (i.e. same libc)
*********************************
*** Known limitations of the current version: ***
when a process forks, does a DNS lookup in the child, and then uses
the ip in the parent, the corresponding ip mapping will not be found.
this is because the fork can't write back into the parents mapping table.
IRSSI shows this behaviour, so you have to pass the resolved ip address
to it. (you can use the proxyresolv script (requires "dig") to do so)
this means that you can't currently use tor onion urls for irssi.
to solve this issue, an external data store (file, pipe, ...) has to
manage the dns <-> ip mapping. of course there has to be proper locking.
shm_open, mkstemp, are possible candidates for a file based approach,
the other option is to spawn some kind of server process that manages the
map lookups. since connect() etc are hooked, this must not be a TCP server.
I am reluctant on doing this change, because the described behaviour
seems pretty idiotic (doing a fork only for a DNS lookup), and irssi
is currently the only known affected program.
*** Installation ***
# needs a working C compiler, preferably gcc
./configure
make
sudo make install
Changelog:
----------
Version (4.x) removes the dnsresolver script which required a dynamically
linked "dig" binary to be present with remote DNS lookup.
this speeds up any operation involving DNS, as the old script had to use TCP.
additionally it allows to use .onion urls when used with TOR.
also it removed the broken autoconf build system with a simple Makefile.
there's a ./configure script though for convenience.
it also adds support for a config file passed via command line switches/
environment variables.
Version (3.x) introduces support for DNS resolving through proxy
it supports SOCKS4, SOCKS5 and HTTP CONNECT proxy servers.
Auth-types: socks - "user/pass" , http - "basic".
When to use it ?
1) When the only way to get "outside" from your LAN is through proxy server.
2) To get out from behind restrictive firewall which filters outgoing ports.
3) To use two (or more) proxies in chain:
like: your_host <--> proxy1 <--> proxy2 <--> target_host
4) To "proxify" some program with no proxy support built-in (like telnet)
5) Access intranet from outside via proxy.
5) To use DNS behind proxy.
Some cool features:
* This program can mix different proxy types in the same chain
like: your_host <-->socks5 <--> http <--> socks4 <--> target_host
* Different chaining options supported
random order from the list ( user defined length of chain ).
exact order (as they appear in the list )
dynamic order (smart exclude dead proxies from chain)
* You can use it with any TCP client application, even network scanners
yes, yes - you can make portscan via proxy (or chained proxies)
for example with Nmap scanner by fyodor (www.insecire.org/nmap).
proxychains nmap -sT -PO -p 80 -iR (find some webservers through proxy)
* You can use it with servers, like squid, sendmail, or whatever.
* DNS resolving through proxy.
Configuration:
--------------
proxychains looks for config file in following order:
1) file listed in environment variable ${PROXYCHAINS_CONF_FILE} or
provided as a -f argument to proxychains script or binary.
2) ./proxychains.conf
3) $(HOME)/.proxychains/proxychains.conf
4) /etc/proxychains.conf **
**see more in /etc/proxychains.conf
Usage Example:
$ proxychains telnet targethost.com
in this example it will run telnet through proxy(or chained proxies)
specified by proxychains.conf
Usage Example:
$ proxychains -f /etc/proxychains-other.conf targethost2.com
in this example it will use different configuration file then proxychains.conf
to connect to targethost2.com host.
Usage Example:
$ proxyresolv targethost.com
in this example it will resolve targethost.com through proxy(or chained proxies)
specified by proxychains.conf
+179
View File
@@ -0,0 +1,179 @@
# ProxyChains ver. 4.3.0 README
![build-badge](https://github.com/haad/proxychains/actions/workflows/buildci.yml/badge.svg)
ProxyChains is a UNIX program, that hooks network-related libc functions
in dynamically linked programs via a preloaded DLL and redirects the
connections through SOCKS4a/5 or HTTP proxies.
WARNING: this program works only on dynamically linked programs.
also both proxychains and the program to call must use
the same dynamic linker (i.e. same libc)
## Known limitations of the current version
when a process forks, does a DNS lookup in the child, and then uses
the ip in the parent, the corresponding ip mapping will not be found,
this is because the fork can't write back into the parents mapping table.
IRSSI shows this behavior, so you have to pass the resolved ip address
to it. (you can use the proxyresolv script (requires "dig") to do so)
this means that you can't currently use tor onion urls for irssi.
to solve this issue, an external data store (file, pipe, ...) has to
manage the dns <-> ip mapping. of course there has to be proper locking.
shm_open, mkstemp, are possible candidates for a file based approach,
the other option is to spawn some kind of server process that manages the
map lookups. since connect() etc are hooked, this must not be a TCP server.
I am reluctant on doing this change, because the described behavior
seems pretty idiotic (doing a fork only for a DNS lookup), and irssi
is currently the only known affected program.
## Installation
### Using release version
*Proxychains-4.3.0* are available with pkgsrc to everyone using it on _Linux_,
_NetBSD_, _FreeBSD_, _OpenBSD_, _DragonFlyBSD_ or _Mac OS X_. You just need to install
pkgsrc-wip repository and run
make install
in a wip/proxychains directory.
You can find out more about pkgsrc on link:http://www.pkgsrc.org[pkgsrc] and about pkgsrc-wip on
link:https://pkgsrc.org/wip[Pkgsrc-wip homepage]
### Installing on Mac OS X with homebrew
You can install current proxychains on Mac OS X with an homebrew. You have to
download unofficial link:https://gist.github.com/3792521[homebrew formula] from
to your BREW_HOME by default /usr/local/Library/Formula/ and run
```
$ brew install proxychains
```
### Running Current Source code version
```
# needs a working C compiler, preferably gcc
./configure
make
sudo make install
```
## Changelog
*Version (4.x)* removes the dnsresolver script which required a dynamically
linked "dig" binary to be present with remote DNS lookup.
this speeds up any operation involving DNS, as the old script had to use TCP.
additionally it allows to use .onion urls when used with TOR.
also it removed the broken autoconf build system with a simple Makefile.
there's a ./configure script though for convenience.
it also adds support for a config file passed via command line switches/
environment variables.
*Version (3.x)* introduces support for DNS resolving through proxy
it supports SOCKS4, SOCKS5 and HTTP CONNECT proxy servers.
* Auth-types
** socks - "user/pass",
** http - "basic"
## When to use it
* When the only way to get "outside" from your LAN is through proxy server.
* To get out from behind restrictive firewall which filters outgoing ports.
* To use two (or more) proxies in chain:
```
like: your_host <--> proxy1 <--> proxy2 <--> target_host
```
* To "proxify" some program with no proxy support built-in (like telnet)
* Access intranet from outside via proxy.
* To use DNS behind proxy.
### Some cool features
* This program can mix different proxy types in the same chain
```
like: your_host <-->socks5 <--> http <--> socks4 <--> target_host
```
* Different chaining options supported
random order from the list ( user defined length of chain ).
exact order (as they appear in the list )
dynamic order (smart exclude dead proxies from chain)
* You can use it with any TCP client application, even network scanners
yes, yes - you can make portscan via proxy (or chained proxies)
for example with Nmap scanner by fyodor (www.insecure.org/nmap).
```
proxychains nmap -sT -PO -p 80 -iR (find some webservers through proxy)
```
* You can use it with servers, like squid, sendmail, or whatever.
* DNS resolving through proxy.
## Configuration
proxychains looks for configuration in the following order:
* SOCKS5 proxy host ip and port in environment variable ${PROXYCHAINS_SOCKS5_HOST} ${PROXYCHAINS_SOCKS5_PORT}
(if ${PROXYCHAINS_SOCKS5_PORT} is set, no further configuration will be searched. if ${PROXYCHAINS_SOCKS5_HOST} isn't set, host ip will become "127.0.0.1")
* file listed in environment variable ${PROXYCHAINS_CONF_FILE} or
provided as a -f argument to proxychains script or binary.
* ./proxychains.conf
* $(HOME)/.proxychains/proxychains.conf
* /etc/proxychains.conf
see more in */etc/proxychains.conf*
### Usage Example
```
$ proxychains4 telnet targethost.com
```
in this example it will run telnet through proxy(or chained proxies)
specified by *proxychains.conf*
### Usage Example
```
$ proxychains4 -f /etc/proxychains-other.conf targethost2.com
```
in this example it will use different configuration file then *proxychains.conf*
to connect to targethost2.com host.
### Usage Example
```
$ proxyresolv targethost.com
```
in this example it will resolve targethost.com through proxy(or chained proxies)
specified by *proxychains.conf*
### Usage Example:
```
$ ssh -fN -D 4321 some.example.com
$ PROXYCHAINS_SOCKS5_HOST=127.0.0.1 PROXYCHAINS_SOCKS5_PORT=4321 proxychains zsh
```
in this example, it will run a shell with all traffic proxied through
OpenSSH's "dynamic proxy" (SOCKS5 proxy) on localhost port 4321.
### Usage Example:
```
$ export PROXY_DNS_SERVER=8.8.8.8
$ proxychains4 telnet targethost.com
```
in this example, it will telnet to targethost.com using the 8.8.8.8
nameserver supplied by the user through the PROXY_DNS_SERVER
+6 -2
View File
@@ -1,7 +1,11 @@
ProxyChains ver 4.0 TODO
===================
hooks for reentrant dns functions, i.e. gethostbyaddr_r
- hooks for reentrant dns functions, i.e. gethostbyaddr_r
- shadowsocks support #133
- proxy change according to attempts #156
+3
View File
@@ -0,0 +1,3 @@
#compdef proxychains4
_arguments -s -S '1: :{_command_names -e}' '*:: :_normal'
Vendored
+17 -7
View File
@@ -80,34 +80,44 @@ if [ -z "$CC" ] ; then
fi
if [ $develflg -eq 1 ]; then
CFLAGS="-Wextra -Wunused -Wuninitialized -Wconversion -fno-common -g -O0"
CFLAGS="-Wextra -Wunused -Wuninitialized -Wconversion -fno-common -g -O0 -DDEBUG"
fi
echo CC?=$CC>config.mak
[ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak
[ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>config.mak
[ -z "$LDFLAGS" ] || echo USER_LDFLAGS?=$LDFLAGS>>config.mak
echo prefix=$prefix>>config.mak
echo exec_prefix=$exec_prefix>>config.mak
echo bindir=$bindir>>config.mak
echo libdir=$libdir>>config.mak
echo includedir=$includedir>>config.mak
echo sysconfdir=$sysconfdir>>config.mak
if ismac ; then
arch=`uname -m`
echo LDSO_SUFFIX=dylib>>config.mak
echo OS_CFLAGS+=-DIS_MAC=1 -arch $arch >>config.mak
echo OS_LDFLAGS+=-arch $arch -lpthread -ldl -Wl,>>config.mak
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
echo LDSO_SUFFIX=dylib>>config.mak
echo MAC_CFLAGS+=-DIS_MAC=1 -arch x86_64 -arch i386 >>config.mak
echo MAC_LDFLAGS+=-arch x86_64 -arch i386 >>config.mak
echo LD_SET_SONAME=-ldl -Wl,-install_name,>>config.mak
echo INSTALL_FLAGS=-m>>config.mak
fi
if islinux ; then
echo LD_SET_SONAME=-ldl
if islinux ; then
echo OS_LDFLAGS=-pthread -ldl -Wl,--no-as-needed>>config.mak
echo LD_SET_SONAME=-Wl,-soname= >>config.mak
fi
if isbsd ; then
if isbsd ; then
#echo OS_LDFLAGS=
#echo OS_CFLAGS
echo INSTALL_FLAGS=-m>>config.mak
echo LD_SET_SONAME=-Wl,-rpath,$libdir -install_name,>>config.mak
fi
echo done, now run make \&\& make install
+13
View File
@@ -0,0 +1,13 @@
strict_chain
#proxy_dns
#remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
[ProxyList]
http 162.243.184.252 8585
#socks4 184.170.245.148 4145
#raw 162.243.184.252 8585
+2 -2
View File
@@ -1,13 +1,13 @@
Begin3
Title: ProxyChains
Version: 4.0
Version: 4.3
Entered-date:
Description:
Keywords:
Author: <N37CR347UR3>
Maintained-by: <haad@netbsd.org>
Primary-site:
Home-page: http://proxychains.sourceforge.net
Home-page: https://github.com/haad/proxychains
Original-site:
Platforms: Linux and other Unices
Copying-policy: GNU Public License
+5 -1
View File
@@ -1,4 +1,5 @@
#include "common.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
@@ -15,6 +16,8 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {
char *path = default_path;
if(check_path(path))
return path;
if (!pbuf)
goto err;
// priority 1: env var PROXYCHAINS_CONF_FILE
path = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR);
@@ -45,6 +48,7 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {
if(check_path(path))
return path;
perror("couldnt find configuration file");
err:
perror("couldn't find configuration file");
exit(1);
}
+4 -1
View File
@@ -1,10 +1,13 @@
#define PROXYCHAINS_CONF_FILE_ENV_VAR "PROXYCHAINS_CONF_FILE"
#define PROXYCHAINS_QUIET_MODE_ENV_VAR "PROXYCHAINS_QUIET_MODE"
#define PROXYCHAINS_CONF_FILE "proxychains.conf"
#define PROXYCHAINS_SOCKS5_PORT_ENV_VAR "PROXYCHAINS_SOCKS5_PORT"
#define PROXYCHAINS_SOCKS5_HOST_ENV_VAR "PROXYCHAINS_SOCKS5_HOST"
#define PROXYCHAINS_DNS_ENV_VAR "PROXYCHAINS_DNS"
#define LOG_PREFIX "[proxychains] "
#define PROXYCHAINS_VERSION_MAJOR 4
#define PROXYCHAINS_VERSION_MINOR 1
#define PROXYCHAINS_VERSION_MINOR 3
#define PROXYCHAINS_VERSION_BUGFIX 0
#include <stddef.h>
+31 -5
View File
@@ -278,6 +278,10 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
//memset (buff, 0, sizeof(buff));
switch (pt) {
case RAW_TYPE: {
return SUCCESS;
}
break;
case HTTP_TYPE:{
if(!dns_len) {
inet_ntop(AF_INET, &ip.octet[0], ip_buf, sizeof(ip_buf));
@@ -514,6 +518,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 ((unsigned int)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 +539,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:
@@ -722,6 +739,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
static const ip_type local_host = { {127, 0, 0, 1} };
char hostname[256]; // default maximum length of hostname in linux
struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data* data) {
char buff[256];
uint32_t i, hash;
@@ -743,6 +761,12 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
data->resolved_addr = inet_addr(buff);
if(data->resolved_addr == (in_addr_t) (-1))
data->resolved_addr = (in_addr_t) (local_host.as_int);
snprintf(hostname,sizeof hostname, "%s", name);
data->hostent_space.h_name = hostname;
data->hostent_space.h_length = sizeof (in_addr_t);
data->hostent_space.h_addrtype = AF_INET;
return &data->hostent_space;
}
@@ -805,10 +829,12 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
MUTEX_UNLOCK(&internal_ips_lock);
strncpy(data->addr_name, name, sizeof(data->addr_name));
strncpy(data->addr_name, name, sizeof(data->addr_name) - 1);
data->hostent_space.h_name = data->addr_name;
data->hostent_space.h_length = sizeof(in_addr_t);
data->hostent_space.h_addrtype = AF_INET;
return &data->hostent_space;
err_plus_unlock:
@@ -880,7 +906,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
if(service)
proxy_getservbyname(service, &se_buf, buf, sizeof(buf), &se);
port = se ? se->s_port : htons(atoi(service ? service : "0"));
port = se ? se->s_port : htons((uint16_t)atoi(service ? service : "0"));
((struct sockaddr_in *) &space->sockaddr_space)->sin_port = (in_port_t)port;
*res = p = &space->addrinfo_space;
@@ -888,7 +914,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
p->ai_addr = &space->sockaddr_space;
if(node)
strncpy(space->addr_name, node, sizeof(space->addr_name));
strncpy(space->addr_name, node, sizeof(space->addr_name) - 1);
p->ai_canonname = space->addr_name;
p->ai_next = NULL;
p->ai_family = space->sockaddr_space.sa_family = AF_INET;
+7
View File
@@ -20,6 +20,7 @@
#define __CORE_HEADER
#define BUFF_SIZE 8*1024 // used to read responses from proxies.
#define MAX_LOCALNET 64
#define MAX_DNAT 64
typedef union {
unsigned char octet[4];
@@ -66,6 +67,7 @@ typedef enum {
typedef enum {
HTTP_TYPE,
RAW_TYPE,
SOCKS4_TYPE,
SOCKS5_TYPE
} proxy_type;
@@ -93,6 +95,11 @@ typedef struct {
unsigned short port;
} localaddr_arg;
typedef struct {
struct in_addr orig_dst, new_dst;
unsigned short orig_port, new_port;
} dnat_arg;
typedef struct {
ip_type ip;
unsigned short port;
+135 -9
View File
@@ -66,13 +66,17 @@ chain_type proxychains_ct;
proxy_data proxychains_pd[MAX_CHAIN];
size_t num_localnet_addr = 0;
dnat_arg dnats[MAX_DNAT];
size_t num_dnats = 0;
#ifdef THREAD_SAFE
pthread_once_t init_once = PTHREAD_ONCE_INIT;
#endif
static int init_l = 0;
static void load_default_settings(chain_type *ct);
static inline void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_type * ct);
static void simple_socks5_env(proxy_data * pd, unsigned int *proxy_count, chain_type * ct);
static void* load_sym(char* symname, void* proxyfunc) {
@@ -101,6 +105,9 @@ static void do_init(void) {
MUTEX_INIT(&internal_getsrvbyname_lock, NULL);
#endif
/* check for simple SOCKS5 proxy setup */
simple_socks5_env(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
/* read the config file */
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
@@ -162,6 +169,19 @@ open_config_file() {
return file;
}
/* default settings common to get_chain_data and simple_socks5_env */
static void load_default_settings(chain_type *ct) {
char *env;
tcp_read_time_out = 4 * 1000;
tcp_connect_time_out = 10 * 1000;
*ct = DYNAMIC_TYPE;
env = getenv(PROXYCHAINS_QUIET_MODE_ENV_VAR);
if(env && *env == '1')
proxychains_quiet_mode = 1;
}
/* get configuration from config file */
static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_type * ct) {
unsigned int count = 0;
@@ -170,22 +190,18 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
char *env;
char local_in_addr_port[32];
char local_in_addr[32], local_in_port[32], local_netmask[32];
char dnat_orig_addr_port[32], dnat_new_addr_port[32];
char dnat_orig_addr[32], dnat_orig_port[32], dnat_new_addr[32], dnat_new_port[32];
FILE *file = NULL;
if(proxychains_got_chain_data)
return;
//Some defaults
tcp_read_time_out = 4 * 1000;
tcp_connect_time_out = 10 * 1000;
*ct = DYNAMIC_TYPE;
load_default_settings(ct);
env = get_config_path(getenv(PROXYCHAINS_CONF_FILE_ENV_VAR), buff, sizeof(buff));
file = fopen(env, "r");
env = getenv(PROXYCHAINS_QUIET_MODE_ENV_VAR);
if(env && *env == '1')
proxychains_quiet_mode = 1;
while(fgets(buff, sizeof(buff), file)) {
if(buff[0] != '\n' && buff[strspn(buff, " ")] != '#') {
/* proxylist has to come last */
@@ -205,6 +221,8 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
if(!strcmp(type, "http")) {
pd[count].pt = HTTP_TYPE;
} else if(!strcmp(type, "raw")) {
pd[count].pt = RAW_TYPE;
} else if(!strcmp(type, "socks4")) {
pd[count].pt = SOCKS4_TYPE;
} else if(!strcmp(type, "socks5")) {
@@ -285,6 +303,55 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
proxychains_quiet_mode = 1;
} else if(strstr(buff, "proxy_dns")) {
proxychains_resolver = 1;
} else if(strstr(buff, "dnat")) {
if(sscanf(buff, "%s %21[^ ] %21s\n", user, dnat_orig_addr_port, dnat_new_addr_port) < 3) {
fprintf(stderr, "dnat format error");
exit(1);
}
/* clean previously used buffer */
memset(dnat_orig_port, 0, sizeof(dnat_orig_port) / sizeof(dnat_orig_port[0]));
memset(dnat_new_port, 0, sizeof(dnat_new_port) / sizeof(dnat_new_port[0]));
(void)sscanf(dnat_orig_addr_port, "%15[^:]:%5s", dnat_orig_addr, dnat_orig_port);
(void)sscanf(dnat_new_addr_port, "%15[^:]:%5s", dnat_new_addr, dnat_new_port);
if(num_dnats < MAX_DNAT) {
int error;
error =
inet_pton(AF_INET, dnat_orig_addr,
&dnats[num_dnats].orig_dst);
if(error <= 0) {
fprintf(stderr, "dnat original destination address error\n");
exit(1);
}
error =
inet_pton(AF_INET, dnat_new_addr,
&dnats[num_dnats].new_dst);
if(error <= 0) {
fprintf(stderr, "dnat effective destination address error\n");
exit(1);
}
if(dnat_orig_port[0]) {
dnats[num_dnats].orig_port =
(unsigned short) atoi(dnat_orig_port);
} else {
dnats[num_dnats].orig_port = 0;
}
if(dnat_new_port[0]) {
dnats[num_dnats].new_port =
(unsigned short) atoi(dnat_new_port);
} else {
dnats[num_dnats].new_port = 0;
}
PDEBUG("added dnat: orig-dst=%s orig-port=%d new-dst=%s new-port=%d\n", dnat_orig_addr, dnats[num_dnats].orig_port, dnat_new_addr, dnats[num_dnats].new_port);
++num_dnats;
} else {
fprintf(stderr, "# of dnat exceed %d.\n", MAX_DNAT);
}
}
}
}
@@ -294,9 +361,43 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
proxychains_got_chain_data = 1;
}
static void simple_socks5_env(proxy_data *pd, unsigned int *proxy_count, chain_type *ct) {
char *port_string;
char *host_string;
if(proxychains_got_chain_data)
return;
load_default_settings(ct);
port_string = getenv(PROXYCHAINS_SOCKS5_PORT_ENV_VAR);
if(!port_string)
return;
host_string = getenv(PROXYCHAINS_SOCKS5_HOST_ENV_VAR);
if(!host_string)
host_string = "127.0.0.1";
memset(pd, 0, sizeof(proxy_data));
pd[0].ps = PLAY_STATE;
pd[0].ip.as_int = (uint32_t) inet_addr(host_string);
pd[0].port = htons((unsigned short) strtol(port_string, NULL, 0));
pd[0].pt = SOCKS5_TYPE;
proxychains_max_chain = 1;
if(getenv(PROXYCHAINS_DNS_ENV_VAR))
proxychains_resolver = 1;
*proxy_count = 1;
proxychains_got_chain_data = 1;
}
/******* HOOK FUNCTIONS *******/
int connect(int sock, const struct sockaddr *addr, unsigned int len) {
int connect(int sock, const struct sockaddr *addr, socklen_t len) {
int socktype = 0, flags = 0, ret = 0;
socklen_t optlen = 0;
ip_type dest_ip;
@@ -304,6 +405,8 @@ int connect(int sock, const struct sockaddr *addr, unsigned int len) {
char str[256];
#endif
struct in_addr *p_addr_in;
struct sockaddr_in new_addr;
dnat_arg *dnat = NULL;
unsigned short port;
size_t i;
int remote_dns_connect = 0;
@@ -327,6 +430,29 @@ int connect(int sock, const struct sockaddr *addr, unsigned int len) {
// check if connect called from proxydns
remote_dns_connect = (ntohl(p_addr_in->s_addr) >> 24 == remote_dns_subnet);
// more specific first
for(i = 0; i < num_dnats && !remote_dns_connect && !dnat; i++)
if(dnats[i].orig_dst.s_addr == p_addr_in->s_addr)
if(dnats[i].orig_port && (dnats[i].orig_port == port))
dnat = &dnats[i];
for(i = 0; i < num_dnats && !remote_dns_connect && !dnat; i++)
if(dnats[i].orig_dst.s_addr == p_addr_in->s_addr)
if(!dnats[i].orig_port)
dnat = &dnats[i];
if (dnat) {
if (dnat->new_port)
new_addr.sin_port = htons(dnat->new_port);
else
new_addr.sin_port = htons(port);
new_addr.sin_addr = dnat->new_dst;
addr = (struct sockaddr *)&new_addr;
p_addr_in = &((struct sockaddr_in *) addr)->sin_addr;
port = ntohs(((struct sockaddr_in *) addr)->sin_port);
}
for(i = 0; i < num_localnet_addr && !remote_dns_connect; i++) {
if((localnet_addr[i].in_addr.s_addr & localnet_addr[i].netmask.s_addr)
== (p_addr_in->s_addr & localnet_addr[i].netmask.s_addr)) {
+17 -7
View File
@@ -26,10 +26,14 @@
#include "common.h"
static int usage(char **argv) {
printf("\nUsage:\t%s -q -f config_file program_name [arguments]\n"
"\t-q makes proxychains quiet - this overrides the config setting\n"
"\t-t allows to manually specify a configfile to use\n"
"\tfor example : proxychains telnet somehost.com\n" "More help in README file\n\n", argv[0]);
printf( "\nProxychains4: %d.%d.%d\n"
"Usage:\t%s -q -f config_file program_name [arguments]\n"
"\t-v print version and exit\n"
"\t-q makes proxychains quiet - this overrides the config setting\n"
"\t-f allows to manually specify a configfile to use\n"
"\n\tfor example : proxychains telnet somehost.com\n"
"\n\tMore help in README file\n\n", PROXYCHAINS_VERSION_MAJOR,
PROXYCHAINS_VERSION_MINOR, PROXYCHAINS_VERSION_BUGFIX, argv[0]);
return EXIT_FAILURE;
}
@@ -37,7 +41,7 @@ static const char *dll_name = DLL_NAME;
static char own_dir[256];
static const char *dll_dirs[] = {
".",
//".",
own_dir,
LIB_DIR,
"/lib",
@@ -52,7 +56,8 @@ static void set_own_dir(const char *argv0) {
while(l && argv0[l - 1] != '/')
l--;
if(l == 0)
memcpy(own_dir, ".", 2);
//memcpy(own_dir, ".", 2);
memcpy(own_dir, "/dev/null/", 2);
else {
memcpy(own_dir, argv0, l - 1);
own_dir[l] = 0;
@@ -76,6 +81,10 @@ int main(int argc, char *argv[]) {
if(argv[start_argv][1] == 'q') {
quiet = 1;
start_argv++;
} else if(argv[start_argv][1] == 'v') {
printf("Proxychains4 version: %d.%d.%d\n", PROXYCHAINS_VERSION_MAJOR, PROXYCHAINS_VERSION_MINOR, PROXYCHAINS_VERSION_BUGFIX);
exit(EXIT_SUCCESS);
} else if(argv[start_argv][1] == 'f') {
if(start_argv + 1 < argc)
@@ -106,6 +115,7 @@ int main(int argc, char *argv[]) {
// search DLL
set_own_dir(argv[0]);
i = 0;
while(dll_dirs[i]) {
snprintf(buf, sizeof(buf), "%s/%s", dll_dirs[i], dll_name);
if(access(buf, R_OK) != -1) {
@@ -116,7 +126,7 @@ int main(int argc, char *argv[]) {
}
if(!prefix) {
fprintf(stderr, "couldnt locate %s\n", dll_name);
fprintf(stderr, "couldn't locate %s\n", dll_name);
return EXIT_FAILURE;
}
+1 -1
View File
@@ -4,7 +4,7 @@ echo "ProxyChains-4.0 (https://github.com/haad/proxychains)"
usage() {
echo " usage:"
echo " $0 [hq] [-f config-file] <prog> [args]"
echo " $0 [hqv] [-f config-file] <prog> [args]"
echo " -q make proxychains quiet"
exit
}
+21 -2
View File
@@ -73,6 +73,24 @@ localnet 127.0.0.0/255.0.0.0
## Exclude connections to ANYwhere with port 80
# localnet 0.0.0.0:80/0.0.0.0
### Examples for dnat
## Trying to proxy connections to destinations which are dnatted,
## will result in proxying connections to the new given destinations.
## Whenever I connect to 1.1.1.1 on port 1234 actually connect to 1.1.1.2 on port 443
# dnat 1.1.1.1:1234 1.1.1.2:443
## Whenever I connect to 1.1.1.1 on port 443 actually connect to 1.1.1.2 on port 443
## (no need to write :443 again)
# dnat 1.1.1.2:443 1.1.1.2
## No matter what port I connect to on 1.1.1.1 port actually connect to 1.1.1.2 on port 443
# dnat 1.1.1.1 1.1.1.2:443
## Always, instead of connecting to 1.1.1.1, connect to 1.1.1.2
# dnat 1.1.1.1 1.1.1.2
# ProxyList format
# type host port [user pass]
# (values separated by 'tab' or 'blank')
@@ -86,12 +104,13 @@ localnet 127.0.0.0/255.0.0.0
# http 192.168.39.93 8080
#
#
# proxy types: http, socks4, socks5
# proxy types: http, socks4, socks5, raw
# * raw: The traffic is simply forwarded to the proxy without modification.
# ( auth types supported: "basic"-http "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# meanwhile
# defaults set to "tor"
socks4 127.0.0.1 9050
+10 -2
View File
@@ -2,8 +2,12 @@
# This script is called by proxychains to resolve DNS names
# DNS server used to resolve names
DNS_SERVER=4.2.2.2
if [ -z "$PROXY_DNS_SERVER" ] ; then
DNS_SERVER=208.67.222.222 # OpenDNS
else
DNS_SERVER=$PROXY_DNS_SERVER
fi
if [ $# = 0 ] ; then
echo " usage:"
@@ -11,6 +15,10 @@ if [ $# = 0 ] ; then
exit
fi
awk 'BEGIN{ARGC=0} {for(i=2;i<=NF;i++){if($i==ARGV[1] && $1!~":"){print $1;found=1}} } END{exit found?0:1}' "$1" </etc/hosts
if [ "$?" -eq "0" ]; then
exit
fi
export LD_PRELOAD=libproxychains.so
dig $1 @$DNS_SERVER +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
drill $1 @$DNS_SERVER -t | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'