Skip to content
This repository has been archived by the owner on Jul 2, 2019. It is now read-only.

Commit

Permalink
use proxychains instead of tsocks for reconnecting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lins05 committed Oct 16, 2015
1 parent c286289 commit 68b8e7d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
sudo: false
language: python
python: 2.7
addons:
apt:
packages:
- tsocks
before_install:
- export PATH=$HOME/bin:$PATH
- cp scripts/slackbot-test-ctl $HOME/bin
- mkdir -p $HOME/opt/local/bin
- export PATH=$HOME/opt/local/bin:$PATH
- pushd /tmp/ && git clone https://github.com/rofl0r/proxychains-ng.git && cd proxychains-ng && ./configure --prefix=$HOME/opt/local && make -j2 && make install && popd
- pip install shadowsocks
- cp scripts/slackbot-test-ctl $HOME/opt/local/bin
- slackbot-test-ctl init
- slackbot-test-ctl startproxy
install: pip install -r requirements.txt
Expand Down
25 changes: 13 additions & 12 deletions scripts/slackbot-test-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
set -x -e

ssconfig=/tmp/config.json
tsocksconfig=/tmp/tsocks.conf
export TSOCKS_CONF_FILE=$tsocksconfig
proxychainsconfig=/tmp/proxychains.conf

init_tsocks() {
init_proxychains() {
cat >$ssconfig <<EOF
{
"server":"127.0.0.1",
Expand All @@ -19,21 +18,23 @@ init_tsocks() {
}
EOF

cat >$tsocksconfig <<EOF
local = 127.0.0.0/255.0.0.0
server = 127.0.0.1
server_type = 5
server_port = 1800
cat >$proxychainsconfig <<EOF
strict_chain
quiet_mode
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 127.0.0.1 1800
EOF
}

main() {
local action=$1; shift
case $action in
init)
which sslocal || sudo pip install shadowsocks
which tsocks || sudo apt-get install tsocks
init_tsocks
init_proxychains
;;
startproxy)
pgrep -f "sslocal -c $ssconfig" || {
Expand All @@ -48,7 +49,7 @@ main() {
pkill -f "ssserver -c $ssconfig"
;;
run)
tsocks "$@"
proxychains4 -f $proxychainsconfig "$@"
;;
*)
echo "WARNING: unknown command $action"
Expand Down

0 comments on commit 68b8e7d

Please sign in to comment.