1. Ss5 Sets up the SOCK5 server

1.1 Download ss5 source code

https://sourceforge.net/projects/ss5/files/ss5/
https://nchc.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
Copy the code

1.2 Installing Yum Dependencies

yum install -y pam-devel
yum install -y openldap-devel
yum install -y openssl-devel
Copy the code

1.3 Compilation and installation

tar xvf ss53.89.- 8.tar.gz
cd ss53.89.
./configure && make && make install
Copy the code

1.4 Modifying the SS5 Configuration File

Vi /etc/opt/ss5/ss5.conf auth0.0. 0. 0/0-- permit -0.0. 0. 0/00.0. 0. 0/0 – – – – –
Copy the code

After installation, these two lines are annotated out, and you can unannotate these two lines. At this time, the state is not authenticated, and everyone can access it

1.5 Adding executable permission to the bash file /etc/rc.d/init.d/ss5

chmod +x /etc/rc.d/init.d/ss5
Copy the code

1.6 Starting, Stopping, or Restarting the SS5

/etc/rc.d/init.d/ss5 start
/etc/rc.d/init.d/ss5 stop
/etc/rc.d/init.d/ss5 restart
Copy the code

1.7 Enabling Account and Password Authentication

We need to change the two lines in step 1.4 to:

auth 0.0. 0. 0/0- u permit u0.0. 0. 0/00.0. 0. 0/0 – – – – –
Copy the code

Run the following command to restart the service :/etc/rc.d/init.d/ss5 restart /etc/rc.d/ss5 restart

vi /etc/opt/ss5/ss5.passwd
admin admin123
Copy the code

1.8 If you need to change the default port 1080

Vi /etc/sysconfig/ss5" -u root"Uncomment and change to the following, for example, change the port to9080Run the following command to restart the service :/etc/rc.d/init.d/ss5 restart SS5_OPTS="-u root -b 0.0.0.0:9080"
Copy the code

1.9 Checking Process Ports

[root@localhost ss53.89.]# netstat -luntp|grep ss5
tcp        0      0 0.0. 0. 0:9080            0.0. 0. 0:*               LISTEN      10616/ss5 
Copy the code

If the netstat command is not available, run the yum install -y net-tools command to install it

2. Proxychains -ng build SOck5 client

ProxyChains is a UNIX program, that hooks network-related libc functions
  in DYNAMICALLY LINKED programs via a preloaded DLL (dlsym(), LD_PRELOAD)
  and redirects the connections through SOCKS4a/5 or HTTP proxies.
  It supports TCP only (no UDP/ICMP etc).
Copy the code

2.1 download proxychains

https://github.com/rofl0r/proxychains-ng/tree/master
https://codeload.github.com/rofl0r/proxychains-ng/zip/refs/tags/v4.15
Copy the code

2.2 Compilation and installation

# unzip
unzip proxychains-ng4.15.zip
cd proxychains-ng4.15

# configure and install 
./configure --prefix=/usr --sysconfdir=/etc
make && make install

# installs /etc/proxychains.conf
make install-config 
Copy the code

Yum install -y GCC GCC -c++ install GCC GCC -c++

Some installation logs are as follows:

cc src/daemon/hsearch.o src/daemon/sblist.o src/daemon/sblist_delete.o src/daemon/daemon.o src/daemon/udpserver.o -o proxychains4-daemon ./tools/install.sh -D -m 644 libproxychains4.so /usr/lib/libproxychains4.so ./tools/install.sh -D -m  755 proxychains4 /usr/bin/proxychains4 ./tools/install.sh -D -m 755 proxychains4-daemon /usr/bin/proxychains4-daemon [root@localhost proxychains-ng-4.15]# [root@localhost proxychains-ng-4.15]# make install-config./tools/install.sh -d -m  644 src/proxychains.conf /etc/proxychains.confCopy the code

2.3 Make a binary file directory and save it for subsequent use

You can save the installation files in step 2 in a directory and create a tar.gz package, so that on other machines with the same operating system, you can directly decompress the installation file and use it, no need to re-compile, save time and steps, as follows:

Create a directory like proxychains_bin_centos76.
mkdir proxychains_bin_centos76.# # copy the required file into the directory cp/usr/lib/libproxychains4. So proxychains_bin_centos76./
cp /usr/bin/proxychains4 proxychains_bin_centos76./
cp /etc/proxychains.conf proxychains_bin_centos76./ ## Create a proxychains_bin_centos76..tar.gz 
tar -zcvf proxychains_bin_centos76..tar.gz proxychains_bin_centos76.
Copy the code

2.4 Use of ProxyChains

Usage: ./proxychains4 -q -f config_file program_name [arguments] -q makes proxychains quiet - this overrides the config setting  -f allows one to manually specify a configfile to use for example : proxychains telnet somehost.com More help in README fileCopy the code

The sock5 proxy can be used to connect to the server.

### Attach a simple configuration example: SOckS4127.0. 01. 9050  #sock4
socks5	10.917.96.		1080  #sock5,no auth
socks5 	192.168. 56101.	9080	admin admin123 #sock5 need auth
Copy the code

For example, I configure socks5 192.168.56.101 1080 admin admin123 in the last line of proxychains.

[testuser@localhost proxychains_bin_centos7.6]$ tail -f proxychains.conf 
#       proxy types: http, socks4, socks5, raw
#         * raw: The traffic is simply forwarded to the proxy without modification.
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5  192.168.56.101 9080 admin admin123
Copy the code

Usage:./ proxyChainS4 -f config_file program_name [arguments

CD/home/testuser with/proxychains_bin_centos7. 6. / proxychains4 - f proxychains. Conf curl http://www.baidu.comCopy the code

## Use method 2, add the -q parameter, use quietly, do not print the agent information

cd /home/testuser/proxychains_bin_centos76.
./proxychains4 -q -f proxychains.conf curl http://www.baidu.com
Copy the code

3, use the absolute path directly, such as:

# # direct acquisition command absolute path + program_name [the arguments] way, such as: / home/testuser with/proxychains_bin_centos76./proxychains4 -f /home/testuser/proxychains_bin_centos76./proxychains.conf curl http://www.baidu.com
Copy the code