Sunday, October 16, 2011

arch 配置 软件 使用 sock5 代理

一.tsocks:
1.安装tsocks,在终端中:
pacman -S tsocks
2.修改配置文件:
vi /etc/tsocks.conf
3.将其内容改成以下几行并保存退出:
local = 192.168.1.0/255.255.255.0 #local表示本地的网络,也就是不使用socks代理的网络
server = 127.0.0.1 # SOCKS 服务器的 IP
server_type = 5 # SOCKS 服务版本
server_port = 7070 #SOCKS 服务使用的端口
你可能需要修改一下以上内容,用你自己的 SSH 隧道设置
4.用tsocks运行你的软件,在终端中:
tsocks 你的软件 &
现在我的python-twitter在终端中就是通过此软件运行的.
二.proxychains:
1.安装proxychains,在终端中:
yaourt -S proxychains
2.修改配置文件(/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
# 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”
http 127.0.0.1 8580
socks5 127.0.0.1 7070
socks4 127.0.0.1 9050
注意事项:
a. 要选 dynamic_chain 而不是 random_chain
b. 可以列举几个代理服务器,proxychains 会按顺序用,代理无法访问即自动选用下一个
c. 代理服务器要根据自己电脑的情况自行调整
3.运行proxychains与运行tsocks完全一样.在终端中:
proxychains 你的软件 &
至此以上软件配置完毕.

No comments: