渗透进内网后的一些信息收集脚本

2014-02-12 14:17:19 69 6987 1


前段时间路过了一个小站,发现内部结果及其复杂。所以自己写了个小脚本来帮助信息收集。由于跳板主机是linux,所以使用python和shell脚本异常方便了。
首先ping存活主机,并将主机结果导入文件中,然后使用端口扫描脚本读取该文件,并进行端口扫描。
1、扫描存活主机脚本
使用方法 ./xxx.sh 192.168.10 > IP
is_alive_ping()
{
  ping -c 1 $1 > /dev/null
  [ $? -eq 0 ] && echo $i
}
read -p "IP[1.2.3]" IP
for i in $IP.{1..254}
do
is_alive_ping $i & disown
done
2.端口扫描脚本
使用方法是直接运行该python程序, 比如保存为test.py ,直接运行 python test.py ,不过前提是你需要有IP文件,即就是第一步中你用shell脚本生成的IP列表
import threading,os,time
def ncDetect(IP):
    command = "nc -v -z " + IP +" 21-9000 2>&1| grep succeed"
    f = os.system(command)
   

IPHandle = open("IP","r")
test = IPHandle.readline()
test = test.strip('\n')
while test:
    for i in range(5):
        t = threading.Thread(target=ncDetect,args=(test,))
        t.start()
        test = IPHandle.readline()
        test = test.strip('\n')
    time.sleep(5)
    test = IPHandle.readline()
    test = test.strip('\n')
exit(0)
当然,成果还是斐然的。吼吼

关于作者

linquid4篇文章42篇回复

评论69次

要评论?请先  登录  或  注册