ProxyChains是Linux和其他Unices下的代理工具。它可以使任何程序通過代理上網,允許TCP和DNS通過代理隧道,支持HTTP、SOCKS4和SOCKS5類型的代理服務器,並且可配置多個代理。ProxyChains通過一個用戶定義的代理列表強制連接指定的應用程序,直接斷開接收方和發送方的連接。本節將介紹設置ProxyChains的方法。
設置ProxyChains的具體操作步驟如下所示。
(1)打開ProxyChains配置文件。執行命令如下所示:
root@Kali:~# vi /etc/proxychains.conf
執行以上命令后,打開文件的內容如下所示:
# 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 :)
輸出的信息就是proxychains.conf文件的內容。由於篇幅的原因,這里只列出了部分內容。
(2)將proxychains.conf文件中的dynamic_chain前面的注釋符取消。要修改的配置項,是上面加粗的部分,如下所示:
dynamic_chain
(3)添加一些代理服務器到列表(proxychains.conf文件末尾),如下所示:
# 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
socks5 98.206.2.3 1893
socks5 76.22.86.170 1658
-- 插入 --
以上信息中加粗的部分為添加的代理服務器。
(4)通過用戶的連接代理解析目標主機。執行命令如下所示:
root@kali:~# proxyresolv www.target.com
默認情況下,執行proxyresolv命令,可能看到該命令沒找到錯誤信息。因為proxyresolv保存在/usr/lib/proxychains3/目錄中,而不能被執行。proxyresolv會被proxychains調用,所以將這兩個文件放在一個目錄中,如/usr/bin。執行命令如下所示:
root@kali:~# cp /usr/lib/proxychains3/proxyresolv /usr/bin/
執行完以上命令后,proxyresolv命令就可以執行了。
(5)通過用戶想要使用的應用程序運行ProxyChains,例如,啟動msfconsole。執行命令如下所示:
root@kali:~# proxychains msfconsole
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| 0.0.0.0
|S-chain|-<>-127.0.0.1:9050-<--timeout
|DNS-response|: 0.0.0.0 is not exist
, ,
/ \
((__---,,,---__))
(_) O O (_)_________
\ _ / |\
o_o \ M S F | \
\ _____ | *
||| WW |||
||| |||
Tired of typing 'set RHOSTS'? Click & pwn with Metasploit Pro
-- type 'go_pro' to launch it now.
=[ metasploit v4.7.0-2013082802 [core:4.7 api:1.0]
+ -- --=[ 1161 exploits - 641 auxiliary - 180 post
+ -- --=[ 310 payloads - 30 encoders - 8 nops
msf >
執行以上命令后,看到msf>提示符表示msfconsole啟動成功了。表示ProxyChains設置成功。