本文最后更新于 420 天前,其中的信息可能已经有所发展或是发生改变。
:::info
💘渗透全流程:
信息👣收集 – 漏洞发现 – 漏洞利用 – 权限提升 – 隧道搭建 – 内网渗透 – 横向移动 – 后渗透
:::
C 段扫描
思路分析:
确定 IP 的 C 段,使用字典扫描
实现步骤:
- 确定 C 段
- 拼接组成完成 IP
- ping 这个 IP,查看响应
V1.0
基本功能实现
#! usr/bin/env python3
'''
1. ping 扫描 C 段(注意间隔,防止蓝屏)
2. 判断响应 TTL 值
优化:
'''
import threading
from multiprocessing import Queue
from subprocess import Popen, PIPE
class CScan(threading.Thread):
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def run(self):
while not self.queue.empty():
ip = self.queue.get()
try:
check_ip = Popen('ping %s \n' % ip, stdin=PIPE, stdout=PIPE, shell=True)
data = check_ip.stdout.read()
if 'TTL' in str(data):
print('[+] %s is online. \n' % ip)
else:
# print(data)
pass
except:
...
def start(count):
queue = Queue()
for i in range(1, 5):
queue.put('192.168.225.%s' % i)
threads = []
thread_count = int(count)
for i in range(thread_count):
threads.append(CScan(queue))
for t in threads:
t.start()
for t in threads:
t.join()
if __name__ == '__main__':
count = 16
start(16)
V2.0
参考 CScan 继续优化:
https://github.com/AmbroseCdMeng/Cscan