主动信息收集
主机和二层发现
arping
-d     Find duplicate replies. Exit with 1 if there  are  answers  from
       two different MAC addresses
1 2 3
   | arping 192.168.1.1 -c 1  arping 192.168.1.1 -d  sudo arping -c 1 192.168.1.1 | grep "bytes from" | cut -d" " -f 5 | cut -d"(" -f 2 | cut -d")" -f 1 
   | 
编写脚本进行arping测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
   | #!/bin/bash
 
  if [ "$#" -ne 1 ];then      echo "usage ./arp.sh [interface]"     echo "Example ./arp.sh eth0"     exit fi
  if [ "$USER" != "root" ];then     echo "run with root"     exit fi
 
  interface=$1 
  prefix=$(ifconfig $interface| grep 'netmask' | awk '{print$2}' | cut -d"." -f 1-3)
  for i in $(seq 1 254);do     arping $prefix.$i -c 1 | grep "bytes from"| awk '{print$5}' | cut -d"(" -f 2 | cut -d ")" -f 1 done
   | 
可修改成读文件
1 2 3
   | for i in $(cat $file);do 	arping done
   | 
nmap
1 2
   | nmap 1.1.1.1-254 -sn  nmap -iL addr -sn 
   | 
Netdiscover
- 专用于二层发现
 - 可用于无线和交换网络环境
 - 主动和被动探测
 
主动
1 2
   | netdiscover -i wlan0 -r 192.168.1.0/24 netdiscover -l iplist.txt
   | 
被动
Scapy
1 2 3 4 5
   | >>> arp = ARP()  >>> arp.pdst = '192.168.1.1'  >>> arp.display()  >>> answer = sr1(arp)  >>> answer.display() 
   | 
python 扫描
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
   | 
  import logging import subprocess logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import *
  if len(sys.argv) != 2:     print "usage ./arp1.py [interface]"     sys.exit()
 
  interface = str(sys.argv[1]) command = 'ifconfig ' + interface + "| grep 'netmask' | awk '{print$2}' | cut -d'.' -f 1-3" prefix = subprocess.check_output(command, shell=True).strip() print(prefix)
  for addr in range(254):     answer = sr1(ARP(pdst = prefix+str(addr)), timeout=1)     if answer is None:         continue     print (prefix + str(addr))
 
  | 
本文作者:NoOne
本文地址: https://noonegroup.xyz/posts/dad5e299/
版权声明:转载请注明出处!