Discovery Scanning

1、NetDiscover you performe layer 2

     the comand  : netdiscover -r 192.168.2.0/24   or use   netdiscover  -l  iplist.txt

2、in fact we use ARP  to request the system get the replay  is Poor concealment, because we use the Broadcasting ARP request for every IP address in an entire subnet can sometimes trigger alerts or resopnses from security devices such as Intrusion Detection Systems(IDS )  or other devices Intrusion Prevention System(IPS)

     A stealthier approach is to listen for the ARP traffic as the scanner system naturally interacts with other system on the network ,and then record the data collected from the ARP response ,this passive scanning techinque can be performed usign the -p option . the command as follow  ,but  we  the rate of scanning is slower .we ofter use it to scanning the wireless network .

       netdiscover -p   [ip ]

3、use the  auxiliary in the Metasploit 

    the  start command is  :msfconsole  and the use the  auxiliary :   

    use  auxiliary/Scanner/discover/arp_sweep   and use  to show what need configuration  

4 、As   with the ARPing request, the bytes  from unique sting is only present in the ouput associated with live ip address ,and it is also on a line that contains this address ,in the same fashion  ,we can extract the ip address from any successful ping request using a combination of grep and cut ,the command :

      ping 192.168.1.1 -c 3 | gerp   "butes from " 

      ping  192.168.1.1 -c 3 | gerp " byte from" | cut -d " "  -f 4  

      ping 192.168.1.1 -c 3 | grep " bytes from " | cut -d " " -f 4 | -d ":" -f 1

 5、using Nmap to perform layer3 discovery

      IPCM   scan    command :   nmap -sn [ip]     ,besides ,we can use the comand :  (nmap -iL iplist.txt  -sn [ip] )

6、 fping and hping3

      unlike the standard ping utility ,fping will stop sending ICMP echo requests after it receives a single replay ,but if a response is not received from the address ,fping will make four attempts to contact the system prior to determining that the host is unreachable .

      using the -g option to dynamically generate a list of ip address .to specify a range to scan ,pass this argument to both the first and last ip address in the  desird sequential range  ,,the command is :   fping -g 192.168.1.0 192.168.1.11   of course   it can write this :  fping -g 192.168.1.0/24   ,fping  can also used a series of address as specified by the contents of an input text file ,to use an input file ,use the -f file option and supply the filename or path of the input file; thec command is :   fping -f iplist.txt  

      the other tool is hping3  ,  it is  canable of performing discovery at both layer 3 and layer 4, the comman is : hping3 192.168.1.0 --icmp , in the linux  use the -c option appoint should be include with an integer value that indicates the desired number of attempts .

      the command :    hping3  192.168.1.1 --icmp  -c  2

 7、 using Scapy  to perform layer 4 discovery 

      an ACK packet  sent to live host on any port ,regardless of the port status ,will return an RST packet ,but on response will be received from an IP if no live host is associzted with it , so we can perform a discovery scan on a large number of system by only interacting with a single port on the each system, using Scapy in conjuction with the python , we can use the brief command , through send ACK packet to  only the one the TCP port on the each system ,by  eveulating the response   returned by each host , so , we can easily output a list the ip address .

       eg :  #/usr/bin/python

          import loging

          logging.getLogger("Scapy.runtime).setLevel(logging.ERROR)

          from scapy.all import *

          if len(sys.argv)!=2:

            print(" Usage -./ACK_Ping.py[/24 network address]")

            print(" Example -/ACK_Ping.py 192.168.1.2")

            print(" Example will perform a TCP ACK ping scan of the 192.168.1.0/24 range")

            sys.exit()

         address=src(sys.arvg[1])

         prefix=address.split( '.')[0]+ ' .' +address.split('.')[1]+ ' .' +address.split('.')[2]+ ' .'

         for addr in range(1,254):

           response=srl(IP(dst(prefix+str(addr))/TCP(dport=80,flag='A'),timeout=1,verbose=0)

         try:

             if int (response[TCP].flags)==4:

                print(" "192.168.1.2"+str(addr) ")

           except:

                    pass

end the code  ,we can use ./ACK_Ping.py   perform

8、using  the nmap to perform layer 4 dissovery

     to perform  a discovery scan with UDP ,use the -PU in the conjuction with the port to test like with :   nmap 192.168.2.1 -PU53 -sn   besides we can use the command  to perform  scan  use  ip address list  .like the command : nmap -il iplist.txt  -sn -PU53     (designated port  53)

    using  -PA option  means use the ACK packets to identify live hosts .  the command  :  nmap 192.168.1.2  -PA80 -sn     ,of couse we can  performed on a range os host using dash notation ,the command is : nmap 192.168.1.2 -192.168.1.255 -PA80 -sn  or  use  0/24

9、Using hping3 to perform layer 4 discovery

     by specifying the UDP mode with the  --udp option ,UDP probes can  transmisted in attempts to trigger replies from live hosts:

      the command like this :    hping3 --udp 192.168.1.2    we can use the -c option indicated the desired number of attempts

    eg: nmap  --udp 192.168.1.2 -c 2

   we know the hping3 does not support the scanning of mulltiple system by default,  but we can use the bush scripting.like this :

      hping3 --upd 192.168.1.2 -c 2 ;hping3 --upd 192.168.2.3 -c 2 | gerp  " Unreachable " Hping 192.168.1.2 (eth1 192.168.1.2):udp mode set 28 headers +0 data bytes  ICMP port Unreachable from ip=192.168.1.2 name=unknow status=0 port 2836 seq=0  

 

 

posted @ 2019-01-21 11:43  疏桐  阅读(202)  评论(0编辑  收藏  举报
function e(n){ return document.getElementsByTagName(n) } function t(){ var t=e("script"),o=t.length,i=t[o-1]; return{ l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.5),c:n(i,"color","0,0,0"),n:n(i,"count",99) } } function o(){ a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth, c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight } function i(){ r.clearRect(0,0,a,c); var n,e,t,o,m,l; s.forEach(function(i,x){ for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e=n.max/2&&(i.x-=.03*o,i.y-=.03*m), t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke())) }), x(i) } var a,c,u,m=document.createElement("canvas"), d=t(),l="c_n"+d.l,r=m.getContext("2d-disabled"), x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame|| function(n){ window.setTimeout(n,1e3/45) }, w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o, window.onmousemove=function(n){ n=n||window.event,y.x=n.clientX,y.y=n.clientY }, window.onmouseout=function(){ y.x=null,y.y=null }; for(var s=[],f=0;d.n>f;f++){ var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3}) } u=s.concat([y]), setTimeout(function(){i()},100) }();