Nmap Source Learning two overall architecture

Source: Internet
Author: User

Directory Features:

Docs: Related Documents
libdnet-stripped: Open Source network Interface Library
Liblinear: Open source large linear classification Library
Liblua: Open source Lua scripting language Library
Libnetutil: Basic network functions
Libpcap: Open Source grab Bag Library
Libpcre: Open-source Regular expression Library
Macosx:xcode Project file
Mswin32:vs Project file
The base of the Nbase:nmap package uses a library of functions
Ncat:netcat Network tool, implemented by Nmap
Ndiff: A practical command to compare NMAP scan results
Nmap-update: Responsible for nmap update operation
NPING:NMAP Project team implementation of the new hping, probing and building package
Nselib:nmap's LUA script
Parallel socketevent processing library implemented by Nsock:nmap
Scripts:nmap provides common scan-checking LUA scripts
TODO: Development tasks
Graphical interface program for Zenmap:python

Principal program Logic

Entrance procedure in main.cc, main function

    • Check environment Variables Nmap_args
    • Check that there are no –resume parameters
    • To determine whether to scan before resume or a new request

The nmap.cc Nmap_main () function is then called according to the incoming parameters. Here is the streamlined source code:

intMainintargcChar*argv[]) {Charcommand[2048];intMYARGC;Char**MYARGV = NULL;Char*cptr;intRetintI Set_program_name (argv[0]);if(Cptr = getenv ("Nmap_args"))) {if(Snprintf (Command,sizeof(command),"Nmap%s", cptr) >= (int)sizeof(command)) {Error ("Warning:nmap_args variable is too long, truncated"); }/ * Copy rest of command-line arguments * /     for(i =1; I < ARGC &&strlen(command) +strlen(Argv[i]) +1<sizeof(command); i++) {strcat(Command," ");strcat(command, Argv[i]); } MYARGC = arg_parse (command, &AMP;MYARGV);if(MYARGC <1) {Fatal ("Nmap_args variable could not be parsed");    } ret = Nmap_main (MYARGC, MYARGV); Arg_parse_free (MYARGV);returnRet }if(ARGC = =3&&strcmp("--resume", argv[1]) ==0) {if(Gather_logfile_resumption_state (argv[2], &AMP;MYARGC, &myargv) = =-1) {Fatal ("cannot resume from (supposed) log file%s", argv[2]); }returnNmap_main (MYARGC, MYARGV); }returnNmap_main (argc, argv);}

Then the program educates Nmap_main ().
In Nmap_main, the surface looks like the scanned loop starts at 2065 lines:

for (Targetno = 0; Targetno < targets.size (); targetno++) {
Currenths = Targets[targetno];
Before and after the code are more, next time to take a detailed analysis.

Here's a flowchart that someone else does:

Reference URL:
http://blog.csdn.net/wang_walfred/article/details/44910189

Nmap Source Learning two overall architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.