nmap scripts

Hello, Khabrovites. We are sharing with you the author's article, which was prepared by Alexander Kolesnikov.



Also, as part of the professional course
"Network engineer" , an open webinar on the topic "NAT is not a Firewall" will soon take place . Participants of the webinar, together with an expert, will consider what NAT is and why NAT! = Firewall, as well as analyze different types of configurations for different situations.






Networking is a rather complex process, and sometimes, to understand how it works, you have to use abstractions and additional tools that allow you to get information about this interaction. This article will explain how to write scripts for the nmap tool, and what they consist of.





Scripting language and main features

svn, github. , , Lua. , , , . . .





nmap Lua - . , nmap. , IP, UDP, TCP ICMP .





, nmap Lua. nmap , Nmap Scripting Engine. NSE /, . , nmap, . 14, :





  1. auth — , ;





  2. discovery — , ;





  3. external — , ;





  4. vuln — , , ;





  5. intrusive — , .





discovery.





, , IDE. , API, . NSE Halcyon IDE. IDE JRE, :





IDE , , , nmap.





, , . , nmap :





  • host — , (ip, OS version);





  • port — , (, , ).





, , . . , .





:





portrule = function( host, port )
    return true
end

action = function(host, port)
end
      
      



  • portrule — , , . . : portrule hostrule. true false , .





  • action — main , , rule true. nil ( ).





IDE, 7878:





sudo nc -lvvp 7878
      
      



:





sudo nmap -n --script=testScript.nse 127.0.0.1 -p 7878
      
      



:





, , portrule. — , .





, — , nmap. http .






«Network engineer».



«NAT — Firewall».








All Articles