SykieChen
3/7/2018 - 8:09 AM

using proxychains with shadowsocks and fiddler

using proxychains with shadowsocks and fiddler

#!/bin/sh
# This script is called by proxychains to resolve DNS names

# DNS server used to resolve names
DNS_SERVER=${PROXYRESOLV_DNS:-4.2.2.2}


if [ $# = 0 ] ; then
	echo "	usage:"
	echo "		proxyresolv <hostname> "
	exit
fi


export LD_PRELOAD=libproxychains.so.3

if [ $DNS_SERVER = "none" ] ; then
	dig $1 +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
else
	dig $1 @$DNS_SERVER +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
fi

change:

  • mkdir $HOME/.proxychains
  • /usr/lib/proxychains3/proxyresolv
  • ~/.bash_aliases

useage:

  • pc xx : use socks5 proxy 127.0.0.1:4411 to connect to xx, dns 4.2.2.2
  • PROXYRESOLV_DNS=4.4.4.4 pc xx : use dns 4.4.4.4
  • pf xx : use http proxy 127.0.0.1:8888 to connect to xx, usually fiddler, using local dns
  • PROXYRESOLV_DNS=none pc xx : use local dns
mv -f ~/.ssh/known_hosts /home/tojo/.ssh/known_hosts.bak
cp /mnt/c/Users/sykie/.ssh/* ~/.ssh
chmod 600 ~/.ssh/*
chmod 655 ~/.ssh/authorized_keys
mv -f ~/.ssh/known_hosts.bak ~/.ssh/known_hosts
alias sudo='sudo '
alias pf='ln -sf /etc/proxyfiddler.conf $HOME/.proxychains/proxychains.conf; PROXYRESOLV_DNS=none proxychains'
alias pc='ln -sf /etc/proxychains.conf $HOME/.proxychains/proxychains.conf; proxychains'

# function pf(){
#     ln -sf /etc/proxyfiddler.conf $HOME/.proxychains/proxychains.conf
#     PROXYRESOLV_DNS=none proxychains ${@:1}
# }

# function pc(){
#     ln -sf /etc/proxychains.conf $HOME/.proxychains/proxychains.conf
#     proxychains ${@:1}
# }