mirror of
https://github.com/haad/proxychains
synced 2026-06-08 14:30:41 +00:00
Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1471c5756f | |||
| 8fd0d95bc3 | |||
| b20106ce2e | |||
| e5f3422b16 | |||
| 150e624182 | |||
| c3a0f677fb | |||
| 15d4d5a669 | |||
| 865dc76c08 | |||
| 9a29a4c0d1 | |||
| ca599cbc86 | |||
| 3bd07fca00 | |||
| 0845d1c044 | |||
| 16fa60a705 | |||
| 08d6feace8 | |||
| a6d778a0f1 | |||
| 8f3bc0934a | |||
| 6ac6abd3de | |||
| 41e73ab58d | |||
| d5ae1f9202 | |||
| 4cb2cf3416 | |||
| 5de7fa20c8 | |||
| d30b0a8712 | |||
| e547835be6 | |||
| 8e82005d91 | |||
| f3511f77d5 | |||
| b1febc25d6 | |||
| c377789d14 | |||
| a9df8ecaaa | |||
| 888a81345a | |||
| 1740dfbd66 | |||
| 76545db413 | |||
| 2f1958d551 | |||
| b8bdfc2d5e | |||
| 4d517cdfb0 | |||
| 218d242aab | |||
| 5095296ddf | |||
| a6792b937d | |||
| 86be015f0d | |||
| 7cde272e29 | |||
| f85edffeea | |||
| a6681ca7a1 | |||
| 7183b7ef1a | |||
| e928b25735 | |||
| bb2d076fab | |||
| 6f451f094d | |||
| 282d3d0390 | |||
| 85aec8878d | |||
| 4c7262163e |
+11
@@ -0,0 +1,11 @@
|
||||
*.o
|
||||
*.so
|
||||
*.la
|
||||
*.lo
|
||||
.deps/
|
||||
.libs/
|
||||
|
||||
# Autoconf stuff
|
||||
libtool
|
||||
config.*
|
||||
stamp-h
|
||||
@@ -0,0 +1,5 @@
|
||||
N3E7CR34TUR3.
|
||||
|
||||
web site: proxychains.sourceforge.net
|
||||
email: netcreature@users.sourceforge.net
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,65 @@
|
||||
ProxyChains version history (public releases)
|
||||
====================
|
||||
|
||||
ver 3.1
|
||||
|
||||
changed:
|
||||
* dns resolver script fix
|
||||
* prototypes in core.h
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 3.0
|
||||
|
||||
added:
|
||||
* new feature - DNS from behind proxy
|
||||
* proxyresolv - stand alone command
|
||||
* proxychains.conf - new option to enable/disable DNS support
|
||||
|
||||
changed:
|
||||
* bugfixes in core lib
|
||||
* fixed strict chain
|
||||
* fixed random chain
|
||||
* output text
|
||||
* autotools fix
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 2.1
|
||||
* bugfuxes
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 2.0
|
||||
* major core rewrite
|
||||
* new config options
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 1.8.2
|
||||
* minor bugfixes
|
||||
* improved compilation on FreeBSD & OpenBSD sysems.
|
||||
* improved compilation on Sun Solaris systems .
|
||||
* cross platform (UNIX) issues
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 1.8.0
|
||||
|
||||
added:
|
||||
* Socks5 protocol
|
||||
* Socks4 protocol
|
||||
* HTTP proxy auth basic
|
||||
* Socks4 user auth
|
||||
* Socks5 user/pass auth
|
||||
* more chain options (random, strict, dynamic )
|
||||
* configurable timeout for TCP connect.
|
||||
* configurable timeout for TCP read.
|
||||
* INSTALL file (explains how to install properly)
|
||||
|
||||
changed:
|
||||
* configuration file entries (proxychains.conf)
|
||||
* configuration file lookup
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 0.0.1
|
||||
* TCP calls interception
|
||||
* HTTP CONNECT proxy protocol.
|
||||
@@ -0,0 +1,13 @@
|
||||
ProxyChains ver 3.1 Installation
|
||||
=======================
|
||||
|
||||
If you have installed other ver of proxychains "make uninstall" before installing this distribution
|
||||
|
||||
unpack the .tar.gz , 'cd' to distribution directory and
|
||||
run following commands (as root)
|
||||
-------------------------------------
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
-------------------------------------
|
||||
that's all
|
||||
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# Makefile for proxychains (requires GNU make), stolen from musl
|
||||
#
|
||||
# Use config.mak to override any of the following variables.
|
||||
# Do not make changes here.
|
||||
#
|
||||
|
||||
prefix = /usr/local
|
||||
includedir = $(prefix)/include
|
||||
libdir = $(prefix)/lib
|
||||
|
||||
exec_prefix = $(prefix)
|
||||
bindir = $(exec_prefix)/bin
|
||||
|
||||
SRCS = $(sort $(wildcard src/*.c))
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/core.o src/libproxychains.o
|
||||
|
||||
CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE
|
||||
LDFLAGS = -shared -fPIC -ldl -lpthread
|
||||
INC =
|
||||
PIC = -fPIC
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
RANLIB = $(CROSS_COMPILE)ranlib
|
||||
|
||||
LDSO_PATHNAME = libproxychains4.so
|
||||
|
||||
SHARED_LIBS = $(LDSO_PATHNAME)
|
||||
ALL_LIBS = $(SHARED_LIBS)
|
||||
PXCHAINS = proxychains4
|
||||
ALL_TOOLS = $(PXCHAINS)
|
||||
|
||||
-include config.mak
|
||||
|
||||
CFLAGS+=$(USER_CFLAGS)
|
||||
CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\"
|
||||
|
||||
|
||||
all: $(ALL_LIBS) $(ALL_TOOLS)
|
||||
|
||||
#install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(DESTDIR)$(LDSO_PATHNAME)
|
||||
install:
|
||||
install -D -m 755 $(ALL_TOOLS) $(bindir)/
|
||||
install -D -m 644 $(ALL_LIBS) $(libdir)/
|
||||
install -D -m 644 src/proxychains.conf $(prefix)/etc/
|
||||
|
||||
clean:
|
||||
rm -f $(ALL_LIBS)
|
||||
rm -f $(ALL_TOOLS)
|
||||
rm -f $(OBJS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $<
|
||||
|
||||
$(LDSO_PATHNAME): $(LOBJS)
|
||||
$(CC) $(LDFLAGS) -Wl,-soname=$(LDSO_PATHNAME) -o $@ $(LOBJS)
|
||||
|
||||
$(ALL_TOOLS): $(OBJS)
|
||||
$(CC) src/main.o -o $(PXCHAINS)
|
||||
|
||||
|
||||
.PHONY: all clean install
|
||||
@@ -0,0 +1,95 @@
|
||||
ProxyChains ver 4.0 README
|
||||
==========================
|
||||
|
||||
*********** 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)
|
||||
|
||||
*********************************
|
||||
|
||||
|
||||
This is Unix version only.
|
||||
|
||||
How to mess with sources - How to Install : read INSTALL !!!!!!
|
||||
|
||||
This program forces any tcp connection made by any given tcp client
|
||||
to follow through proxy (or proxy chain). It is a kind of proxifier.
|
||||
It acts like sockscap / permeo / eborder driver ( intercepts TCP calls )
|
||||
It is FREE.
|
||||
|
||||
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:
|
||||
|
||||
bash$ proxychains telnet targethost.com
|
||||
|
||||
in this example it will run telnet through proxy(or chained proxies)
|
||||
specified by proxychains.conf
|
||||
|
||||
Usage Example:
|
||||
|
||||
bash$ 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:
|
||||
|
||||
bash$ proxyresolv targethost.com
|
||||
|
||||
in this example it will resolve targethost.com through proxy(or chained proxies)
|
||||
specified by proxychains.conf
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
ProxyChains ver 3.1 TODO
|
||||
===================
|
||||
|
||||
stable DNS resolver .... currently gnu dig is used, which is an ugly hack
|
||||
also it is required to link it with the same libc as proxychains
|
||||
|
||||
hooks for reentrant dns functions, i.e. gethostbyaddr_r
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
prefix=/usr/local
|
||||
|
||||
spliteq() {
|
||||
arg=$1
|
||||
echo "${arg#*=}"
|
||||
#alternatives echo "$arg" | cut -d= -f2-
|
||||
# or echo "$arg" | sed 's/[^=]*=//'
|
||||
}
|
||||
|
||||
parsearg() {
|
||||
case "$1" in
|
||||
--prefix=*) prefix=$(spliteq "$1");;
|
||||
--exec_prefix=*) exec_prefix=`spliteq $1`;;
|
||||
--bindir=*) bindir=`spliteq $1`;;
|
||||
--libdir=*) libdir=`spliteq $1`;;
|
||||
--includedir=*) includedir=`spliteq $1`;;
|
||||
esac
|
||||
}
|
||||
|
||||
while true ; do
|
||||
case $1 in
|
||||
-*) parsearg "$1"; shift;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! $exec_prefix ] ; then
|
||||
exec_prefix=$prefix
|
||||
fi
|
||||
|
||||
if [ ! $libdir ] ; then
|
||||
libdir=$prefix/lib
|
||||
fi
|
||||
|
||||
if [ ! $includedir ] ; then
|
||||
includedir=$prefix/include
|
||||
fi
|
||||
|
||||
if [ ! $bindir ] ; then
|
||||
bindir=$exec_prefix/bin
|
||||
fi
|
||||
|
||||
if [ ! $CC ] ; then
|
||||
CC=cc
|
||||
fi
|
||||
|
||||
echo CC?=$CC>config.mak
|
||||
[ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak
|
||||
[ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>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 done, now run make \&\& make install
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
### config.mak template for proxychains
|
||||
#######################################
|
||||
|
||||
# just copy into proxychains root dir and adapt to your needs.
|
||||
|
||||
prefix = /usr/local/
|
||||
libdir = $(prefix)/lib
|
||||
|
||||
exec_prefix = /usr/local
|
||||
bindir = $(exec_prefix)/bin
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 943 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
-74
@@ -1,74 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset='utf-8' />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<meta name="description" content="Proxychains : proxychains - a tool that forces any TCP connection made by any given application to follow through proxy like TOR or any other SOCKS4, SOCKS5 or HTTP(S) proxy. Supported auth-types: "user/pass" for SOCKS4/5, "basic" for HTTP." />
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
|
||||
|
||||
<title>Proxychains</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- HEADER -->
|
||||
<div id="header_wrap" class="outer">
|
||||
<header class="inner">
|
||||
<a id="forkme_banner" href="https://github.com/haad/proxychains">View on GitHub</a>
|
||||
|
||||
<h1 id="project_title">Proxychains</h1>
|
||||
<h2 id="project_tagline">proxychains - a tool that forces any TCP connection made by any given application to follow through proxy like TOR or any other SOCKS4, SOCKS5 or HTTP(S) proxy. Supported auth-types: "user/pass" for SOCKS4/5, "basic" for HTTP.</h2>
|
||||
|
||||
<section id="downloads">
|
||||
<a class="zip_download_link" href="https://github.com/haad/proxychains/zipball/master">Download this project as a .zip file</a>
|
||||
<a class="tar_download_link" href="https://github.com/haad/proxychains/tarball/master">Download this project as a tar.gz file</a>
|
||||
</section>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<!-- MAIN CONTENT -->
|
||||
<div id="main_content_wrap" class="outer">
|
||||
<section id="main_content" class="inner">
|
||||
<h3>Welcome to GitHub Pages.</h3>
|
||||
|
||||
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:</p>
|
||||
|
||||
<pre><code>$ cd your_repo_root/repo_name
|
||||
$ git fetch origin
|
||||
$ git checkout gh-pages
|
||||
</code></pre>
|
||||
|
||||
<p>If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.</p>
|
||||
|
||||
<h3>Designer Templates</h3>
|
||||
|
||||
<p>We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.</p>
|
||||
|
||||
<h3>Rather Drive Stick?</h3>
|
||||
|
||||
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
|
||||
|
||||
<h3>Authors and Contributors</h3>
|
||||
|
||||
<p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code><a></code> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
|
||||
|
||||
<h3>Support or Contact</h3>
|
||||
|
||||
<p>Having trouble with Pages? Check out the documentation at <a href="http://help.github.com/pages">http://help.github.com/pages</a> or contact <a href="mailto:support@github.com">support@github.com</a> and we’ll help you sort it out.</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- FOOTER -->
|
||||
<div id="footer_wrap" class="outer">
|
||||
<footer class="inner">
|
||||
<p class="copyright">Proxychains maintained by <a href="https://github.com/haad">haad</a></p>
|
||||
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
console.log('This would be the main JS file.');
|
||||
@@ -1 +0,0 @@
|
||||
{"note":"Don't delete this file! It's used internally to help with page regeneration.","google":"","name":"Proxychains","body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.","tagline":"proxychains - a tool that forces any TCP connection made by any given application to follow through proxy like TOR or any other SOCKS4, SOCKS5 or HTTP(S) proxy. Supported auth-types: \"user/pass\" for SOCKS4/5, \"basic\" for HTTP."}
|
||||
@@ -0,0 +1,14 @@
|
||||
Begin3
|
||||
Title: ProxyChains
|
||||
Version: 3.0
|
||||
Entered-date:
|
||||
Description:
|
||||
Keywords:
|
||||
Author: <N37CR347UR3>
|
||||
Maintained-by: <NetCreature>
|
||||
Primary-site:
|
||||
Home-page: http://proxychains.sourceforge.net
|
||||
Original-site:
|
||||
Platforms: Linux and other Unices
|
||||
Copying-policy: GNU Public License
|
||||
End
|
||||
@@ -0,0 +1,4 @@
|
||||
#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 LOG_PREFIX "[proxychains] "
|
||||
+912
@@ -0,0 +1,912 @@
|
||||
/***************************************************************************
|
||||
core.c - description
|
||||
-------------------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************
|
||||
* GPL *
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef THREAD_SAFE
|
||||
#include <pthread.h>
|
||||
pthread_mutex_t internal_ips_lock;
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
#include "common.h"
|
||||
|
||||
extern int tcp_read_time_out;
|
||||
extern int tcp_connect_time_out;
|
||||
extern int proxychains_quiet_mode;
|
||||
|
||||
internal_ip_lookup_table internal_ips = {0, 0, NULL};
|
||||
|
||||
|
||||
uint32_t dalias_hash(char* s0) {
|
||||
unsigned char* s = (void*) s0;
|
||||
uint_fast32_t h = 0;
|
||||
while (*s) {
|
||||
h = 16*h + *s++;
|
||||
h ^= h>>24 & 0xf0;
|
||||
}
|
||||
return h & 0xfffffff;
|
||||
}
|
||||
|
||||
uint32_t index_from_internal_ip(ip_type internalip) {
|
||||
ip_type tmp = internalip;
|
||||
uint32_t ret;
|
||||
ret = tmp.octet[3] + (tmp.octet[2] << 8) + (tmp.octet[1] << 16);
|
||||
ret -= 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* string_from_internal_ip(ip_type internalip) {
|
||||
char* res = NULL;
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_lock(&internal_ips_lock);
|
||||
#endif
|
||||
uint32_t index = index_from_internal_ip(internalip);
|
||||
if(index < internal_ips.counter)
|
||||
res = internal_ips.list[index]->string;
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_unlock(&internal_ips_lock);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
in_addr_t make_internal_ip(uint32_t index) {
|
||||
ip_type ret;
|
||||
index++; // so we can start at .0.0.1
|
||||
if(index > 0xFFFFFF) return (in_addr_t) -1;
|
||||
ret.octet[0] = 224;
|
||||
ret.octet[1] = (index & 0xFF0000) >> 16;
|
||||
ret.octet[2] = (index & 0xFF00) >> 8;
|
||||
ret.octet[3] = index & 0xFF;
|
||||
return (in_addr_t) ret.as_int;
|
||||
}
|
||||
|
||||
static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static int poll_retry(struct pollfd *fds, nfds_t nfsd, int timeout)
|
||||
{
|
||||
int ret;
|
||||
int time_remain = timeout;
|
||||
int time_elapsed = 0;
|
||||
|
||||
struct timeval start_time;
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&start_time, NULL);
|
||||
|
||||
do {
|
||||
//printf("Retry %d\n", time_remain);
|
||||
ret = poll(fds, nfsd, time_remain);
|
||||
gettimeofday(&tv, NULL);
|
||||
time_elapsed = ((tv.tv_sec - start_time.tv_sec) * 1000 + (tv.tv_usec - start_time.tv_usec) / 1000);
|
||||
//printf("Time elapsed %d\n", time_elapsed);
|
||||
time_remain = timeout - time_elapsed;
|
||||
} while (ret == -1 && errno == EINTR && time_remain > 0);
|
||||
|
||||
//if (ret == -1)
|
||||
//printf("Return %d %d %s\n", ret, errno, strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void encode_base_64(char* src,char* dest,int max_len)
|
||||
{
|
||||
int n,l,i;
|
||||
l=strlen(src);
|
||||
max_len=(max_len-1)/4;
|
||||
for ( i=0;i<max_len;i++,src+=3,l-=3)
|
||||
{
|
||||
switch (l) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
n=src[0] << 16;
|
||||
*dest++=base64[(n >> 18) & 077];
|
||||
*dest++=base64[(n >> 12) & 077];
|
||||
*dest++='=';
|
||||
*dest++='=';
|
||||
break;
|
||||
case 2:
|
||||
n=src[0] << 16 | src[1] << 8;
|
||||
*dest++=base64[(n >> 18) & 077];
|
||||
*dest++=base64[(n >> 12) & 077];
|
||||
*dest++=base64[(n >> 6) & 077];
|
||||
*dest++='=';
|
||||
break;
|
||||
default:
|
||||
n=src[0] << 16 | src[1] << 8 | src[2];
|
||||
*dest++=base64[(n >> 18) & 077];
|
||||
*dest++=base64[(n >> 12) & 077];
|
||||
*dest++=base64[(n >> 6) & 077];
|
||||
*dest++=base64[n & 077];
|
||||
}
|
||||
if (l<3) break;
|
||||
}
|
||||
*dest++=0;
|
||||
}
|
||||
|
||||
#define LOG_BUFF 1024*20
|
||||
|
||||
int proxychains_write_log(char *str,...)
|
||||
{
|
||||
char buff[LOG_BUFF];
|
||||
va_list arglist;
|
||||
FILE * log_file;
|
||||
log_file=stderr;
|
||||
if (!proxychains_quiet_mode) {
|
||||
va_start(arglist,str);
|
||||
vsprintf(buff,str,arglist);
|
||||
va_end(arglist);
|
||||
fprintf(log_file,"%s",buff);
|
||||
fflush(log_file);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static int write_n_bytes(int fd,char *buff,size_t size)
|
||||
{
|
||||
int i=0;
|
||||
size_t wrote=0;
|
||||
for(;;) {
|
||||
i = write(fd,&buff[wrote],size-wrote);
|
||||
if(i<=0)
|
||||
return i;
|
||||
wrote += i;
|
||||
if(wrote==size)
|
||||
return wrote;
|
||||
}
|
||||
}
|
||||
|
||||
static int read_n_bytes(int fd,char *buff, size_t size)
|
||||
{
|
||||
int ready;
|
||||
size_t i;
|
||||
struct pollfd pfd[1];
|
||||
|
||||
pfd[0].fd=fd;
|
||||
pfd[0].events=POLLIN;
|
||||
for(i=0; i < size; i++) {
|
||||
pfd[0].revents = 0;
|
||||
ready = poll_retry(pfd, 1, tcp_read_time_out);
|
||||
if(ready != 1 || !(pfd[0].revents&POLLIN) || 1 != read(fd,&buff[i],1))
|
||||
return -1;
|
||||
}
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len)
|
||||
{
|
||||
int ret, value;
|
||||
socklen_t value_len;
|
||||
struct pollfd pfd[1];
|
||||
|
||||
pfd[0].fd=sock;
|
||||
pfd[0].events=POLLOUT;
|
||||
fcntl(sock, F_SETFL, O_NONBLOCK);
|
||||
ret = true_connect(sock, addr, len);
|
||||
#ifdef DEBUG
|
||||
if(ret == -1) perror("true_connect");
|
||||
printf("\nconnect ret=%d\n",ret);
|
||||
|
||||
fflush(stdout);
|
||||
#endif
|
||||
if(ret==-1 && errno==EINPROGRESS) {
|
||||
ret=poll_retry(pfd,1,tcp_connect_time_out);
|
||||
#ifdef DEBUG
|
||||
printf("\npoll ret=%d\n",ret);fflush(stdout);
|
||||
#endif
|
||||
if(ret == 1) {
|
||||
value_len=sizeof(socklen_t);
|
||||
getsockopt(sock,SOL_SOCKET,SO_ERROR,&value,&value_len) ;
|
||||
#ifdef DEBUG
|
||||
printf("\nvalue=%d\n",value);fflush(stdout);
|
||||
#endif
|
||||
if(!value)
|
||||
ret=0;
|
||||
else
|
||||
ret=-1;
|
||||
} else {
|
||||
ret=-1;
|
||||
}
|
||||
} else {
|
||||
if (ret != 0)
|
||||
ret=-1;
|
||||
}
|
||||
|
||||
fcntl(sock, F_SETFL, !O_NONBLOCK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define INVALID_INDEX 0xFFFFFFFFU
|
||||
static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt,char *user,char *pass)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PDEBUG("tunnel_to()\n");
|
||||
#endif
|
||||
char* dns_name = NULL;
|
||||
size_t dns_len = 0;
|
||||
|
||||
// we use ip addresses with 224.* to lookup their dns name in our table, to allow remote DNS resolution
|
||||
// the range 224-255.* is reserved, and it won't go outside (unless the app does some other stuff with
|
||||
// the results returned from gethostbyname et al.)
|
||||
if(ip.octet[0] == 224) {
|
||||
dns_name = string_from_internal_ip(ip);
|
||||
if(!dns_name) goto err;
|
||||
dns_len = strlen(dns_name);
|
||||
if(!dns_len) goto err;
|
||||
}
|
||||
|
||||
size_t ulen = strlen(user);
|
||||
size_t passlen = strlen(pass);
|
||||
|
||||
if(ulen > 0xFF || passlen > 0xFF || dns_len > 0xFF) {
|
||||
proxychains_write_log(LOG_PREFIX "error: maximum size of 255 for user/pass or domain name!\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
int len;
|
||||
unsigned char buff[BUFF_SIZE];
|
||||
//memset (buff, 0, sizeof(buff));
|
||||
|
||||
switch(pt) {
|
||||
case HTTP_TYPE: {
|
||||
if(!dns_len)
|
||||
dns_name = inet_ntoa( * (struct in_addr *) &ip.as_int);
|
||||
|
||||
snprintf((char*)buff, sizeof(buff), "CONNECT %s:%d HTTP/1.0\r\n", dns_name, ntohs(port));
|
||||
|
||||
if (user[0])
|
||||
{
|
||||
#define HTTP_AUTH_MAX ((0xFF * 2) + 1 + 1)
|
||||
// 2 * 0xff: username and pass, plus 1 for ':' and 1 for zero terminator.
|
||||
char src[HTTP_AUTH_MAX];
|
||||
char dst[(4 * HTTP_AUTH_MAX)];
|
||||
|
||||
memcpy(src, user, ulen);
|
||||
memcpy(src + ulen, ":", 1);
|
||||
memcpy(src + ulen + 1, pass, passlen);
|
||||
src[ulen + 1 + passlen] = 0;
|
||||
|
||||
encode_base_64(src, dst, sizeof(dst));
|
||||
strcat((char*)buff,"Proxy-Authorization: Basic ");
|
||||
strcat((char*)buff, dst);
|
||||
strcat((char*)buff, "\r\n\r\n");
|
||||
}
|
||||
else
|
||||
strcat((char*)buff, "\r\n");
|
||||
|
||||
len = strlen((char*)buff);
|
||||
|
||||
if(len != send(sock, buff, len, 0))
|
||||
goto err;
|
||||
|
||||
len = 0 ;
|
||||
// read header byte by byte.
|
||||
while(len < BUFF_SIZE) {
|
||||
if(1 == read_n_bytes(sock, (char*) (buff + len), 1))
|
||||
len++;
|
||||
else
|
||||
goto err;
|
||||
if (len > 4 &&
|
||||
buff[len-1]=='\n' &&
|
||||
buff[len-2]=='\r' &&
|
||||
buff[len-3]=='\n' &&
|
||||
buff[len-4]=='\r' )
|
||||
break;
|
||||
}
|
||||
|
||||
// if not ok (200) or response greather than BUFF_SIZE return BLOCKED;
|
||||
if (len == BUFF_SIZE ||
|
||||
!( buff[9] =='2' &&
|
||||
buff[10]=='0' &&
|
||||
buff[11]=='0' ))
|
||||
return BLOCKED;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case SOCKS4_TYPE: {
|
||||
buff[0] = 4; // socks version
|
||||
buff[1] = 1; // connect command
|
||||
memcpy(&buff[2],&port,2); // dest port
|
||||
if(dns_len) {
|
||||
ip.octet[0] = 0;
|
||||
ip.octet[1] = 0;
|
||||
ip.octet[2] = 0;
|
||||
ip.octet[3] = 1;
|
||||
}
|
||||
memcpy(&buff[4], &ip, 4); // dest host
|
||||
len = ulen + 1; // username
|
||||
if(len > 1)
|
||||
memcpy(&buff[8], user, len);
|
||||
else {
|
||||
buff[8] = 0;
|
||||
}
|
||||
|
||||
// do socksv4a dns resolution on the server
|
||||
if(dns_len) {
|
||||
memcpy(&buff[8 + len], dns_name, dns_len + 1);
|
||||
len += dns_len + 1;
|
||||
}
|
||||
|
||||
if((len + 8) != write_n_bytes(sock, (char*) buff, (8+len)))
|
||||
goto err;
|
||||
|
||||
if(8 != read_n_bytes(sock, (char*)buff, 8))
|
||||
goto err;
|
||||
|
||||
if (buff[0] != 0 || buff[1] != 90)
|
||||
return BLOCKED;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
break;
|
||||
case SOCKS5_TYPE: {
|
||||
if(user) {
|
||||
buff[0]=5; //version
|
||||
buff[1]=2; //nomber of methods
|
||||
buff[2]=0; // no auth method
|
||||
buff[3]=2; /// auth method -> username / password
|
||||
if(4!=write_n_bytes(sock, (char*)buff, 4))
|
||||
goto err;
|
||||
}
|
||||
else {
|
||||
buff[0]=5; //version
|
||||
buff[1]=1; //nomber of methods
|
||||
buff[2]=0; // no auth method
|
||||
if(3 != write_n_bytes(sock, (char*) buff, 3))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if(2 != read_n_bytes(sock, (char*) buff, 2))
|
||||
goto err;
|
||||
|
||||
if (buff[0] != 5 || (buff[1] != 0 && buff[1] != 2)) {
|
||||
if(buff[0] == 5 && buff[1] == 0xFF)
|
||||
return BLOCKED;
|
||||
else
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (buff[1] == 2) {
|
||||
// authentication
|
||||
char in[2];
|
||||
char out[515]; char* cur=out;
|
||||
int c;
|
||||
*cur++=1; // version
|
||||
c = ulen & 0xFF;
|
||||
*cur++ = c;
|
||||
memcpy(cur, user, c);
|
||||
cur += c;
|
||||
c = passlen & 0xFF;
|
||||
*cur++ = c;
|
||||
memcpy(cur, pass, c);
|
||||
cur += c;
|
||||
|
||||
if((cur-out) != write_n_bytes(sock, out, cur-out))
|
||||
goto err;
|
||||
|
||||
|
||||
if(2 != read_n_bytes(sock,in,2))
|
||||
goto err;
|
||||
if(in[0] != 1 || in[1] != 0) {
|
||||
if(in[0] != 1)
|
||||
goto err;
|
||||
else
|
||||
return BLOCKED;
|
||||
}
|
||||
}
|
||||
int buff_iter = 0;
|
||||
buff[buff_iter++] = 5; // version
|
||||
buff[buff_iter++] = 1; // connect
|
||||
buff[buff_iter++] = 0; // reserved
|
||||
|
||||
if(!dns_len) {
|
||||
buff[buff_iter++] = 1; // ip v4
|
||||
memcpy(buff + buff_iter, &ip, 4); // dest host
|
||||
buff_iter += 4;
|
||||
} else {
|
||||
buff[buff_iter++] = 3; //dns
|
||||
buff[buff_iter++] = dns_len & 0xFF;
|
||||
memcpy(buff + buff_iter, dns_name, dns_len);
|
||||
buff_iter += dns_len;
|
||||
}
|
||||
|
||||
memcpy(buff + buff_iter, &port, 2); // dest port
|
||||
buff_iter += 2;
|
||||
|
||||
|
||||
if(buff_iter != write_n_bytes(sock, (char*)buff, buff_iter))
|
||||
goto err;
|
||||
|
||||
if(4 != read_n_bytes(sock, (char*)buff, 4))
|
||||
goto err;
|
||||
|
||||
if (buff[0] != 5 || buff[1] != 0)
|
||||
goto err;
|
||||
|
||||
switch (buff[3]) {
|
||||
|
||||
case 1: len = 4; break;
|
||||
case 4: len = 16; break;
|
||||
case 3: len = 0;
|
||||
if(1 != read_n_bytes(sock, (char*) &len, 1))
|
||||
goto err;
|
||||
break;
|
||||
default:
|
||||
goto err;
|
||||
}
|
||||
|
||||
if(len + 2 != read_n_bytes(sock, (char*) buff, len+2))
|
||||
goto err;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
err:
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
|
||||
#define TP " ... "
|
||||
#define DT "Dynamic chain"
|
||||
#define ST "Strict chain"
|
||||
#define RT "Random chain"
|
||||
|
||||
static int start_chain(int *fd, proxy_data *pd, char* begin_mark)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
||||
*fd=socket(PF_INET,SOCK_STREAM,0);
|
||||
if(*fd==-1)
|
||||
goto error;
|
||||
|
||||
proxychains_write_log(LOG_PREFIX "%s "TP" %s:%d ",
|
||||
begin_mark,
|
||||
inet_ntoa(*(struct in_addr*)&pd->ip),
|
||||
htons(pd->port));
|
||||
pd->ps=PLAY_STATE;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = (in_addr_t) pd->ip.as_int;
|
||||
addr.sin_port = pd->port;
|
||||
if (timed_connect (*fd ,(struct sockaddr*)&addr,sizeof(addr))) {
|
||||
pd->ps=DOWN_STATE;
|
||||
goto error1;
|
||||
}
|
||||
pd->ps=BUSY_STATE;
|
||||
return SUCCESS;
|
||||
error1:
|
||||
proxychains_write_log(TP" timeout\n");
|
||||
error:
|
||||
if(*fd!=-1)
|
||||
close(*fd);
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
|
||||
static proxy_data * select_proxy(select_type how,
|
||||
proxy_data *pd, unsigned int proxy_count, unsigned int *offset)
|
||||
{
|
||||
unsigned int i=0, k=0;
|
||||
if(*offset >= proxy_count)
|
||||
return NULL;
|
||||
switch(how) {
|
||||
case RANDOMLY:
|
||||
srand(time(NULL));
|
||||
do {
|
||||
k++;
|
||||
i = 0 + (unsigned int) (proxy_count * 1.0 * rand()/
|
||||
(RAND_MAX + 1.0));
|
||||
} while (pd[i].ps != PLAY_STATE && k < proxy_count*100 );
|
||||
break;
|
||||
case FIFOLY:
|
||||
for(i=*offset; i<proxy_count; i++) {
|
||||
if(pd[i].ps == PLAY_STATE) {
|
||||
*offset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (i >= proxy_count)
|
||||
i = 0;
|
||||
return (pd[i].ps == PLAY_STATE)? &pd[i] : NULL;
|
||||
}
|
||||
|
||||
|
||||
static void release_all(proxy_data *pd, unsigned int proxy_count)
|
||||
{
|
||||
unsigned int i;
|
||||
for(i=0; i<proxy_count; i++)
|
||||
pd[i].ps = PLAY_STATE;
|
||||
return;
|
||||
}
|
||||
|
||||
static void release_busy(proxy_data *pd, unsigned int proxy_count)
|
||||
{
|
||||
unsigned int i;
|
||||
for(i=0; i<proxy_count; i++)
|
||||
if(pd[i].ps == BUSY_STATE)
|
||||
pd[i].ps = PLAY_STATE;
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned int calc_alive(proxy_data *pd, unsigned int proxy_count)
|
||||
{
|
||||
unsigned int i;
|
||||
int alive_count=0;
|
||||
release_busy(pd, proxy_count);
|
||||
for(i=0; i<proxy_count; i++)
|
||||
if(pd[i].ps == PLAY_STATE)
|
||||
alive_count++;
|
||||
return alive_count;
|
||||
}
|
||||
|
||||
|
||||
static int chain_step(int ns, proxy_data *pfrom, proxy_data *pto)
|
||||
{
|
||||
int retcode=-1;
|
||||
char* hostname;
|
||||
#ifdef DEBUG
|
||||
PDEBUG("chain_step()\n");
|
||||
#endif
|
||||
if(pto->ip.octet[0] == 224) {
|
||||
hostname = string_from_internal_ip(pto->ip);
|
||||
if(!hostname) goto usenumericip;
|
||||
} else {
|
||||
usenumericip:
|
||||
hostname = inet_ntoa(*(struct in_addr*)&pto->ip);
|
||||
}
|
||||
|
||||
proxychains_write_log(TP" %s:%d ",
|
||||
hostname,
|
||||
htons(pto->port));
|
||||
retcode =
|
||||
tunnel_to(ns, pto->ip, pto->port, pfrom->pt, pfrom->user,
|
||||
pfrom->pass);
|
||||
switch(retcode) {
|
||||
case SUCCESS:
|
||||
pto->ps=BUSY_STATE;
|
||||
break;
|
||||
case BLOCKED:
|
||||
pto->ps=BLOCKED_STATE;
|
||||
proxychains_write_log("<--denied\n");
|
||||
close(ns);
|
||||
break;
|
||||
case SOCKET_ERROR:
|
||||
pto->ps=DOWN_STATE;
|
||||
proxychains_write_log("<--timeout\n");
|
||||
close(ns);
|
||||
break;
|
||||
}
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int connect_proxy_chain( int sock, ip_type target_ip,
|
||||
unsigned short target_port, proxy_data *pd,
|
||||
unsigned int proxy_count, chain_type ct, unsigned int max_chain )
|
||||
{
|
||||
proxy_data p4;
|
||||
proxy_data *p1,*p2,*p3;
|
||||
int ns=-1;
|
||||
unsigned int offset=0;
|
||||
unsigned int alive_count=0;
|
||||
unsigned int curr_len=0;
|
||||
|
||||
p3=&p4;
|
||||
#ifdef DEBUG
|
||||
PDEBUG("connect_proxy_chain\n");
|
||||
#endif
|
||||
|
||||
again:
|
||||
|
||||
switch(ct) {
|
||||
case DYNAMIC_TYPE:
|
||||
alive_count = calc_alive(pd,proxy_count);
|
||||
offset = 0;
|
||||
do {
|
||||
if(!(p1=select_proxy(FIFOLY,pd,proxy_count,&offset)))
|
||||
goto error_more;
|
||||
} while(SUCCESS!=start_chain(&ns,p1,DT) && offset < proxy_count);
|
||||
for(;;) {
|
||||
p2=select_proxy(FIFOLY,pd,proxy_count,&offset);
|
||||
if(!p2)
|
||||
break;
|
||||
if(SUCCESS!=chain_step(ns,p1,p2)) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("GOTO AGAIN 1\n");
|
||||
#endif
|
||||
goto again;
|
||||
}
|
||||
p1=p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS != chain_step(ns, p1, p3))
|
||||
goto error;
|
||||
break;
|
||||
|
||||
case STRICT_TYPE:
|
||||
alive_count = calc_alive(pd, proxy_count);
|
||||
offset = 0;
|
||||
if(!(p1=select_proxy(FIFOLY, pd, proxy_count, &offset))) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("select_proxy failed\n");
|
||||
#endif
|
||||
goto error_strict;
|
||||
}
|
||||
if(SUCCESS!=start_chain(&ns, p1, ST)) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("start_chain failed\n");
|
||||
#endif
|
||||
goto error_strict;
|
||||
}
|
||||
while(offset < proxy_count) {
|
||||
if(!(p2 = select_proxy(FIFOLY, pd, proxy_count, &offset)))
|
||||
break;
|
||||
if(SUCCESS!=chain_step(ns, p1, p2)) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("chain_step failed\n");
|
||||
#endif
|
||||
goto error_strict;
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS!=chain_step(ns, p1, p3))
|
||||
goto error;
|
||||
break;
|
||||
|
||||
case RANDOM_TYPE:
|
||||
alive_count=calc_alive(pd,proxy_count);
|
||||
if(alive_count<max_chain)
|
||||
goto error_more;
|
||||
curr_len=offset=0;
|
||||
do {
|
||||
if(!(p1=select_proxy(RANDOMLY,pd,proxy_count,&offset)))
|
||||
goto error_more;
|
||||
} while(SUCCESS!=start_chain(&ns,p1,RT) && offset<max_chain);
|
||||
while(++curr_len<max_chain) {
|
||||
if(!(p2=select_proxy(RANDOMLY,pd,proxy_count,&offset)))
|
||||
goto error_more;
|
||||
if(SUCCESS!=chain_step(ns, p1, p2)) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("GOTO AGAIN 2\n");
|
||||
#endif
|
||||
goto again;
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS!=chain_step(ns,p1,p3))
|
||||
goto error;
|
||||
|
||||
}
|
||||
|
||||
proxychains_write_log(TP" OK\n");
|
||||
dup2(ns,sock);
|
||||
close(ns);
|
||||
return 0;
|
||||
error:
|
||||
if(ns!=-1)
|
||||
close(ns);
|
||||
errno = ECONNREFUSED; // for nmap ;)
|
||||
return -1;
|
||||
|
||||
error_more:
|
||||
proxychains_write_log("\n!!!need more proxies!!!\n");
|
||||
error_strict:
|
||||
#ifdef DEBUG
|
||||
PDEBUG("error\n");
|
||||
#endif
|
||||
release_all(pd,proxy_count);
|
||||
if(ns!=-1)
|
||||
close(ns);
|
||||
errno = ETIMEDOUT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: all those buffers aren't threadsafe, but since no memory allocation happens there shouldnt be any segfaults
|
||||
static struct hostent hostent_space;
|
||||
static in_addr_t resolved_addr;
|
||||
static char* resolved_addr_p[2];
|
||||
static char addr_name[1024*8];
|
||||
static const ip_type local_host = {{127, 0, 0, 1}};
|
||||
struct hostent* proxy_gethostbyname(const char *name)
|
||||
{
|
||||
char buff[256];
|
||||
uint32_t i, hash;
|
||||
// yep, new_mem never gets freed. once you passed a fake ip to the client, you can't "retreat" it
|
||||
void* new_mem;
|
||||
size_t l;
|
||||
|
||||
struct hostent* hp;
|
||||
|
||||
resolved_addr_p[0] = (char*) &resolved_addr;
|
||||
resolved_addr_p[1] = NULL;
|
||||
|
||||
hostent_space.h_addr_list = resolved_addr_p;
|
||||
|
||||
resolved_addr = 0;
|
||||
|
||||
gethostname(buff,sizeof(buff));
|
||||
|
||||
if(!strcmp(buff, name)) {
|
||||
resolved_addr = inet_addr(buff);
|
||||
if (resolved_addr == (in_addr_t) (-1))
|
||||
resolved_addr = (in_addr_t) (local_host.as_int);
|
||||
return &hostent_space;
|
||||
}
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
while ((hp=gethostent()))
|
||||
if (!strcmp(hp->h_name,name))
|
||||
return hp;
|
||||
|
||||
|
||||
hash = dalias_hash((char*) name);
|
||||
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_lock(&internal_ips_lock);
|
||||
#endif
|
||||
|
||||
// see if we already have this dns entry saved.
|
||||
if(internal_ips.counter) {
|
||||
for( i = 0; i < internal_ips.counter; i++) {
|
||||
if(internal_ips.list[i]->hash == hash && !strcmp(name, internal_ips.list[i]->string)) {
|
||||
resolved_addr = make_internal_ip(i);
|
||||
PDEBUG("got cached ip for %s\n", name);
|
||||
goto have_ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// grow list if needed.
|
||||
if(internal_ips.capa < internal_ips.counter + 1) {
|
||||
PDEBUG("realloc\n");
|
||||
new_mem = realloc(internal_ips.list, (internal_ips.capa + 16) * sizeof(void*));
|
||||
if(new_mem) {
|
||||
internal_ips.capa += 16;
|
||||
internal_ips.list = new_mem;
|
||||
} else {
|
||||
oom:
|
||||
proxychains_write_log("out of mem\n");
|
||||
goto err_plus_unlock;
|
||||
}
|
||||
}
|
||||
|
||||
resolved_addr = make_internal_ip(internal_ips.counter);
|
||||
if(resolved_addr == (in_addr_t) -1) goto err_plus_unlock;
|
||||
|
||||
l = strlen(name);
|
||||
new_mem = malloc(sizeof(string_hash_tuple) + l + 1);
|
||||
if(!new_mem)
|
||||
goto oom;
|
||||
|
||||
PDEBUG("creating new entry %d for ip of %s\n", (int) internal_ips.counter, name);
|
||||
|
||||
internal_ips.list[internal_ips.counter] = new_mem;
|
||||
internal_ips.list[internal_ips.counter]->hash = hash;
|
||||
internal_ips.list[internal_ips.counter]->string = (char*) new_mem + sizeof(string_hash_tuple);
|
||||
|
||||
memcpy(internal_ips.list[internal_ips.counter]->string, name, l + 1);
|
||||
|
||||
internal_ips.counter += 1;
|
||||
|
||||
have_ip:
|
||||
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_unlock(&internal_ips_lock);
|
||||
#endif
|
||||
|
||||
|
||||
strncpy(addr_name, name, sizeof(addr_name));
|
||||
|
||||
hostent_space.h_name = addr_name;
|
||||
hostent_space.h_length = sizeof (in_addr_t);
|
||||
return &hostent_space;
|
||||
|
||||
err_plus_unlock:
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_unlock(&internal_ips_lock);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
int proxy_getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res)
|
||||
{
|
||||
struct servent *se = NULL;
|
||||
struct hostent *hp = NULL;
|
||||
struct sockaddr* sockaddr_space = NULL;
|
||||
struct addrinfo* addrinfo_space = NULL;
|
||||
|
||||
// printf("proxy_getaddrinfo node %s service %s\n",node,service);
|
||||
addrinfo_space = malloc(sizeof(struct addrinfo));
|
||||
if(!addrinfo_space)
|
||||
goto err1;
|
||||
sockaddr_space = malloc(sizeof(struct sockaddr));
|
||||
if(!sockaddr_space)
|
||||
goto err2;
|
||||
memset(sockaddr_space, 0, sizeof(*sockaddr_space));
|
||||
memset(addrinfo_space, 0, sizeof(*addrinfo_space));
|
||||
if (node &&
|
||||
!inet_aton(node,&((struct sockaddr_in*)sockaddr_space)->sin_addr)) {
|
||||
hp = proxy_gethostbyname(node);
|
||||
if (hp)
|
||||
memcpy(&((struct sockaddr_in*)sockaddr_space)->sin_addr,
|
||||
*(hp->h_addr_list),
|
||||
sizeof(in_addr_t));
|
||||
else
|
||||
goto err3;
|
||||
}
|
||||
if (service)
|
||||
se = getservbyname(service, NULL);
|
||||
|
||||
if (!se) {
|
||||
((struct sockaddr_in*)sockaddr_space)->sin_port =
|
||||
htons(atoi(service?:"0"));
|
||||
} else
|
||||
((struct sockaddr_in*)sockaddr_space)->sin_port = se->s_port;
|
||||
|
||||
*res = addrinfo_space;
|
||||
(*res)->ai_addr = sockaddr_space;
|
||||
if (node)
|
||||
strcpy(addr_name, node);
|
||||
(*res)->ai_canonname = addr_name;
|
||||
(*res)->ai_next = NULL;
|
||||
(*res)->ai_family = sockaddr_space->sa_family = AF_INET;
|
||||
(*res)->ai_socktype = hints->ai_socktype;
|
||||
(*res)->ai_flags = hints->ai_flags;
|
||||
(*res)->ai_protocol = hints->ai_protocol;
|
||||
(*res)->ai_addrlen = sizeof(*sockaddr_space);
|
||||
goto out;
|
||||
err3:
|
||||
free(sockaddr_space);
|
||||
err2:
|
||||
free(addrinfo_space);
|
||||
err1:
|
||||
return 1;
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
/***************************************************************************
|
||||
core.h - description
|
||||
-------------------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
#include <stdint.h>
|
||||
/* GPL */
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef __CORE_HEADER
|
||||
#define __CORE_HEADER
|
||||
#define BUFF_SIZE 8*1024 // used to read responses from proxies.
|
||||
#define MAX_LOCALNET 1024
|
||||
|
||||
typedef union {
|
||||
unsigned char octet[4];
|
||||
uint32_t as_int;
|
||||
} ip_type;
|
||||
|
||||
typedef struct {
|
||||
uint32_t hash;
|
||||
char* string;
|
||||
} string_hash_tuple;
|
||||
|
||||
typedef struct {
|
||||
uint32_t counter;
|
||||
uint32_t capa;
|
||||
string_hash_tuple** list;
|
||||
} internal_ip_lookup_table;
|
||||
|
||||
extern internal_ip_lookup_table internal_ips;
|
||||
#ifdef THREAD_SAFE
|
||||
#include <pthread.h>
|
||||
extern pthread_mutex_t internal_ips_lock;
|
||||
#endif
|
||||
|
||||
/*error codes*/
|
||||
typedef enum {
|
||||
SUCCESS=0,
|
||||
MEMORY_FAIL, // malloc failed
|
||||
SOCKET_ERROR, // look errno for more
|
||||
CHAIN_DOWN, // no proxy in chain responds to tcp
|
||||
CHAIN_EMPTY, // if proxy_count = 0
|
||||
BLOCKED // target's port blocked on last proxy in the chain
|
||||
} ERR_CODE;
|
||||
|
||||
|
||||
typedef enum {
|
||||
HTTP_TYPE,
|
||||
SOCKS4_TYPE,
|
||||
SOCKS5_TYPE
|
||||
} proxy_type;
|
||||
|
||||
typedef enum {
|
||||
DYNAMIC_TYPE,
|
||||
STRICT_TYPE,
|
||||
RANDOM_TYPE}
|
||||
chain_type;
|
||||
|
||||
typedef enum {
|
||||
PLAY_STATE,
|
||||
DOWN_STATE,
|
||||
BLOCKED_STATE,
|
||||
BUSY_STATE
|
||||
} proxy_state;
|
||||
|
||||
typedef enum {
|
||||
RANDOMLY,
|
||||
FIFOLY
|
||||
} select_type;
|
||||
|
||||
typedef struct {
|
||||
struct in_addr in_addr, netmask;
|
||||
unsigned short port;
|
||||
} localaddr_arg;
|
||||
|
||||
typedef struct {
|
||||
ip_type ip;
|
||||
unsigned short port;
|
||||
proxy_type pt;
|
||||
proxy_state ps;
|
||||
char user[256];
|
||||
char pass[256];
|
||||
} proxy_data;
|
||||
|
||||
typedef struct {
|
||||
proxy_data *pd;
|
||||
chain_type ct;
|
||||
unsigned int proxy_count;
|
||||
int sock;
|
||||
struct sockaddr addr;
|
||||
int flags;
|
||||
} thread_arg;
|
||||
|
||||
int connect_proxy_chain (
|
||||
int sock,
|
||||
ip_type target_ip,
|
||||
unsigned short target_port,
|
||||
proxy_data * pd,
|
||||
unsigned int proxy_count,
|
||||
chain_type ct,
|
||||
unsigned int max_chain );
|
||||
|
||||
int proxychains_write_log(char *str,...);
|
||||
struct hostent* proxy_gethostbyname(const char *name);
|
||||
|
||||
|
||||
typedef int (*connect_t)(int, const struct sockaddr *, socklen_t);
|
||||
connect_t true_connect;
|
||||
|
||||
typedef struct hostent* (*gethostbyname_t)(const char *);
|
||||
gethostbyname_t true_gethostbyname;
|
||||
|
||||
typedef int (*getaddrinfo_t)(const char *, const char *,
|
||||
const struct addrinfo *,
|
||||
struct addrinfo **);
|
||||
getaddrinfo_t true_getaddrinfo;
|
||||
|
||||
typedef int (*freeaddrinfo_t)(struct addrinfo *);
|
||||
freeaddrinfo_t true_freeaddrinfo;
|
||||
|
||||
typedef int (*getnameinfo_t) (const struct sockaddr *,
|
||||
socklen_t, char *,
|
||||
socklen_t, char *,
|
||||
socklen_t, unsigned int);
|
||||
getnameinfo_t true_getnameinfo;
|
||||
|
||||
typedef struct hostent *(*gethostbyaddr_t) (const void *, socklen_t, int);
|
||||
gethostbyaddr_t true_gethostbyaddr;
|
||||
|
||||
int proxy_getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res);
|
||||
|
||||
struct hostent* proxy_gethostbyname(const char *name);
|
||||
|
||||
#ifdef DEBUG
|
||||
# define PDEBUG(fmt, args...) fprintf(stderr,"DEBUG:"fmt, ## args)
|
||||
#else
|
||||
# define PDEBUG(fmt, args...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,504 @@
|
||||
/***************************************************************************
|
||||
libproxychains.c - description
|
||||
-------------------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
/* GPL */
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#undef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
||||
#include "core.h"
|
||||
#include "common.h"
|
||||
|
||||
#define satosin(x) ((struct sockaddr_in *) &(x))
|
||||
#define SOCKADDR(x) (satosin(x)->sin_addr.s_addr)
|
||||
#define SOCKADDR_2(x) (satosin(x)->sin_addr)
|
||||
#define SOCKPORT(x) (satosin(x)->sin_port)
|
||||
#define SOCKFAMILY(x) (satosin(x)->sin_family)
|
||||
#define MAX_CHAIN 30*1024
|
||||
|
||||
int tcp_read_time_out;
|
||||
int tcp_connect_time_out;
|
||||
chain_type proxychains_ct;
|
||||
proxy_data proxychains_pd[MAX_CHAIN];
|
||||
unsigned int proxychains_proxy_count = 0;
|
||||
int proxychains_got_chain_data = 0;
|
||||
unsigned int proxychains_max_chain = 1;
|
||||
int proxychains_quiet_mode = 0;
|
||||
int proxychains_resolver = 0;
|
||||
static int init_l = 0;
|
||||
localaddr_arg localnet_addr[MAX_LOCALNET];
|
||||
size_t num_localnet_addr = 0;
|
||||
|
||||
static inline void get_chain_data(proxy_data *pd, unsigned int *proxy_count,
|
||||
chain_type *ct);
|
||||
static void init_lib(void);
|
||||
|
||||
static void init_lib(void)
|
||||
{
|
||||
#ifdef THREAD_SAFE
|
||||
pthread_mutex_init(&internal_ips_lock, NULL);
|
||||
#endif
|
||||
/* read the config file */
|
||||
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
|
||||
|
||||
proxychains_write_log(LOG_PREFIX "DLL init\n");
|
||||
|
||||
true_connect = (connect_t) dlsym(RTLD_NEXT, "connect");
|
||||
|
||||
if (!true_connect) {
|
||||
fprintf(stderr, "Cannot load symbol 'connect' %s\n", dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'connect'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_connect, connect);
|
||||
#endif
|
||||
}
|
||||
if(connect==true_connect) {
|
||||
#ifdef DEBUG
|
||||
PDEBUG("circular reference detected, aborting!\n");
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
||||
true_gethostbyname = (gethostbyname_t)
|
||||
dlsym(RTLD_NEXT, "gethostbyname");
|
||||
|
||||
if (!true_gethostbyname) {
|
||||
fprintf(stderr, "Cannot load symbol 'gethostbyname' %s\n",
|
||||
dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'gethostbyname'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_gethostbyname, gethostbyname);
|
||||
#endif
|
||||
}
|
||||
true_getaddrinfo = (getaddrinfo_t)
|
||||
dlsym(RTLD_NEXT, "getaddrinfo");
|
||||
|
||||
if (!true_getaddrinfo) {
|
||||
fprintf(stderr, "Cannot load symbol 'getaddrinfo' %s\n",
|
||||
dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'getaddrinfo'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_getaddrinfo, getaddrinfo);
|
||||
#endif
|
||||
}
|
||||
true_freeaddrinfo = (freeaddrinfo_t)
|
||||
dlsym(RTLD_NEXT, "freeaddrinfo");
|
||||
|
||||
if (!true_freeaddrinfo) {
|
||||
fprintf(stderr, "Cannot load symbol 'freeaddrinfo' %s\n",
|
||||
dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'freeaddrinfo'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_freeaddrinfo, freeaddrinfo);
|
||||
#endif
|
||||
}
|
||||
true_gethostbyaddr = (gethostbyaddr_t)
|
||||
dlsym(RTLD_NEXT, "gethostbyaddr");
|
||||
|
||||
if (!true_gethostbyaddr) {
|
||||
fprintf(stderr, "Cannot load symbol 'gethostbyaddr' %s\n",
|
||||
dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'gethostbyaddr'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_gethostbyaddr, gethostbyaddr);
|
||||
#endif
|
||||
}
|
||||
true_getnameinfo = (getnameinfo_t)
|
||||
dlsym(RTLD_NEXT, "getnameinfo");
|
||||
|
||||
if (!true_getnameinfo) {
|
||||
fprintf(stderr, "Cannot load symbol 'getnameinfo' %s\n",
|
||||
dlerror());
|
||||
exit(1);
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
PDEBUG( "loaded symbol 'getnameinfo'"
|
||||
" real addr %p wrapped addr %p\n",
|
||||
true_getnameinfo, getnameinfo);
|
||||
#endif
|
||||
}
|
||||
init_l = 1;
|
||||
}
|
||||
|
||||
static inline void get_chain_data(
|
||||
proxy_data *pd,
|
||||
unsigned int *proxy_count,
|
||||
chain_type *ct)
|
||||
{
|
||||
int count=0,port_n=0,list=0;
|
||||
char buff[1024],type[1024],host[1024],user[1024];
|
||||
char *env;
|
||||
char local_in_addr_port[32];
|
||||
char local_in_addr[32], local_in_port[32], local_netmask[32];
|
||||
FILE* file;
|
||||
|
||||
if(proxychains_got_chain_data)
|
||||
return;
|
||||
|
||||
//Some defaults
|
||||
tcp_read_time_out = 4*1000;
|
||||
tcp_connect_time_out = 10*1000;
|
||||
*ct = DYNAMIC_TYPE;
|
||||
|
||||
/*
|
||||
* Get path to configuration file from env this file has priority
|
||||
* if it's defined.
|
||||
*/
|
||||
env = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR);
|
||||
|
||||
snprintf(buff,256,"%s/.proxychains/proxychains.conf",getenv("HOME"));
|
||||
|
||||
if(!env || (!(file=fopen(env,"r"))))
|
||||
if(!(file=fopen("./proxychains.conf","r")))
|
||||
if(!(file=fopen(buff,"r")))
|
||||
if(!(file=fopen("/etc/proxychains.conf","r")))
|
||||
{
|
||||
perror("Can't locate proxychains.conf");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
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," ")]!='#') {
|
||||
if(list) {
|
||||
memset(&pd[count], 0, sizeof(proxy_data));
|
||||
|
||||
pd[count].ps = PLAY_STATE;
|
||||
port_n = 0;
|
||||
|
||||
sscanf(buff,"%s %s %d %s %s", type, host, &port_n,
|
||||
pd[count].user, pd[count].pass);
|
||||
|
||||
pd[count].ip.as_int = (uint32_t) inet_addr(host);
|
||||
pd[count].port = htons((unsigned short)port_n);
|
||||
|
||||
if(!strcmp(type,"http")) {
|
||||
pd[count].pt = HTTP_TYPE;
|
||||
} else if(!strcmp(type,"socks4")) {
|
||||
pd[count].pt = SOCKS4_TYPE;
|
||||
} else if(!strcmp(type,"socks5")) {
|
||||
pd[count].pt = SOCKS5_TYPE;
|
||||
} else
|
||||
continue;
|
||||
|
||||
if(pd[count].ip.as_int && port_n &&
|
||||
pd[count].ip.as_int != (uint32_t) -1)
|
||||
if(++count==MAX_CHAIN)
|
||||
break;
|
||||
} else {
|
||||
if(strstr(buff,"[ProxyList]")) {
|
||||
list=1;
|
||||
} else if(strstr(buff,"random_chain")) {
|
||||
*ct=RANDOM_TYPE;
|
||||
} else if(strstr(buff,"strict_chain")) {
|
||||
*ct=STRICT_TYPE;
|
||||
} else if(strstr(buff,"dynamic_chain")) {
|
||||
*ct=DYNAMIC_TYPE;
|
||||
} else if(strstr(buff,"tcp_read_time_out")){
|
||||
sscanf(buff,"%s %d",user,&tcp_read_time_out) ;
|
||||
} else if(strstr(buff,"tcp_connect_time_out")){
|
||||
sscanf(buff,"%s %d",user,&tcp_connect_time_out) ;
|
||||
} else if(strstr(buff,"localnet")) {
|
||||
if (sscanf(buff,"%s %21[^/]/%15s", user,
|
||||
local_in_addr_port, local_netmask) < 3) {
|
||||
fprintf(stderr, "localnet format error");
|
||||
exit(1);
|
||||
}
|
||||
/* clean previously used buffer */
|
||||
memset(local_in_port, 0,
|
||||
sizeof(local_in_port) / sizeof(local_in_port[0]));
|
||||
|
||||
if (sscanf(local_in_addr_port, "%15[^:]:%5s",
|
||||
local_in_addr, local_in_port) < 2) {
|
||||
PDEBUG("added localnet: netaddr=%s, port=%s\n",
|
||||
local_in_addr, local_netmask);
|
||||
} else {
|
||||
PDEBUG("added localnet: netaddr=%s, port=%s, netmask=%s\n",
|
||||
local_in_addr, local_in_port, local_netmask);
|
||||
}
|
||||
if (num_localnet_addr < MAX_LOCALNET)
|
||||
{
|
||||
int error;
|
||||
error = inet_pton(AF_INET, local_in_addr, &localnet_addr[num_localnet_addr].in_addr);
|
||||
if (error <= 0)
|
||||
{
|
||||
fprintf(stderr, "localnet address error\n");
|
||||
exit(1);
|
||||
}
|
||||
error = inet_pton(AF_INET, local_netmask, &localnet_addr[num_localnet_addr].netmask);
|
||||
if (error <= 0)
|
||||
{
|
||||
fprintf(stderr, "localnet netmask error\n");
|
||||
exit(1);
|
||||
}
|
||||
if (local_in_port[0]) {
|
||||
localnet_addr[num_localnet_addr].port = (short)atoi(local_in_port);
|
||||
} else {
|
||||
localnet_addr[num_localnet_addr].port = 0;
|
||||
}
|
||||
++num_localnet_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "# of localnet exceed %d.\n", MAX_LOCALNET);
|
||||
}
|
||||
} else if(strstr(buff,"chain_len")){
|
||||
char *pc;int len;
|
||||
pc=strchr(buff,'=');
|
||||
len=atoi(++pc);
|
||||
proxychains_max_chain=(len?len:1);
|
||||
} else if(strstr(buff,"quiet_mode")){
|
||||
proxychains_quiet_mode=1;
|
||||
} else if(strstr(buff,"proxy_dns")){
|
||||
proxychains_resolver=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
*proxy_count = count;
|
||||
proxychains_got_chain_data = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int connect (int sock, const struct sockaddr *addr, unsigned int len)
|
||||
{
|
||||
int socktype=0, flags=0, ret=0;
|
||||
socklen_t optlen = 0;
|
||||
ip_type dest_ip;
|
||||
#ifdef DEBUG
|
||||
char str[256];
|
||||
#endif
|
||||
struct in_addr *p_addr_in;
|
||||
unsigned short port;
|
||||
size_t i;
|
||||
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
optlen=sizeof(socktype);
|
||||
getsockopt(sock,SOL_SOCKET,SO_TYPE,&socktype,&optlen);
|
||||
if (! (SOCKFAMILY(*addr)==AF_INET && socktype==SOCK_STREAM))
|
||||
return true_connect(sock,addr,len);
|
||||
|
||||
p_addr_in = &((struct sockaddr_in *)addr)->sin_addr;
|
||||
port = ntohs(((struct sockaddr_in *)addr)->sin_port);
|
||||
|
||||
#ifdef DEBUG
|
||||
// PDEBUG("localnet: %s; ", inet_ntop(AF_INET,&in_addr_localnet, str, sizeof(str)));
|
||||
// PDEBUG("netmask: %s; " , inet_ntop(AF_INET, &in_addr_netmask, str, sizeof(str)));
|
||||
PDEBUG("target: %s\n", inet_ntop(AF_INET, p_addr_in, str, sizeof(str)));
|
||||
PDEBUG("port: %d\n", port);
|
||||
#endif
|
||||
for (i = 0; i < num_localnet_addr; 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))
|
||||
{
|
||||
if (localnet_addr[i].port || localnet_addr[i].port == port) {
|
||||
PDEBUG("accessing localnet using true_connect\n");
|
||||
return true_connect(sock,addr,len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flags = fcntl(sock, F_GETFL, 0);
|
||||
if(flags & O_NONBLOCK)
|
||||
fcntl(sock, F_SETFL, !O_NONBLOCK);
|
||||
|
||||
dest_ip.as_int = SOCKADDR(*addr);
|
||||
|
||||
ret = connect_proxy_chain(
|
||||
sock,
|
||||
dest_ip,
|
||||
SOCKPORT(*addr),
|
||||
proxychains_pd,
|
||||
proxychains_proxy_count,
|
||||
proxychains_ct,
|
||||
proxychains_max_chain );
|
||||
|
||||
fcntl(sock, F_SETFL, flags);
|
||||
if(ret != SUCCESS)
|
||||
errno = ECONNREFUSED;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct hostent *gethostbyname(const char *name)
|
||||
{
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
|
||||
PDEBUG("gethostbyname: %s\n",name);
|
||||
|
||||
if(proxychains_resolver)
|
||||
return proxy_gethostbyname(name);
|
||||
else
|
||||
return true_gethostbyname(name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int getaddrinfo(const char *node, const char *service,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
|
||||
PDEBUG("getaddrinfo: %s %s\n",node ,service);
|
||||
|
||||
if(proxychains_resolver)
|
||||
ret = proxy_getaddrinfo(node, service, hints, res);
|
||||
else
|
||||
ret = true_getaddrinfo(node, service, hints, res);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void freeaddrinfo(struct addrinfo *res)
|
||||
{
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
|
||||
PDEBUG("freeaddrinfo %p \n",res);
|
||||
|
||||
if(!proxychains_resolver)
|
||||
true_freeaddrinfo(res);
|
||||
else {
|
||||
free(res->ai_addr);
|
||||
free(res);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// work around a buggy prototype in GLIBC. according to the bugtracker it has been fixed in git at 02 May 2011.
|
||||
// 2.14 came out in June 2011 so that should be the first fixed version
|
||||
#if defined(__GLIBC__) && (__GLIBC__ < 3) && (__GLIBC_MINOR__ < 14)
|
||||
int getnameinfo (const struct sockaddr * sa,
|
||||
socklen_t salen, char * host,
|
||||
socklen_t hostlen, char * serv,
|
||||
socklen_t servlen, unsigned int flags)
|
||||
#else
|
||||
int getnameinfo (const struct sockaddr * sa,
|
||||
socklen_t salen, char * host,
|
||||
socklen_t hostlen, char * serv,
|
||||
socklen_t servlen, int flags)
|
||||
#endif
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
|
||||
PDEBUG("getnameinfo: %s %s\n", host, serv);
|
||||
|
||||
if(!proxychains_resolver) {
|
||||
ret = true_getnameinfo(sa,salen,host,hostlen,
|
||||
serv,servlen,flags);
|
||||
} else {
|
||||
if(hostlen)
|
||||
strncpy(host, inet_ntoa(SOCKADDR_2(*sa)),hostlen);
|
||||
if(servlen)
|
||||
snprintf(serv, servlen,"%d",ntohs(SOCKPORT(*sa)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// stolen from libulz (C) rofl0r
|
||||
static void pc_stringfromipv4(unsigned char* ip_buf_4_bytes, char* outbuf_16_bytes) {
|
||||
unsigned char* p;
|
||||
char *o = outbuf_16_bytes;
|
||||
unsigned char n;
|
||||
for(p = ip_buf_4_bytes; p < ip_buf_4_bytes + 4; p++) {
|
||||
n = *p;
|
||||
if(*p >= 100) {
|
||||
if(*p >= 200) *(o++) = '2';
|
||||
else *(o++) = '1';
|
||||
n %= 100;
|
||||
}
|
||||
if(*p >= 10) {
|
||||
*(o++) = (n / 10) + '0';
|
||||
n %= 10;
|
||||
}
|
||||
*(o++) = n + '0';
|
||||
*(o++) = '.';
|
||||
}
|
||||
o[-1] = 0;
|
||||
}
|
||||
|
||||
struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
|
||||
{
|
||||
static char buf[16];
|
||||
static char ipv4[4];
|
||||
static char* list[2];
|
||||
static struct hostent he;
|
||||
|
||||
if(!init_l)
|
||||
init_lib();
|
||||
|
||||
PDEBUG("TODO: proper gethostbyaddr hook\n");
|
||||
|
||||
if(!proxychains_resolver)
|
||||
return true_gethostbyaddr(addr,len,type);
|
||||
else {
|
||||
|
||||
PDEBUG("len %u\n", len);
|
||||
if(len != 4) return NULL;
|
||||
he.h_name = buf;
|
||||
memcpy(ipv4, addr, 4);
|
||||
list[0] = ipv4;
|
||||
list[1] = NULL;
|
||||
he.h_addr_list = list;
|
||||
he.h_addrtype = AF_INET;
|
||||
he.h_aliases = NULL;
|
||||
he.h_length = 4;
|
||||
pc_stringfromipv4((unsigned char*)addr, buf);
|
||||
return &he;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
/***************************************************************************
|
||||
main.c - description
|
||||
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
/* GPL */
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 700
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
#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]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int check_path(char* path) {
|
||||
if(!path) return 0;
|
||||
return access(path, R_OK) != -1;
|
||||
}
|
||||
|
||||
static const char* dll_name = "libproxychains4.so";
|
||||
|
||||
static char own_dir[256];
|
||||
static const char* dll_dirs[] = {
|
||||
".",
|
||||
own_dir,
|
||||
LIB_DIR,
|
||||
"/lib",
|
||||
"/usr/lib",
|
||||
"/usr/local/lib",
|
||||
"/lib64",
|
||||
NULL
|
||||
};
|
||||
|
||||
static void set_own_dir(const char* argv0) {
|
||||
size_t l = strlen(argv0);
|
||||
while(l && argv0[l - 1] != '/') l--;
|
||||
if(l == 0)
|
||||
memcpy(own_dir, ".", 2);
|
||||
else {
|
||||
memcpy(own_dir, argv0, l - 1);
|
||||
own_dir[l] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *path = NULL;
|
||||
char buf[256];
|
||||
char pbuf[256];
|
||||
int opt;
|
||||
int start_argv = 1;
|
||||
int quiet = 0;
|
||||
|
||||
if(argc == 1) return usage(argv);
|
||||
|
||||
while ((opt = getopt(argc, argv, "qf:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
start_argv++;
|
||||
break;
|
||||
case 'f':
|
||||
path = (char *)optarg;
|
||||
if(!path) {
|
||||
fprintf(stderr, "error: no path supplied.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
start_argv += 2;
|
||||
break;
|
||||
default: /* '?' */
|
||||
return usage(argv);
|
||||
}
|
||||
}
|
||||
|
||||
if(start_argv >= argc) return usage(argv);
|
||||
|
||||
/* check if path of config file has not been passed via command line */
|
||||
if(!path) {
|
||||
// priority 1: env var PROXYCHAINS_CONF_FILE
|
||||
path = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR);
|
||||
if(check_path(path)) goto have;
|
||||
|
||||
// priority 2; proxychains conf in actual dir
|
||||
path = getcwd(buf, sizeof(buf));
|
||||
snprintf(pbuf, sizeof(pbuf), "%s/%s", path, PROXYCHAINS_CONF_FILE);
|
||||
path = pbuf;
|
||||
if(check_path(path)) goto have;
|
||||
|
||||
// priority 3; $HOME/.proxychains/proxychains.conf
|
||||
path = getenv("HOME");
|
||||
snprintf(pbuf, sizeof(pbuf), "%s/.proxychains/%s", path, PROXYCHAINS_CONF_FILE);
|
||||
path = pbuf;
|
||||
if(check_path(path)) goto have;
|
||||
|
||||
// priority 4: /etc/proxychains.conf
|
||||
path = "/etc/proxychains.conf";
|
||||
if(check_path(path)) goto have;
|
||||
perror("couldnt find configuration file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
have:
|
||||
|
||||
if(!quiet) fprintf(stderr, LOG_PREFIX "config file found: %s\n", path);
|
||||
|
||||
/* Set PROXYCHAINS_CONF_FILE to get proxychains lib to use new config file. */
|
||||
setenv(PROXYCHAINS_CONF_FILE_ENV_VAR, path, 1);
|
||||
|
||||
if(quiet) setenv(PROXYCHAINS_QUIET_MODE_ENV_VAR, "1", 1);
|
||||
|
||||
|
||||
// search DLL
|
||||
size_t i = 0;
|
||||
const char* prefix = NULL;
|
||||
|
||||
set_own_dir(argv[0]);
|
||||
|
||||
while(dll_dirs[i]) {
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dll_dirs[i], dll_name);
|
||||
if(access(buf, R_OK) != -1) {
|
||||
prefix = dll_dirs[i];
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if(!prefix) {
|
||||
fprintf(stderr, "couldnt locate %s\n", dll_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if(!quiet) fprintf(stderr, LOG_PREFIX "preloading %s/%s\n", prefix, dll_name);
|
||||
|
||||
snprintf(buf, sizeof(buf), "LD_PRELOAD=%s/%s", prefix, dll_name);
|
||||
|
||||
putenv(buf);
|
||||
execvp(argv[start_argv], &argv[start_argv]);
|
||||
perror("proxychains can't load process....");
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
echo "ProxyChains-3.1 (http://proxychains.sf.net)"
|
||||
|
||||
usage() {
|
||||
|
||||
echo " usage:"
|
||||
echo " $0 [h] [f config-file] <prog> [args]"
|
||||
exit
|
||||
}
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ $1 = "-h" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$1" = "-f" ]; then
|
||||
export PROXYCHAINS_CONF_FILE=$2;
|
||||
shift;
|
||||
shift;
|
||||
fi
|
||||
|
||||
export LD_PRELOAD=libproxychains.so.3
|
||||
exec "$@"
|
||||
@@ -0,0 +1,75 @@
|
||||
# proxychains.conf VER 3.1
|
||||
#
|
||||
# HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
|
||||
#
|
||||
|
||||
# The option below identifies how the ProxyList is treated.
|
||||
# only one option should be uncommented at time,
|
||||
# otherwise the last appearing option will be accepted
|
||||
#
|
||||
#dynamic_chain
|
||||
#
|
||||
# Dynamic - Each connection will be done via chained proxies
|
||||
# all proxies chained in the order as they appear in the list
|
||||
# at least one proxy must be online to play in chain
|
||||
# (dead proxies are skipped)
|
||||
# otherwise EINTR is returned to the app
|
||||
#
|
||||
strict_chain
|
||||
#
|
||||
# Strict - Each connection will be done via chained proxies
|
||||
# all proxies chained in the order as they appear in the list
|
||||
# all proxies must be online to play in chain
|
||||
# otherwise EINTR is returned to the app
|
||||
#
|
||||
#random_chain
|
||||
#
|
||||
# Random - Each connection will be done via random proxy
|
||||
# (or proxy chain, see chain_len) from the list.
|
||||
# this option is good to test your IDS :)
|
||||
|
||||
# Make sense only if random_chain
|
||||
#chain_len = 2
|
||||
|
||||
# Quiet mode (no output from library)
|
||||
#quiet_mode
|
||||
|
||||
# Proxy DNS requests - no leak for DNS data
|
||||
proxy_dns
|
||||
|
||||
# Some timeouts in milliseconds
|
||||
tcp_read_time_out 15000
|
||||
tcp_connect_time_out 8000
|
||||
|
||||
# Example for localnet exclusion
|
||||
## Exclude connections to 192.168.1.0/24 with port 80
|
||||
# localnet 192.168.1.0:80/255.255.255.0
|
||||
|
||||
## Exclude connections to 192.168.100.0/24
|
||||
# localnet 192.168.100.0/255.255.255.0
|
||||
|
||||
## Exclude connections to ANYwhere with port 80
|
||||
# localnet 0.0.0.0:80/0.0.0.0
|
||||
|
||||
# ProxyList format
|
||||
# type host port [user pass]
|
||||
# (values separated by 'tab' or 'blank')
|
||||
#
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# socks5 192.168.67.78 1080 lamer secret
|
||||
# http 192.168.89.3 8080 justu hidden
|
||||
# socks4 192.168.1.49 1080
|
||||
# http 192.168.39.93 8080
|
||||
#
|
||||
#
|
||||
# proxy types: http, socks4, socks5
|
||||
# ( auth types supported: "basic"-http "user/pass"-socks )
|
||||
#
|
||||
[ProxyList]
|
||||
# add proxy here ...
|
||||
# meanwile
|
||||
# defaults set to "tor"
|
||||
socks4 127.0.0.1 9050
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# This script is called by proxychains to resolve DNS names
|
||||
|
||||
# DNS server used to resolve names
|
||||
DNS_SERVER=4.2.2.2
|
||||
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
echo " usage:"
|
||||
echo " proxyresolv <hostname> "
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
export LD_PRELOAD=libproxychains.so
|
||||
dig $1 @$DNS_SERVER +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
|
||||
@@ -1,70 +0,0 @@
|
||||
.highlight .hll { background-color: #ffffcc }
|
||||
.highlight { background: #f0f3f3; }
|
||||
.highlight .c { color: #0099FF; font-style: italic } /* Comment */
|
||||
.highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */
|
||||
.highlight .k { color: #006699; font-weight: bold } /* Keyword */
|
||||
.highlight .o { color: #555555 } /* Operator */
|
||||
.highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
|
||||
.highlight .cp { color: #009999 } /* Comment.Preproc */
|
||||
.highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */
|
||||
.highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||
.highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
|
||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
||||
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
||||
.highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */
|
||||
.highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
|
||||
.highlight .go { color: #AAAAAA } /* Generic.Output */
|
||||
.highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */
|
||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||
.highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */
|
||||
.highlight .gt { color: #99CC66 } /* Generic.Traceback */
|
||||
.highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */
|
||||
.highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */
|
||||
.highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */
|
||||
.highlight .kp { color: #006699 } /* Keyword.Pseudo */
|
||||
.highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */
|
||||
.highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */
|
||||
.highlight .m { color: #FF6600 } /* Literal.Number */
|
||||
.highlight .s { color: #CC3300 } /* Literal.String */
|
||||
.highlight .na { color: #330099 } /* Name.Attribute */
|
||||
.highlight .nb { color: #336666 } /* Name.Builtin */
|
||||
.highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */
|
||||
.highlight .no { color: #336600 } /* Name.Constant */
|
||||
.highlight .nd { color: #9999FF } /* Name.Decorator */
|
||||
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
|
||||
.highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */
|
||||
.highlight .nf { color: #CC00FF } /* Name.Function */
|
||||
.highlight .nl { color: #9999FF } /* Name.Label */
|
||||
.highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */
|
||||
.highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */
|
||||
.highlight .nv { color: #003333 } /* Name.Variable */
|
||||
.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
|
||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.highlight .mf { color: #FF6600 } /* Literal.Number.Float */
|
||||
.highlight .mh { color: #FF6600 } /* Literal.Number.Hex */
|
||||
.highlight .mi { color: #FF6600 } /* Literal.Number.Integer */
|
||||
.highlight .mo { color: #FF6600 } /* Literal.Number.Oct */
|
||||
.highlight .sb { color: #CC3300 } /* Literal.String.Backtick */
|
||||
.highlight .sc { color: #CC3300 } /* Literal.String.Char */
|
||||
.highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
|
||||
.highlight .s2 { color: #CC3300 } /* Literal.String.Double */
|
||||
.highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */
|
||||
.highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */
|
||||
.highlight .si { color: #AA0000 } /* Literal.String.Interpol */
|
||||
.highlight .sx { color: #CC3300 } /* Literal.String.Other */
|
||||
.highlight .sr { color: #33AAAA } /* Literal.String.Regex */
|
||||
.highlight .s1 { color: #CC3300 } /* Literal.String.Single */
|
||||
.highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */
|
||||
.highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */
|
||||
.highlight .vc { color: #003333 } /* Name.Variable.Class */
|
||||
.highlight .vg { color: #003333 } /* Name.Variable.Global */
|
||||
.highlight .vi { color: #003333 } /* Name.Variable.Instance */
|
||||
.highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */
|
||||
|
||||
.type-csharp .highlight .k { color: #0000FF }
|
||||
.type-csharp .highlight .kt { color: #0000FF }
|
||||
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
|
||||
.type-csharp .highlight .nc { color: #2B91AF }
|
||||
.type-csharp .highlight .nn { color: #000000 }
|
||||
.type-csharp .highlight .s { color: #A31515 }
|
||||
.type-csharp .highlight .sc { color: #A31515 }
|
||||
@@ -1,431 +0,0 @@
|
||||
/*******************************************************************************
|
||||
Slate Theme for Github Pages
|
||||
by Jason Costello, @jsncostello
|
||||
*******************************************************************************/
|
||||
|
||||
@import url(pygment_trac.css);
|
||||
|
||||
/*******************************************************************************
|
||||
MeyerWeb Reset
|
||||
*******************************************************************************/
|
||||
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
blockquote, q {
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
a:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Theme Styles
|
||||
*******************************************************************************/
|
||||
|
||||
body {
|
||||
box-sizing: border-box;
|
||||
color:#373737;
|
||||
background: #212121;
|
||||
font-size: 16px;
|
||||
font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 10px 0;
|
||||
font-weight: 700;
|
||||
color:#222222;
|
||||
font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
h2 {
|
||||
padding-bottom: 10px;
|
||||
font-size: 32px;
|
||||
background: url('../images/bg_hr.png') repeat-x bottom;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 10px 0 15px 0;
|
||||
}
|
||||
|
||||
footer p {
|
||||
color: #f2f2f2;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #007edf;
|
||||
text-shadow: none;
|
||||
|
||||
transition: color 0.5s ease;
|
||||
transition: text-shadow 0.5s ease;
|
||||
-webkit-transition: color 0.5s ease;
|
||||
-webkit-transition: text-shadow 0.5s ease;
|
||||
-moz-transition: color 0.5s ease;
|
||||
-moz-transition: text-shadow 0.5s ease;
|
||||
-o-transition: color 0.5s ease;
|
||||
-o-transition: text-shadow 0.5s ease;
|
||||
-ms-transition: color 0.5s ease;
|
||||
-ms-transition: text-shadow 0.5s ease;
|
||||
}
|
||||
|
||||
#main_content a:hover {
|
||||
color: #0069ba;
|
||||
text-shadow: #0090ff 0px 0px 2px;
|
||||
}
|
||||
|
||||
footer a:hover {
|
||||
color: #43adff;
|
||||
text-shadow: #0090ff 0px 0px 2px;
|
||||
}
|
||||
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
img {
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
max-width: 739px;
|
||||
padding: 5px;
|
||||
margin: 10px 0 10px 0;
|
||||
border: 1px solid #ebebeb;
|
||||
|
||||
box-shadow: 0 0 5px #ebebeb;
|
||||
-webkit-box-shadow: 0 0 5px #ebebeb;
|
||||
-moz-box-shadow: 0 0 5px #ebebeb;
|
||||
-o-box-shadow: 0 0 5px #ebebeb;
|
||||
-ms-box-shadow: 0 0 5px #ebebeb;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
width: 100%;
|
||||
color: #222;
|
||||
background-color: #fff;
|
||||
|
||||
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
|
||||
font-size: 14px;
|
||||
|
||||
border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
pre {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.1);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 3px;
|
||||
margin: 0 3px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
pre code {
|
||||
display: block;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
color: #666;
|
||||
margin-bottom: 20px;
|
||||
padding: 0 0 0 20px;
|
||||
border-left: 3px solid #bbb;
|
||||
}
|
||||
|
||||
ul, ol, dl {
|
||||
margin-bottom: 15px
|
||||
}
|
||||
|
||||
ul li {
|
||||
list-style: inside;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
ol li {
|
||||
list-style: decimal inside;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
dl dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
dl dd {
|
||||
padding-left: 20px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
dl p {
|
||||
padding-left: 20px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
hr {
|
||||
height: 1px;
|
||||
margin-bottom: 5px;
|
||||
border: none;
|
||||
background: url('../images/bg_hr.png') repeat-x center;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #373737;
|
||||
margin-bottom: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
padding: 10px;
|
||||
background: #373737;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px;
|
||||
border: 1px solid #373737;
|
||||
}
|
||||
|
||||
form {
|
||||
background: #f2f2f2;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Full-Width Styles
|
||||
*******************************************************************************/
|
||||
|
||||
.outer {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inner {
|
||||
position: relative;
|
||||
max-width: 640px;
|
||||
padding: 20px 10px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#forkme_banner {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top:0;
|
||||
right: 10px;
|
||||
z-index: 10;
|
||||
padding: 10px 50px 10px 10px;
|
||||
color: #fff;
|
||||
background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,.5);
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
#header_wrap {
|
||||
background: #212121;
|
||||
background: -moz-linear-gradient(top, #373737, #212121);
|
||||
background: -webkit-linear-gradient(top, #373737, #212121);
|
||||
background: -ms-linear-gradient(top, #373737, #212121);
|
||||
background: -o-linear-gradient(top, #373737, #212121);
|
||||
background: linear-gradient(top, #373737, #212121);
|
||||
}
|
||||
|
||||
#header_wrap .inner {
|
||||
padding: 50px 10px 30px 10px;
|
||||
}
|
||||
|
||||
#project_title {
|
||||
margin: 0;
|
||||
color: #fff;
|
||||
font-size: 42px;
|
||||
font-weight: 700;
|
||||
text-shadow: #111 0px 0px 10px;
|
||||
}
|
||||
|
||||
#project_tagline {
|
||||
color: #fff;
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
background: none;
|
||||
text-shadow: #111 0px 0px 10px;
|
||||
}
|
||||
|
||||
#downloads {
|
||||
position: absolute;
|
||||
width: 210px;
|
||||
z-index: 10;
|
||||
bottom: -40px;
|
||||
right: 0;
|
||||
height: 70px;
|
||||
background: url('../images/icon_download.png') no-repeat 0% 90%;
|
||||
}
|
||||
|
||||
.zip_download_link {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 90px;
|
||||
height:70px;
|
||||
text-indent: -5000px;
|
||||
overflow: hidden;
|
||||
background: url(../images/sprite_download.png) no-repeat bottom left;
|
||||
}
|
||||
|
||||
.tar_download_link {
|
||||
display: block;
|
||||
float: right;
|
||||
width: 90px;
|
||||
height:70px;
|
||||
text-indent: -5000px;
|
||||
overflow: hidden;
|
||||
background: url(../images/sprite_download.png) no-repeat bottom right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.zip_download_link:hover {
|
||||
background: url(../images/sprite_download.png) no-repeat top left;
|
||||
}
|
||||
|
||||
.tar_download_link:hover {
|
||||
background: url(../images/sprite_download.png) no-repeat top right;
|
||||
}
|
||||
|
||||
#main_content_wrap {
|
||||
background: #f2f2f2;
|
||||
border-top: 1px solid #111;
|
||||
border-bottom: 1px solid #111;
|
||||
}
|
||||
|
||||
#main_content {
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
#footer_wrap {
|
||||
background: #212121;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Small Device Styles
|
||||
*******************************************************************************/
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
body {
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
#downloads {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.inner {
|
||||
min-width: 320px;
|
||||
max-width: 480px;
|
||||
}
|
||||
|
||||
#project_title {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
min-width: 320px;
|
||||
max-width: 480px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user