Kali設置代理


原文:Kali-linux設置ProxyChains

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 :)

# 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

簡要說明:可以使用HTTP, SOCKS4, SOCKS5類型的代理,經嘗試,HTTP代理好像不太好,我用的是SOCKS4和SOCKS5,可能是我沒有找到好的HTTP代理,大家也可以多嘗試。

可以使用如下選項,但只有一個生效,即最后一個沒有被注釋掉的選項,可以注釋掉其他不用的選項。

dynamic_chain: proxy list中至少出現一個。

strict_chain:proxy list全部出現。

random_chain:從proxy list中隨機選擇chain_len個代理。

2、添加代理

添加一些代理服務器到列表(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 61.129.70.109 1080
socks4 182.92.225.79 1080
socks4 61.177.248.202 1080
socks4 182.92.255.** 1080
socks4 218.241.238.*** 1080

可以照給出的例子添加代理,代理就自己上網搜吧!

3、通過用戶的連接代理解析目標主機

  默認情況下,執行proxyresolv命令,可能看到該命令沒找到錯誤信息。因為proxyresolv保存在/usr/lib/proxychains3/目錄中,而不能被執行。proxyresolv會被proxychains調用,所以將這兩個文件放在一個目錄中,如/usr/bin。執行命令如下所示:

root@kali:~# cp /usr/lib/proxychains3/proxyresolv /usr/bin/

執行完以上命令后,proxyresolv命令就可以執行了。

root@starnight:~# proxyresolv www.baidu.com
|R-chain|-<>-61.129.70.109:1080-<>-182.92.225.79:1080-<><>-4.2.2.2:53-<><>-OK
103.235.46.39
root@starnight:~# proxyresolv www.baidu.com
|R-chain|-<>-182.92.225.79:1080-<>-61.177.248.202:1080-<><>-4.2.2.2:53-<><>-OK
103.235.46.39

我這里啟用的是random_chain選項,長度為2, 大家可以看到上面的proxy chain 是從proxy list隨機選取的兩個代理構成的proxy chain。

4、nmap 掛代理掃描端口

root@starnight:~# proxychains nmap -sS 119.75.217.109
ProxyChains-3.1 (http://proxychains.sf.net)

Starting Nmap 7.40 ( https://nmap.org ) at 2017-06-01 21:17 EDT
Nmap scan report for 119.75.217.109
Host is up (0.030s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https

Nmap done: 1 IP address (1 host up) scanned in 5.25 seconds

5、metasploit掛代理

root@starnight:~# proxychains msfconsole

ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-response|: starnight does not exist
<><>-OK7.0.0.1:5432-[*] Starting the MEtasploit Framework console...-../nsole...|
|R-chain|-<>-218.75.41.134:1080-<>-218.201.98.196:1080-[*] Starting the MetAsploit Fram<><>-OK7.0.0.1:5432-[*] Starting the MetaSploit Framework console.../
[-] Failed to connect to the database: FATAL: no pg_hba.conf entry for host "172.18.17.8", user "msf", database "msf"

[-] WARNING! The following modules could not be loaded!
[-] : Errno::ENOENT No such file or directory

, ,
/ \
((__---,,,---__))
(_) O O (_)_________
\ _ / |\
o_o \ M S F | \
\ _____ | *
||| WW|||
||| |||


Save 45% of your time on large engagements with Metasploit Pro
Learn more on http://rapid7.com/metasploit

=[ metasploit v4.14.14-dev ]
+ -- --=[ 1643 exploits - 946 auxiliary - 289 post ]
+ -- --=[ 473 payloads - 40 encoders - 9 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >

執行以上命令后,看到msf>提示符表示msfconsole啟動成功了。表示ProxyChains設置成功。

我這metasploit本身就有問題,請忽略,😓 。最后要提一下的就是,代理可能不穩定,例如出現超時timeout,可能需要經常換代理試試。

 

References:

Kali-linux設置ProxyChains

How to Evade Detection Using Proxychains

How To Use Proxychains To Evade Detection in Kali Linux


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM