APT404-不作恶

在路上,一直在路上!

如何更隐匿地渗透

0x01 前言
    实际渗透中,我们经常会遇到各种ips或者waf的围追堵截,有时候,跑个目录就直接把你ip封了,因为经常会遇到这种尴尬的情况,所以就灵机一动想了个比较折中的办法,利用tor来频繁的切ip,然后用socks5代理,把常用的工具丢进去搞,注意用工具跑的时候,线程要尽量给少点,tor唯一的缺点就是慢,当然,你也可以写成分布式扫描,不过可能需要你事先准备好一大批高质量代理ip,然后随机轮训,不过咱们不需要这么麻烦,不到五分钟写了个小脚本,暂且能满足需求,将就用吧

0x02 代码如下
    随便写的,比较粗糙,大家将就着看吧,如下,有些地方还有问题,后期抽空想到好点子了,再完善下,对了,不知道为啥tor自己的切ip选项不管用,希望哪位兄弟如果找到原因麻烦也告诉我一声,谢谢……

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
ip_addr=`ifconfig | grep "inet" | awk -F " " {'print $2'} | sed -n '1p'`

# auto install tor privoxy proxychains
for i in "tor" "proxychains" "privoxy"
do
which $i 2>&1 >/dev/null
if [ $? -ne 0 ];then

echo "please wait moment.....,come soon\n"
apt-get install $i -y >/dev/null 2>&1

if [ $? -eq 0 ];then
echo "$i installed....ok!\n"
else
echo "$i install failed! please check you network!...... \n"
exit 1
fi
else
/etc/init.d/tor stop >/dev/null 2>&1
killall privoxy >/dev/null 2>&1
echo "$i installed ready ....ok\n"
fi
done

# proxychains config
proxychains_config="/etc/proxychains.conf"
> $proxychains_config
echo "random_chain" >> $proxychains_config
echo "chain_len = 1" >> $proxychains_config
echo "proxy_dns" >> $proxychains_config
echo "tcp_read_time_out 15000" >> $proxychains_config
echo "tcp_connect_time_out 8000" >> $proxychains_config
echo "[ProxyList]" >> $proxychains_config
echo "socks4 $ip_addr 9050" >> $proxychains_config
if [ $? -eq 0 ] ;then
echo "proxychains config succeed ! \n"
else
echo "proxychains config failed ! please check.....\n"
exit 1
fi

# privoxy config
privoxy_config="/etc/privoxy/config"
sed -i "s#127.0.0.1:8118#$ip_addr:8118#g" $privoxy_config
echo "forward-socks5 / $ip_addr:9050 ." >> $privoxy_config
if [ $? -eq 0 ] ;then
echo "privoxy config succeed\n"
else
echo "privoxy config failed ! please check....\n"
exit 1
fi

# start tor & privoxy
/etc/init.d/tor start >/dev/null 2>&1
if [ $? -eq 0 ] ;then
echo "Tor start succeed ....ok\n"
else
echo "Tor start failed,please use 'journalctl -xe' check,thank you....failed\n"
exit 1
fi

/usr/sbin/privoxy /etc/privoxy/config >/dev/null 2>&1
if [ $? -eq 0 ] ;then
echo "Privoxy start succeed .....ok\n"
else
echo "Privoxy start failed,please use 'journalctl -xe' check,thank you....failed\n"
exit 1
fi

# auto change ip every 45 second
echo "please Ctrl+C to stop !\n"
while true
do
sleep 45s
/etc/init.d/tor restart >/dev/null 2>&1

if [ $? -eq 0 ] ;then
echo "Tor restart succeed! \n"
else
echo "\n\033[33m Tor restart failed !\033[0m\n"
exit 1
fi
done

tor