http___man.sourcentral.org_SUSE114_hr_1_nmap_1.xml
1.1 2.1 3.1 4.1 5.1 6.1 6.2 6.3 6.4 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 8.1 9.1 9.2 10.1 10.2 11.1 12.1 13.1 14.1 15.1 16.1 17.1 20.1 21.1 22.1 24.1 25.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 33.1 35.1 36.1 36.2 36.3 37.1 38.1 38.2 38.3 39.1 40.1 41.1 42.1 44.1 45.1 46.1 47.1 48.1 49.1 50.1 51.1 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 60.1 61.1 62.1 63.1 64.1 65.1 66.1 67.1 68.1 69.1 71.1 72.1 73.1 74.1 75.1 76.1 77.1 78.1 79.1 80.1 81.1 82.1 83.1 84.1 85.1 86.1 87.1 88.1 89.1 90.1 91.1 92.1 93.1 94.1 95.1 96.1 97.1 98.1 99.1 100.1 101.1 102.1 103.1 104.1 105.1 106.1 107.1 108.1 109.1 110.1 111.1 112.1 113.1 114.1 115.1 116.1 117.1 118.1 119.1 120.1 121.1 122.1 123.1 124.1 125.1 126.1 127.1 128.1 129.1 130.1 131.1 132.1 133.1 134.1 135.1 136.1 137.1 137.2 138.1 139.1 140.1 141.1 142.1 143.1 144.1 145.1 146.1 147.1 148.1 149.1 151.1 152.1 153.1 154.1 154.2 155.1 155.2 155.3 155.4 155.5 155.6 155.7 155.8 155.9 156.1 156.2 156.3 156.4 156.5 156.6 156.7 156.8 156.9 157.1 157.2 158.1 158.2 158.3 158.4 159.1 159.2 160.1 161.1 162.1 162.2 162.3 162.4 162.5 162.6 162.7 162.8 163.1 164.1 165.1 165.2 165.3 165.4 165.5 165.6 165.7 165.8 166.1 167.1 167.2 167.3 168.1 169.1 170.1 171.1 172.1 172.2 172.3 172.4 172.5 173.1 173.2 173.3 173.4 173.5 173.6 173.7 173.8 174.1 174.2 174.3 174.4 174.5 174.6 174.7 175.1 175.2 175.3 175.4 176.1 176.2 176.3 176.4 177.1 178.1 178.2 178.3 178.4 178.5 178.6 178.7 179.1 179.2 180.1 181.1 181.2 181.3 181.4 181.5 182.1 182.2 182.3 183.1 183.2 183.3 183.4 183.5 183.6 183.7 184.1 185.1 186.1 186.2 186.3 186.4 186.5 186.6 186.7 187.1 187.2 187.3 188.1 189.1 189.2 189.3 189.4 189.5 189.6 189.7 190.1 190.2 190.3 190.4 190.5 190.6 191.1 191.2 192.1 192.2 192.3 192.4 192.5 192.6 192.7 193.1 194.1 194.2 194.3 194.4 195.1 195.2 195.3 196.1 196.2 196.3 196.4 196.5 196.6 196.7 196.8 197.1 197.2 197.3 197.4 197.5 198.1 199.1 199.2 199.3 199.4 200.1 200.2 200.3 200.4 200.5 201.1 201.2 201.3 201.4 201.5 201.6 201.7 202.1 202.2 202.3 203.1 204.1 204.2 204.3 204.4 204.5 204.6 204.7 204.8 205.1 205.2 205.3 205.4 205.5 205.6 206.1 206.2 207.1 207.2 207.3 208.1 209.1 209.2 209.3 209.4 209.5 209.6 210.1 210.2 210.3 210.4 210.5 210.6 210.7 210.8 210.9 210.10 210.11 211.1 212.1 212.2 212.3 212.4 212.5 212.6 212.7 213.1 213.2 214.1 215.1 215.2 215.3 215.4 216.1 216.2 216.3 216.4 216.5 216.6 217.1 217.2 218.1 219.1 219.2 220.1 221.1 222.1 222.2 222.3 223.1 223.2 223.3 223.4 223.5 223.6 224.1 225.1 225.2 226.1 227.1 227.2 228.1 229.1 229.2 229.3 229.4 229.5 230.1 231.1 231.2 231.3 231.4 231.5 232.1 232.2 232.3 233.1 234.1 234.2 234.3 234.4 235.1 235.2 236.1 237.1 237.2 237.3 237.4 237.5 238.1 238.2 238.3 238.4 238.5 239.1 239.2 239.3 239.4 239.5 239.6 240.1 240.2 240.3 241.1 241.2 241.3 241.4 241.5 242.1 242.2 243.1 244.1 244.2 244.3 244.4 244.5 244.6 244.7 244.8 245.1 245.2 245.3 245.4 245.5 245.6 245.7 245.8 245.9 245.10 246.1 246.2 246.3 246.4 246.5 247.1 247.2 247.3 247.4 247.5 247.6 248.1 249.1 249.2 249.3 249.4 249.5 250.1 250.2 250.3 250.4 250.5 250.6 250.7 251.1 252.1 252.2 252.3 252.4 252.5 252.6 253.1 253.2 253.3 253.4 253.5 253.6 253.7 253.8 254.1 255.1 255.2 255.3 255.4 255.5 256.1 256.2 257.1 257.2 257.3 257.4 257.5 257.6 257.7 257.8 258.1 258.2 258.3 258.4 258.5 258.6 258.7 258.8 259.1 259.2 259.3 260.1 261.1 261.2 261.3 261.4 261.5 261.6 262.1 262.2 262.3 262.4 262.5 263.1 264.1 264.2 264.3 265.1 265.2 265.3 266.1 267.1 268.1 269.1 270.1 271.1 272.1 272.2 272.3 273.1 273.2 273.3 273.4 273.5 273.6 273.7 273.8 273.9 274.1 275.1 275.2 276.1 276.2 276.3 276.4 277.1 278.1 278.2 278.3 278.4 279.1 279.2 279.3 279.4 279.5 279.6 280.1 281.1 281.2 281.3 281.4 281.5 281.6 282.1 283.1 283.2 283.3 283.4 284.1 284.2 284.3 284.4 285.1 285.2 285.3 285.4 285.5 286.1 287.1 287.2 287.3 287.4 287.5 287.6 288.1 289.1 289.2 289.3 289.4 290.1 290.2 290.3 290.4 291.1 291.2 292.1 293.1 293.2 293.3 293.4 294.1 294.2 294.3 294.4 294.5 294.6 294.7 295.1 295.2 295.3 295.4 295.5 295.6 295.7 295.8 295.9 295.10 296.1 297.1 297.2 297.3 297.4 297.5 297.6 297.7 297.8 297.9 297.10 297.11 297.12 298.1 298.2 298.3 298.4 298.5 298.6 298.7 299.1 300.1 300.2 301.1 302.1 302.2 302.3 302.4 302.5 302.6 302.7 303.1 303.2 303.3 303.4 303.5 303.6 303.7 303.8 303.9 303.10 304.1 304.2 304.3 305.1 306.1 306.2 306.3 307.1 307.2 308.1 309.1 309.2 309.3 310.1 310.2 310.3 311.1 312.1 312.2 313.1 314.1 314.2 315.1 316.1 316.2 317.1 318.1 318.2 318.3 318.4 318.5 318.6 318.7 319.1 319.2 319.3 319.4 320.1 320.2 320.3 320.4 320.5 320.6 320.7 320.8 320.9 320.10 320.11 320.12 320.13 320.14 321.1 321.2 321.3 321.4 321.5 322.1 322.2 322.3 323.1 324.1 325.1 325.2 326.1 326.2 326.3 327.1 328.1 328.2 329.1 330.1 330.2 330.3 330.4 330.5 330.6 330.7 330.8 330.9 331.1 332.1 332.2 333.1 334.1 335.1 336.1 336.2 337.1 338.1 338.2 338.3 338.4 338.5 338.6 338.7 339.1 339.2 340.1 340.2 340.3 340.4 340.5 340.6 340.7 340.8 340.9 340.10 340.11 341.1 341.2 341.3 342.1 343.1 344.1 345.1 345.2 346.1 347.1 347.2 347.3 347.4 348.1 349.1 349.2 349.3 349.4 350.1 351.1 351.2 351.3 351.4 351.5 352.1 353.1 353.2 353.3 353.4 353.5 354.1 354.2 355.1 355.2 355.3 355.4 356.1 356.2 357.1 358.1 359.1 359.2 359.3 360.1 361.1 361.2 361.3 362.1 362.2 362.3 362.4 363.1 363.2 363.3 364.1 365.1 366.1 367.1 368.1 369.1 370.1 371.1 371.2 371.3 371.4 371.5 371.6 371.7 372.1 373.1 373.2 374.1 374.2 374.3 374.4 375.1 376.1 377.1 378.1 378.2 379.1 380.1 381.1 382.1 383.1 384.1 384.2 384.3 384.4 384.5 384.6 384.7 384.8 384.9 384.10 384.11 384.12 384.13 385.1 386.1 386.2 386.3 386.4 387.1 388.1 388.2 388.3 388.4 389.1 390.1 390.2 390.3 390.4 390.5 391.1 392.1 392.2 392.3 393.1 394.1 394.2 394.3 394.4 394.5 394.6 394.7 395.1 395.2 395.3 396.1 396.2 396.3 397.1 398.1 398.2 398.3 398.4 398.5 399.1 399.2 399.3 399.4 400.1 400.2 400.3 400.4 401.1 401.2 401.3 402.1 402.2 402.3 402.4 403.1 404.1 404.2 404.3 404.4 404.5 404.6 404.7 405.1 405.2 405.3 405.4 406.1 406.2 407.1 408.1 408.2 409.1 409.2 410.1 410.2 410.3 410.4 411.1 411.2 411.3 411.4 411.5 411.6 411.7 412.1 412.2 413.1 414.1 414.2 414.3 414.4 414.5 414.6 414.7 414.8 415.1 415.2 415.3 415.4 415.5 416.1 417.1 417.2 417.3 417.4 417.5 417.6 417.7 417.8 417.9 418.1 419.1 419.2 419.3 419.4 419.5 419.6 420.1 420.2 420.3 420.4 421.1 422.1 423.1 423.2 423.3 423.4 424.1 424.2 424.3 424.4 425.1 425.2 425.3 425.4 426.1 426.2 426.3 427.1 427.2 427.3 427.4 427.5 427.6 428.1 428.2 428.3 428.4 428.5 428.6 429.1 430.1 430.2 430.3 430.4 430.5 431.1 431.2 431.3 432.1 433.1 433.2 433.3 433.4 433.5 434.1 435.1 435.2 435.3 435.4 435.5 435.6 435.7 435.8 435.9 435.10 435.11 436.1 436.2 436.3 436.4 436.5 436.6 436.7 437.1 437.2 437.3 437.4 437.5 437.6 437.7 437.8 438.1 438.2 438.3 438.4 439.1 439.2 439.3 439.4 439.5 440.1 441.1 441.2 441.3 441.4 441.5 441.6 441.7 442.1 442.2 442.3 442.4 442.5 442.6 442.7 443.1 443.2 443.3 443.4 443.5 443.6 443.7 444.1 444.2 444.3 444.4 444.5 445.1 445.2 445.3 446.1 447.1 447.2 447.3 447.4 447.5 447.6 447.7 447.8 447.9 447.10 447.11 447.12 447.13 447.14 447.15 447.16 447.17 447.18 447.19 447.20 447.21 447.22 448.1 448.2 449.1 450.1 450.2 450.3 451.1 451.2 451.3 451.4 451.5 451.6 451.7 452.1 452.2 452.3 453.1 453.2 453.3 453.4 453.5 454.1 454.2 455.1 456.1 456.2 457.1 457.2 457.3 457.4 458.1 459.1 459.2 460.1 461.1 461.2 461.3 461.4 461.5 461.6 462.1 462.2 462.3 462.4 462.5 462.6 463.1 463.2 463.3 463.4 463.5 464.1 464.2 464.3 464.4 464.5 464.6 465.1 466.1 466.2 466.3 466.4 466.5 467.1 468.1 468.2 468.3 468.4 468.5 468.6 469.1 470.1 470.2 470.3 470.4 470.5 470.6 470.7 470.8 470.9 470.10 471.1 472.1 472.2 472.3 472.4 472.5 472.6 473.1 473.2 473.3 473.4 474.1 474.2 474.3 474.4 474.5 474.6 475.1 475.2 476.1 477.1 478.1 479.1 479.2 479.3 479.4 479.5 480.1 481.1 481.2 481.3 481.4 481.5 481.6 481.7 481.8 481.9 481.10 481.11 481.12 482.1 483.1 483.2 483.3 483.4 484.1 484.2 484.3 484.4 485.1 485.2 485.3 485.4 486.1 487.1 487.2 487.3 488.1 489.1 489.2 489.3 489.4 490.1 491.1 491.2 491.3 491.4 492.1 492.2 492.3 493.1 493.2 493.3 493.4 493.5 494.1 494.2 495.1 495.2 495.3 496.1 496.2 496.3 496.4 496.5 496.6 496.7 497.1 497.2 497.3 497.4 497.5 497.6 498.1 498.2 499.1 499.2 499.3 499.4 499.5 499.6 500.1 500.2 501.1 502.1 503.1 503.2 504.1 505.1 505.2 505.3 505.4 505.5 506.1 506.2 506.3 506.4 506.5 506.6 506.7 507.1 507.2 507.3 507.4 508.1 509.1 509.2 510.1 511.1 511.2 511.3 511.4 512.1 512.2 512.3 512.4 513.1 513.2 513.3 513.4 514.1 514.2 514.3 514.4 515.1 515.2 516.1 517.1 517.2 517.3 518.1 519.1 520.1 520.2 520.3 521.1 521.2 521.3 521.4 522.1 523.1 523.2 523.3 523.4 523.5 524.1 524.2 524.3 524.4 524.5 525.1 526.1 526.2 526.3 526.4 526.5 526.6 526.7 527.1 528.1 528.2 528.3 529.1 530.1 530.2 530.3 530.4 530.5 530.6 531.1 532.1 532.2 532.3 532.4 533.1 534.1 534.2 535.1 536.1 537.1 537.2 537.3 537.4 538.1 539.1 539.2 539.3 539.4 539.5 539.6 539.7 539.8 539.9 539.10 539.11 540.1 541.1 541.2 541.3 541.4 541.5 541.6 541.7 541.8 541.9 541.10 541.11 541.12 541.13 541.14 541.15 541.16 541.17 542.1 542.2 543.1 544.1 545.1 545.2 546.1 547.1 548.1 549.1 549.2 549.3 549.4 549.5 549.6 550.1 550.2 550.3 550.4 550.5 550.6 550.7 551.1 551.2 551.3 551.4 552.1 553.1 553.2 553.3 553.4 553.5 553.6 553.7 554.1 555.1 555.2 555.3 555.4 555.5 555.6 555.7 555.8 555.9 556.1 557.1 557.2 557.3 558.1 559.1 559.2 560.1 561.1 561.2 561.3 561.4 561.5 562.1 563.1 563.2 564.1 565.1 565.2 565.3 565.4 565.5 565.6 565.7 566.1 567.1 567.2 567.3 567.4 567.5 568.1 569.1 569.2 569.3 570.1 571.1 572.1 573.1 573.2 574.1 575.1 575.2 575.3 575.4 575.5 576.1 577.1 578.1 579.1 580.1 581.1 583.1 584.1 585.1 586.1 587.1 588.1 589.1 589.2 589.3 589.4 589.5 590.1 590.2 590.3 590.4 590.5 591.1 592.1 592.2 593.1 594.1 594.2 594.3 596.1 596.2 596.3 597.1 598.1 598.2 599.1 600.1 601.1 602.1 602.2 602.3 602.4 602.5 602.6 602.7 603.1 604.1 604.2 604.3 604.4 604.5 604.6 604.7 604.8 604.9 604.10 604.11 604.12 605.1 605.2 605.3 606.1 607.1 608.1 608.2 608.3 609.1 610.1 611.1 611.2 611.3 611.4 611.5 611.6 611.7 611.8 612.1 612.2 612.3 613.1 614.1 615.1 616.1 616.2 616.3 616.4 617.1 618.1 619.1 619.2 619.3 620.1 620.2 621.1 621.2 621.3 622.1 622.2 622.3 622.4 622.5 622.6 623.1 623.2 623.3 623.4 623.5 624.1 625.1 626.1 626.2 626.3 626.4 626.5 627.1 628.1 628.2 629.1 629.2 629.3 629.4 629.5 629.6 629.7 629.8 629.9 630.1 631.1 631.2 632.1 632.2 632.3 632.4 633.1 634.1 634.2 635.1 635.2 636.1 637.1 637.2 637.3 637.4 637.5 637.6 637.7 637.8 637.9 637.10 637.11 637.12 637.13 637.14 637.15 638.1 638.2 638.3 639.1 640.1 641.1 641.2 641.3 641.4 642.1 642.2 642.3 643.1 644.1 645.1 646.1 647.1 648.1 649.1 650.1 651.1 652.1 653.1 654.1 655.1 656.1 657.1 658.1 659.1 660.1 661.1 662.1 663.1 664.1 665.1 666.1 667.1 668.1 669.1 670.1 671.1 672.1 673.1 674.1 675.1 676.1
NMAP NAME nmap − Network exploration tool and security / port scanner SYNOPSIS DESCRIPTION Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. The output from Nmap is a list of scanned targets, with supplemental information on each depending on the options used. Key among that information is the “interesting ports table”.. That table lists the port number and protocol, service name, and state. The state is either open, filtered, closed, or unfiltered. Open. means that an application on the target machine is listening for connections/packets on that port. Filtered. means that a firewall, filter, or other network obstacle is blocking the port so that Nmap cannot tell whether it is open or closed. Closed. ports have no application listening on them, though they could open up at any time. Ports are classified as unfiltered. when they are responsive to Nmap's probes, but Nmap cannot determine whether they are open or closed. Nmap reports the state combinations open|filtered. and closed|filtered. when it cannot determine which of the two states describe a port. The port table may also include software version details when version detection has been requested. When an IP protocol scan is requested (−sO), Nmap provides information on supported IP protocols rather than listening ports. In addition to the interesting ports table, Nmap can provide further information on targets, including reverse DNS names, operating system guesses, device types, and MAC addresses. A typical Nmap scan is shown in Example 1. The only Nmap arguments used in this example are −A, to enable OS and version detection, script scanning, and traceroute; −T4 for faster execution; and then the hostname. Example 1. A representative Nmap scan # nmap −A −T4 scanme.nmap.org Nmap scan report for scanme.nmap.org (74.207.244.221) Host is up (0.029s latency). rDNS record for 74.207.244.221: li86−221.members.linode.com Not shown: 995 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7 (protocol 2.0) 80/tcp open http Apache httpd 2.2.14 ((Ubuntu)) |_http−title: Go ahead and ScanMe! 646/tcp filtered ldp 9929/tcp open nping−echo Nping echo Device type: general purpose Running: Linux 2.6.X OS CPE: cpe:/o:linux:linux_kernel:2.6.39 OS details: Linux 2.6.39 Network Distance: 11 hops Service Info: OS: Linux; CPE: cpe:/o:linux:kernel TRACEROUTE (using port 53/tcp) HOP RTT ADDRESS [Cut first 10 hops for brevity] Nmap done: 1 IP address (1 host up) scanned in 14.40 seconds The newest version of Nmap can be obtained from https://nmap.org. The newest version of this man page is available at https://nmap.org/book/man.html. It is also included as a chapter of Nmap Network Scanning: The Official Nmap Project Guide to Network Discovery and Security Scanning (see https://nmap.org/book/). OPTIONS SUMMARY This options summary is printed when Nmap is run with no arguments, and the latest version is always available at https://svn.nmap.org/nmap/docs/nmap.usage.txt. It helps people remember the most common options, but is no substitute for the in−depth documentation in the rest of this manual. Some obscure options aren't even included here. Nmap 7.12 ( https://nmap.org ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET SPECIFICATION: Can pass hostnames, IP addresses, networks, etc. −iL  : Input from list of hosts/networks −iR  : Choose random targets −−exclude  : Exclude hosts/networks −−excludefile  : Exclude list from file HOST DISCOVERY: −sL: List Scan − simply list targets to scan −sn: Ping Scan − disable port scan −Pn: Treat all hosts as online −− skip host discovery −PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports −PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes −PO[protocol list]: IP Protocol Ping −n/−R: Never do DNS resolution/Always resolve [default: sometimes] −−dns−servers  : Specify custom DNS servers −−system−dns: Use OS's DNS resolver −−traceroute: Trace hop path to each host SCAN TECHNIQUES: −sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans −sU: UDP Scan −sN/sF/sX: TCP Null, FIN, and Xmas scans −−scanflags  : Customize TCP scan flags −sI  : Idle scan −sY/sZ: SCTP INIT/COOKIE−ECHO scans −sO: IP protocol scan −b  : FTP bounce scan PORT SPECIFICATION AND SCAN ORDER: −p  : Only scan specified ports −−exclude−ports  : Exclude the specified ports from scanning −F: Fast mode − Scan fewer ports than the default scan −r: Scan ports consecutively − don't randomize −−top−ports  : Scan   most common ports −−port−ratio  : Scan ports more common than SERVICE/VERSION DETECTION: −sV: Probe open ports to determine service/version info −−version−intensity  : Set from 0 (light) to 9 (try all probes) −−version−light: Limit to most likely probes (intensity 2) −−version−all: Try every single probe (intensity 9) −−version−trace: Show detailed version scan activity (for debugging) SCRIPT SCAN: −sC: equivalent to −−script=default −−script= :   is a comma separated list of directories, script−files or script−categories −−script−args= : provide arguments to scripts −−script−args−file=filename: provide NSE script args in a file −−script−trace: Show all data sent and received −−script−updatedb: Update the script database. −−script−help= : Show help about scripts. is a comma−separated list of script−files or script−categories. OS DETECTION: −O: Enable OS detection −−osscan−limit: Limit OS detection to promising targets −−osscan−guess: Guess OS more aggressively TIMING AND PERFORMANCE: Options which take   are in seconds, or append 'ms' (milliseconds), 's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m). −T : Set timing template (higher is faster) −−min−hostgroup/max−hostgroup  : Parallel host scan group sizes −−min−parallelism/max−parallelism  : Probe parallelization −−min−rtt−timeout/max−rtt−timeout/initial−rtt−timeout  : Specifies probe round trip time. −−max−retries  : Caps number of port scan probe retransmissions. −−host−timeout  : Give up on target after this long −−scan−delay/−−max−scan−delay  : Adjust delay between probes −−min−rate  : Send packets no slower than   per second −−max−rate  : Send packets no faster than   per second FIREWALL/IDS EVASION AND SPOOFING: −f; −−mtu  : fragment packets (optionally w/given MTU) −D  : Cloak a scan with decoys −S  : Spoof source address −e  : Use specified interface −g/−−source−port  : Use given port number −−proxies  : Relay connections through HTTP/SOCKS4 proxies −−data  : Append a custom payload to sent packets −−data−string  : Append a custom ASCII string to sent packets −−data−length  : Append random data to sent packets −−ip−options  : Send packets with specified ip options −−ttl  : Set IP time−to−live field −−spoof−mac  : Spoof your MAC address −−badsum: Send packets with a bogus TCP/UDP/SCTP checksum OUTPUT: −oN/−oX/−oS/−oG  : Output scan in normal, XML, s|<rIpt kIddi3, and Grepable format, respectively, to the given filename. −oA  : Output in the three major formats at once −v: Increase verbosity level (use −vv or more for greater effect) −d: Increase debugging level (use −dd or more for greater effect) −−reason: Display the reason a port is in a particular state −−open: Only show open (or possibly open) ports −−packet−trace: Show all packets sent and received −−iflist: Print host interfaces and routes (for debugging) −−append−output: Append to rather than clobber specified output files −−resume  : Resume an aborted scan −−stylesheet  : XSL stylesheet to transform XML output to HTML −−webxml: Reference stylesheet from Nmap. Org for more portable XML −−no−stylesheet: Prevent associating of XSL stylesheet w/XML output MISC: −6: Enable IPv6 scanning −A: Enable OS detection, version detection, script scanning, and traceroute −−datadir  : Specify custom Nmap data file location −−send−eth/−−send−ip: Send using raw ethernet frames or IP packets −−privileged: Assume that the user is fully privileged −−unprivileged: Assume the user lacks raw socket privileges −V: Print version number −h: Print this help summary page. EXAMPLES: nmap −v −A scanme.nmap.org nmap −v −iR 10000 −Pn −p 80 SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES TARGET SPECIFICATION Everything on the Nmap command−line that isn't an option (or option argument) is treated as a target host specification. The simplest case is to specify a target IP address or hostname for scanning. Sometimes you wish to scan a whole network of adjacent hosts. For this, Nmap supports CIDR−style. addressing. You can append /numbits to an IPv4 address or hostname and Nmap will scan every IP address for which the first numbits are the same as for the reference IP or hostname given. 192.168.10.40/24 would scan exactly the same targets. Given that the host scanme.nmap.org. is at the IP address 64.13.134.52, the specification scanme.nmap.org/16 would scan the 65,536 IP addresses between 64.13.0.0 and 64.13.255.255. The smallest allowed value is /0, which targets the whole Internet. The largest value is /32, which scans just the named host or IP address because all address bits are fixed. CIDR notation is short but not always flexible enough. For example, you might want to scan 192.168.0.0/16 but skip any IPs ending with .0 or .255 because they may be used as subnet network and broadcast addresses. Nmap supports this through octet range addressing. Rather than specify a normal IP address, you can specify a comma−separated list of numbers or ranges for each octet. For example, 192.168.0−255.1−254 will skip all addresses in the range that end in .0 or .255, and 192.168.3−5,7.1 will scan the four addresses 192.168.3.1, 192.168.4.1, 192.168.5.1, and 192.168.7.1. Either side of a range may be omitted; the default values are 0 on the left and 255 on the right. Using − by itself is the same as 0−255, but remember to use 0− in the first octet so the target specification doesn't look like a command−line option. Ranges need not be limited to the final octets: the specifier 0−255.0−255.13.37 will perform an Internet−wide scan for all IP addresses ending in 13.37. This sort of broad sampling can be useful for Internet surveys and research. IPv6 addresses can be specified by their fully qualified IPv6 address or hostname or with CIDR notation for subnets. Octet ranges aren't yet supported for IPv6. IPv6 addresses with non−global scope need to have a zone ID suffix. On Unix systems, this is a percent sign followed by an interface name; a complete address might be fe80::a8bb:ccff:fedd:eeff%eth0. On Windows, use an interface index number in place of an interface name: fe80::a8bb:ccff:fedd:eeff%1. You can see a list of interface indexes by running the command netsh.exe interface ipv6 show interface. Nmap accepts multiple host specifications on the command line, and they don't need to be the same type. The command nmap scanme.nmap.org 192.168.0.0/8 10.0.0,1,3−7.− does what you would expect. While targets are usually specified on the command lines, the following options are also available to control target selection: −iL inputfilename (Input from list) . Reads target specifications from inputfilename. Passing a huge list of hosts is often awkward on the command line, yet it is a common desire. For example, your DHCP server might export a list of 10,000 current leases that you wish to scan. Or maybe you want to scan all IP addresses except for those to locate hosts using unauthorized static IP addresses. Simply generate the list of hosts to scan and pass that filename to Nmap as an argument to the −iL option. Entries can be in any of the formats accepted by Nmap on the command line (IP address, hostname, CIDR, IPv6, or octet ranges). Each entry must be separated by one or more spaces, tabs, or newlines. You can specify a hyphen (−) as the filename if you want Nmap to read hosts from standard input rather than an actual file. The input file may contain comments that start with # and extend to the end of the line. −iR num hosts (Choose random targets) . For Internet−wide surveys and other research, you may want to choose targets at random. The num hosts argument tells Nmap how many IPs to generate. Undesirable IPs such as those in certain private, multicast, or unallocated address ranges are automatically skipped. The argument 0 can be specified for a never−ending scan. Keep in mind that some network administrators bristle at unauthorized scans of their networks and may complain. Use this option at your own risk! If you find yourself really bored one rainy afternoon, try the command nmap −Pn −sS −p 80 −iR 0 −−open. to locate random web servers for browsing. −−exclude host1[,host2[,...]] (Exclude hosts/networks) . Specifies a comma−separated list of targets to be excluded from the scan even if they are part of the overall network range you specify. The list you pass in uses normal Nmap syntax, so it can include hostnames, CIDR netblocks, octet ranges, etc. This can be useful when the network you wish to scan includes untouchable mission−critical servers, systems that are known to react adversely to port scans, or subnets administered by other people. −−excludefile exclude_file (Exclude list from file) . This offers the same functionality as the −−exclude option, except that the excluded targets are provided in a newline−, space−, or tab−delimited exclude_file rather than on the command line. The exclude file may contain comments that start with # and extend to the end of the line. HOST DISCOVERY One of the very first steps in any network reconnaissance mission is to reduce a (sometimes huge) set of IP ranges into a list of active or interesting hosts. Scanning every port of every single IP address is slow and usually unnecessary. Of course what makes a host interesting depends greatly on the scan purposes. Network administrators may only be interested in hosts running a certain service, while security auditors may care about every single device with an IP address. An administrator may be comfortable using just an ICMP ping to locate hosts on his internal network, while an external penetration tester may use a diverse set of dozens of probes in an attempt to evade firewall restrictions. Because host discovery needs are so diverse, Nmap offers a wide variety of options for customizing the techniques used. Host discovery is sometimes called ping scan, but it goes well beyond the simple ICMP echo request packets associated with the ubiquitous ping tool. Users can skip the ping step entirely with a list scan (−sL) or by disabling ping (−Pn), or engage the network with arbitrary combinations of multi−port TCP SYN/ACK, UDP, SCTP INIT and ICMP probes. The goal of these probes is to solicit responses which demonstrate that an IP address is actually active (is being used by a host or network device). On many networks, only a small percentage of IP addresses are active at any given time. This is particularly common with private address space such as 10.0.0.0/8. That network has 16 million IPs, but I have seen it used by companies with less than a thousand machines. Host discovery can find those machines in a sparsely allocated sea of IP addresses. If no host discovery options are given, Nmap sends an ICMP echo request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and an ICMP timestamp request. (For IPv6, the ICMP timestamp request is omitted because it is not part of ICMPv6.) These defaults are equivalent to the −PE −PS443 −PA80 −PP options. The exceptions to this are the ARP (for IPv4) and Neighbor Discovery. (for IPv6) scans which are used for any targets on a local ethernet network. For unprivileged Unix shell users, the default probes are a SYN packet to ports 80 and 443 using the connect system call.. This host discovery is often sufficient when scanning local networks, but a more comprehensive set of discovery probes is recommended for security auditing. The −P* options (which select ping types) can be combined. You can increase your odds of penetrating strict firewalls by sending many probe types using different TCP ports/flags and ICMP codes. Also note that ARP/Neighbor Discovery (−PR). is done by default against targets on a local ethernet network even if you specify other −P* options, because it is almost always faster and more effective. By default, Nmap does host discovery and then performs a port scan against each host it determines is online. This is true even if you specify non−default host discovery types such as UDP probes (−PU). Read about the −sn option to learn how to perform only host discovery, or use −Pn to skip host discovery and port scan all target hosts. The following options control host discovery: −sL (List Scan) . The list scan is a degenerate form of host discovery that simply lists each host of the network(s) specified, without sending any packets to the target hosts. By default, Nmap still does reverse−DNS resolution on the hosts to learn their names. It is often surprising how much useful information simple hostnames give out. For example, fw.chi is the name of one company's Chicago firewall. Nmap also reports the total number of IP addresses at the end. The list scan is a good sanity check to ensure that you have proper IP addresses for your targets. If the hosts sport domain names you do not recognize, it is worth investigating further to prevent scanning the wrong company's network. Since the idea is to simply print a list of target hosts, options for higher level functionality such as port scanning, OS detection, or ping scanning cannot be combined with this. If you wish to disable ping scanning while still performing such higher level functionality, read up on the −Pn (skip ping) option. −sn (No port scan) . This option tells Nmap not to do a port scan after host discovery, and only print out the available hosts that responded to the host discovery probes. This is often known as a “ping scan”, but you can also request that traceroute and NSE host scripts be run. This is by default one step more intrusive than the list scan, and can often be used for the same purposes. It allows light reconnaissance of a target network without attracting much attention. Knowing how many hosts are up is more valuable to attackers than the list provided by list scan of every single IP and host name. Systems administrators often find this option valuable as well. It can easily be used to count available machines on a network or monitor server availability. This is often called a ping sweep, and is more reliable than pinging the broadcast address because many hosts do not reply to broadcast queries. The default host discovery done with −sn consists of an ICMP echo request, TCP SYN to port 443, TCP ACK to port 80, and an ICMP timestamp request by default. When executed by an unprivileged user, only SYN packets are sent (using a connect call) to ports 80 and 443 on the target. When a privileged user tries to scan targets on a local ethernet network, ARP requests are used unless −−send−ip was specified. The −sn option can be combined with any of the discovery probe types (the −P* options, excluding −Pn) for greater flexibility. If any of those probe type and port number options are used, the default probes are overridden. When strict firewalls are in place between the source host running Nmap and the target network, using those advanced techniques is recommended. Otherwise hosts could be missed when the firewall drops probes or their responses. In previous releases of Nmap, −sn was known as −sP.. −Pn (No ping) . This option skips the Nmap discovery stage altogether. Normally, Nmap uses this stage to determine active machines for heavier scanning. By default, Nmap only performs heavy probing such as port scans, version detection, or OS detection against hosts that are found to be up. Disabling host discovery with −Pn causes Nmap to attempt the requested scanning functions against every target IP address specified. So if a class B target address space (/16) is specified on the command line, all 65,536 IP addresses are scanned. Proper host discovery is skipped as with the list scan, but instead of stopping and printing the target list, Nmap continues to perform requested functions as if each target IP is active. To skip ping scan and port scan, while still allowing NSE to run, use the two options −Pn −sn together. For machines on a local ethernet network, ARP scanning will still be performed (unless −−disable−arp−ping or −−send−ip is specified) because Nmap needs MAC addresses to further scan target hosts. In previous versions of Nmap, −Pn was −P0. and −PN.. −PS port list (TCP SYN Ping) . This option sends an empty TCP packet with the SYN flag set. The default destination port is 80 (configurable at compile time by changing DEFAULT_TCP_PROBE_PORT_SPEC. in nmap.h).. Alternate ports can be specified as a parameter. The syntax is the same as for the −p except that port type specifiers like T: are not allowed. Note that there can be no space between −PS and the port list. If multiple probes are specified they will be sent in parallel. The SYN flag suggests to the remote system that you are attempting to establish a connection. Normally the destination port will be closed, and a RST (reset) packet sent back. If the port happens to be open, the target will take the second step of a TCP three−way−handshake. by responding with a SYN/ACK TCP packet. The machine running Nmap then tears down the nascent connection by responding with a RST rather than sending an ACK packet which would complete the three−way−handshake and establish a full connection. The RST packet is sent by the kernel of the machine running Nmap in response to the unexpected SYN/ACK, not by Nmap itself. Nmap does not care whether the port is open or closed. Either the RST or SYN/ACK response discussed previously tell Nmap that the host is available and responsive. On Unix boxes, only the privileged user root. is generally able to send and receive raw TCP packets.. For unprivileged users, a workaround is automatically employed. whereby the connect system call is initiated against each target port. This has the effect of sending a SYN packet to the target host, in an attempt to establish a connection. If connect returns with a quick success or an ECONNREFUSED failure, the underlying TCP stack must have received a SYN/ACK or RST and the host is marked available. If the connection attempt is left hanging until a timeout is reached, the host is marked as down. −PA port list (TCP ACK Ping) . The TCP ACK ping is quite similar to the just−discussed SYN ping. The difference, as you could likely guess, is that the TCP ACK flag is set instead of the SYN flag. Such an ACK packet purports to be acknowledging data over an established TCP connection, but no such connection exists. So remote hosts should always respond with a RST packet, disclosing their existence in the process. The −PA option uses the same default port as the SYN probe (80) and can also take a list of destination ports in the same format. If an unprivileged user tries this, the connect workaround discussed previously is used. This workaround is imperfect because connect is actually sending a SYN packet rather than an ACK. The reason for offering both SYN and ACK ping probes is to maximize the chances of bypassing firewalls. Many administrators configure routers and other simple firewalls to block incoming SYN packets except for those destined for public services like the company web site or mail server. This prevents other incoming connections to the organization, while allowing users to make unobstructed outgoing connections to the Internet. This non−stateful approach takes up few resources on the firewall/router and is widely supported by hardware and software filters. The Linux Netfilter/iptables. firewall software offers the −−syn convenience option to implement this stateless approach. When stateless firewall rules such as this are in place, SYN ping probes (−PS) are likely to be blocked when sent to closed target ports. In such cases, the ACK probe shines as it cuts right through these rules. Another common type of firewall uses stateful rules that drop unexpected packets. This feature was initially found mostly on high−end firewalls, though it has become much more common over the years. The Linux Netfilter/iptables system supports this through the −−state option, which categorizes packets based on connection state. A SYN probe is more likely to work against such a system, as unexpected ACK packets are generally recognized as bogus and dropped. A solution to this quandary is to send both SYN and ACK probes by specifying −PS and −PA. −PU port list (UDP Ping) . Another host discovery option is the UDP ping, which sends a UDP packet to the given ports. For most ports, the packet will be empty, though some use a protocol−specific payload that is more likely to elicit a response. The payload database is described at https://nmap.org/book/nmap-payloads.html.. −−data, −−data−string, and −−data−length options. The port list takes the same format as with the previously discussed −PS and −PA options. If no ports are specified, the default is 40125.. This default can be configured at compile−time by changing DEFAULT_UDP_PROBE_PORT_SPEC. in nmap.h.. A highly uncommon port is used by default because sending to open ports is often undesirable for this particular scan type. Upon hitting a closed port on the target machine, the UDP probe should elicit an ICMP port unreachable packet in return. This signifies to Nmap that the machine is up and available. Many other types of ICMP errors, such as host/network unreachables or TTL exceeded are indicative of a down or unreachable host. A lack of response is also interpreted this way. If an open port is reached, most services simply ignore the empty packet and fail to return any response. This is why the default probe port is 40125, which is highly unlikely to be in use. A few services, such as the Character Generator (chargen) protocol, will respond to an empty UDP packet, and thus disclose to Nmap that the machine is available. The primary advantage of this scan type is that it bypasses firewalls and filters that only screen TCP. For example, I once owned a Linksys BEFW11S4 wireless broadband router. The external interface of this device filtered all TCP ports by default, but UDP probes would still elicit port unreachable messages and thus give away the device. −PY port list (SCTP INIT Ping) . This option sends an SCTP packet containing a minimal INIT chunk. The default destination port is 80 (configurable at compile time by changing DEFAULT_SCTP_PROBE_PORT_SPEC. in nmap.h). Alternate ports can be specified as a parameter. The syntax is the same as for the −p except that port type specifiers like S: are not allowed. Examples are −PY22 and −PY22,80,179,5060. Note that there can be no space between −PY and the port list. If multiple probes are specified they will be sent in parallel. The INIT chunk suggests to the remote system that you are attempting to establish an association. Normally the destination port will be closed, and an ABORT chunk will be sent back. If the port happens to be open, the target will take the second step of an SCTP four−way−handshake. by responding with an INIT−ACK chunk. If the machine running Nmap has a functional SCTP stack, then it tears down the nascent association by responding with an ABORT chunk rather than sending a COOKIE−ECHO chunk which would be the next step in the four−way−handshake. The ABORT packet is sent by the kernel of the machine running Nmap in response to the unexpected INIT−ACK, not by Nmap itself. Nmap does not care whether the port is open or closed. Either the ABORT or INIT−ACK response discussed previously tell Nmap that the host is available and responsive. On Unix boxes, only the privileged user root. is generally able to send and receive raw SCTP packets.. Using SCTP INIT Pings is currently not possible for unprivileged users.. −PE; −PP; −PM (ICMP Ping Types) . In addition to the unusual TCP, UDP and SCTP host discovery types discussed previously, Nmap can send the standard packets sent by the ubiquitous ping program. Nmap sends an ICMP type 8 (echo request) packet to the target IP addresses, expecting a type 0 (echo reply) in return from available hosts.. Unfortunately for network explorers, many hosts and firewalls now block these packets, rather than responding as required by RFC 1122 [2] .. For this reason, ICMP−only scans are rarely reliable enough against unknown targets over the Internet. But for system administrators monitoring an internal network, they can be a practical and efficient approach. Use the −PE option to enable this echo request behavior. While echo request is the standard ICMP ping query, Nmap does not stop there. The ICMP standards (RFC 792 [3] . and RFC 950 [4] . ) also specify timestamp request, information request, and address mask request packets as codes 13, 15, and 17, respectively. While the ostensible purpose for these queries is to learn information such as address masks and current times, they can easily be used for host discovery. A system that replies is up and available. Nmap does not currently implement information request packets, as they are not widely supported. RFC 1122 insists that “a host SHOULD NOT implement these messages”. Timestamp and address mask queries can be sent with the −PP and −PM options, respectively. A timestamp reply (ICMP code 14) or address mask reply (code 18) discloses that the host is available. These two queries can be valuable when administrators specifically block echo request packets while forgetting that other ICMP queries can be used for the same purpose. −PO protocol list (IP Protocol Ping) . One of the newer host discovery options is the IP protocol ping, which sends IP packets with the specified protocol number set in their IP header. The protocol list takes the same format as do port lists in the previously discussed TCP, UDP and SCTP host discovery options. If no protocols are specified, the default is to send multiple IP packets for ICMP (protocol 1), IGMP (protocol 2), and IP−in−IP (protocol 4). The default protocols can be configured at compile−time by changing DEFAULT_PROTO_PROBE_PORT_SPEC. in nmap.h. Note that for the ICMP, IGMP, TCP (protocol 6), UDP (protocol 17) and SCTP (protocol 132), the packets are sent with the proper protocol headers. while other protocols are sent with no additional data beyond the IP header (unless any of −−data, −−data−string, or −−data−length options are specified). This host discovery method looks for either responses using the same protocol as a probe, or ICMP protocol unreachable messages which signify that the given protocol isn't supported on the destination host. Either type of response signifies that the target host is alive. −PR (ARP Ping) . One of the most common Nmap usage scenarios is to scan an ethernet LAN. On most LANs, especially those using private address ranges specified by RFC 1918 [5] , the vast majority of IP addresses are unused at any given time. When Nmap tries to send a raw IP packet such as an ICMP echo request, the operating system must determine the destination hardware (ARP) address corresponding to the target IP so that it can properly address the ethernet frame. This is often slow and problematic, since operating systems weren't written with the expectation that they would need to do millions of ARP requests against unavailable hosts in a short time period. ARP scan puts Nmap and its optimized algorithms in charge of ARP requests. And if it gets a response back, Nmap doesn't even need to worry about the IP−based ping packets since it already knows the host is up. This makes ARP scan much faster and more reliable than IP−based scans. So it is done by default when scanning ethernet hosts that Nmap detects are on a local ethernet network. Even if different ping types (such as −PE or −PS) are specified, Nmap uses ARP instead for any of the targets which are on the same LAN. If you absolutely don't want to do an ARP scan, specify −−disable−arp−ping. For IPv6 (−6 option), −PR uses ICMPv6 Neighbor Discovery instead of ARP. Neighbor Discovery, defined in RFC 4861, can be seen as the IPv6 equivalent of ARP. −−disable−arp−ping (No ARP or ND Ping) . Nmap normally does ARP or IPv6 Neighbor Discovery (ND) discovery of locally connected ethernet hosts, even if other host discovery options such as −Pn or −PE are used. To disable this implicit behavior, use the −−disable−arp−ping option. The default behavior is normally faster, but this option is useful on networks using proxy ARP, in which a router speculatively replies to all ARP requests, making every target appear to be up according to ARP scan. −−traceroute (Trace path to host) . Traceroutes are performed post−scan using information from the scan results to determine the port and protocol most likely to reach the target. It works with all scan types except connect scans (−sT) and idle scans (−sI). All traces use Nmap's dynamic timing model and are performed in parallel. Traceroute works by sending packets with a low TTL (time−to−live) in an attempt to elicit ICMP Time Exceeded messages from intermediate hops between the scanner and the target host. Standard traceroute implementations start with a TTL of 1 and increment the TTL until the destination host is reached. Nmap's traceroute starts with a high TTL and then decrements the TTL until it reaches zero. Doing it backwards lets Nmap employ clever caching algorithms to speed up traces over multiple hosts. On average Nmap sends 5–10 fewer packets per host, depending on network conditions. If a single subnet is being scanned (i.e. 192.168.0.0/24) Nmap may only have to send two packets to most hosts. −n (No DNS resolution) . Tells Nmap to never do reverse DNS resolution on the active IP addresses it finds. Since DNS can be slow even with Nmap's built−in parallel stub resolver, this option can slash scanning times. −R (DNS resolution for all targets) . Tells Nmap to always do reverse DNS resolution on the target IP addresses. Normally reverse DNS is only performed against responsive (online) hosts. −−system−dns (Use system DNS resolver) . By default, Nmap resolves IP addresses by sending queries directly to the name servers configured on your host and then listening for responses. Many requests (often dozens) are performed in parallel to improve performance. Specify this option to use your system resolver instead (one IP at a time via the getnameinfo call). This is slower and rarely useful unless you find a bug in the Nmap parallel resolver (please let us know if you do). The system resolver is always used for IPv6 scans. −−dns−servers server1[,server2[,...]] (Servers to use for reverse DNS queries) . By default, Nmap determines your DNS servers (for rDNS resolution) from your resolv.conf file (Unix) or the Registry (Win32). Alternatively, you may use this option to specify alternate servers. This option is not honored if you are using −−system−dns or an IPv6 scan. Using multiple DNS servers is often faster, especially if you choose authoritative servers for your target IP space. This option can also improve stealth, as your requests can be bounced off just about any recursive DNS server on the Internet. This option also comes in handy when scanning private networks. Sometimes only a few name servers provide proper rDNS information, and you may not even know where they are. You can scan the network for port 53 (perhaps with version detection), then try Nmap list scans (−sL) specifying each name server one at a time with −−dns−servers until you find one which works. PORT SCANNING BASICS While Nmap has grown in functionality over the years, it began as an efficient port scanner, and that remains its core function. The simple command nmap target scans 1,000 TCP ports on the host target. While many port scanners have traditionally lumped all ports into the open or closed states, Nmap is much more granular. It divides ports into six states: open, closed, filtered, unfiltered, open|filtered, or closed|filtered. These states are not intrinsic properties of the port itself, but describe how Nmap sees them. For example, an Nmap scan from the same network as the target may show port 135/tcp as open, while a scan at the same time with the same options from across the Internet might show that port as filtered. The six port states recognized by Nmap An application is actively accepting TCP connections, UDP datagrams or SCTP associations on this port. Finding these is often the primary goal of port scanning. Security−minded people know that each open port is an avenue for attack. Attackers and pen−testers want to exploit the open ports, while administrators try to close or protect them with firewalls without thwarting legitimate users. Open ports are also interesting for non−security scans because they show services available for use on the network. A closed port is accessible (it receives and responds to Nmap probe packets), but there is no application listening on it. They can be helpful in showing that a host is up on an IP address (host discovery, or ping scanning), and as part of OS detection. Because closed ports are reachable, it may be worth scanning later in case some open up. Administrators may want to consider blocking such ports with a firewall. Then they would appear in the filtered state, discussed next. Nmap cannot determine whether the port is open because packet filtering prevents its probes from reaching the port. The filtering could be from a dedicated firewall device, router rules, or host−based firewall software. These ports frustrate attackers because they provide so little information. Sometimes they respond with ICMP error messages such as type 3 code 13 (destination unreachable: communication administratively prohibited), but filters that simply drop probes without responding are far more common. This forces Nmap to retry several times just in case the probe was dropped due to network congestion rather than filtering. This slows down the scan dramatically. The unfiltered state means that a port is accessible, but Nmap is unable to determine whether it is open or closed. Only the ACK scan, which is used to map firewall rulesets, classifies ports into this state. Scanning unfiltered ports with other scan types such as Window scan, SYN scan, or FIN scan, may help resolve whether the port is open. Nmap places ports in this state when it is unable to determine whether a port is open or filtered. This occurs for scan types in which open ports give no response. The lack of response could also mean that a packet filter dropped the probe or any response it elicited. So Nmap does not know for sure whether the port is open or being filtered. The UDP, IP protocol, FIN, NULL, and Xmas scans classify ports this way. This state is used when Nmap is unable to determine whether a port is closed or filtered. It is only used for the IP ID idle scan. PORT SCANNING TECHNIQUES As a novice performing automotive repair, I can struggle for hours trying to fit my rudimentary tools (hammer, duct tape, wrench, etc.) to the task at hand. When I fail miserably and tow my jalopy to a real mechanic, he invariably fishes around in a huge tool chest until pulling out the perfect gizmo which makes the job seem effortless. The art of port scanning is similar. Experts understand the dozens of scan techniques and choose the appropriate one (or combination) for a given task. Inexperienced users and script kiddies,. on the other hand, try to solve every problem with the default SYN scan. Since Nmap is free, the only barrier to port scanning mastery is knowledge. That certainly beats the automotive world, where it may take great skill to determine that you need a strut spring compressor, then you still have to pay thousands of dollars for it. Most of the scan types are only available to privileged users.. This is because they send and receive raw packets,. which requires root access on Unix systems. Using an administrator account on Windows is recommended, though Nmap sometimes works for unprivileged users on that platform when WinPcap has already been loaded into the OS. Requiring root privileges was a serious limitation when Nmap was released in 1997, as many users only had access to shared shell accounts. Now, the world is different. Computers are cheaper, far more people have always−on direct Internet access, and desktop Unix systems (including Linux and Mac OS X) are prevalent. A Windows version of Nmap is now available, allowing it to run on even more desktops. For all these reasons, users have less need to run Nmap from limited shared shell accounts. This is fortunate, as the privileged options make Nmap far more powerful and flexible. While Nmap attempts to produce accurate results, keep in mind that all of its insights are based on packets returned by the target machines (or firewalls in front of them). Such hosts may be untrustworthy and send responses intended to confuse or mislead Nmap. Much more common are non−RFC−compliant hosts that do not respond as they should to Nmap probes. FIN, NULL, and Xmas scans are particularly susceptible to this problem. Such issues are specific to certain scan types and so are discussed in the individual scan type entries. This section documents the dozen or so port scan techniques supported by Nmap. Only one method may be used at a time, except that UDP scan (−sU) and any one of the SCTP scan types (−sY, −sZ) may be combined with any one of the TCP scan types. As a memory aid, port scan type options are of the form −sC, where C is a prominent character in the scan name, usually the first. The one exception to this is the deprecated FTP bounce scan (−b). By default, Nmap performs a SYN Scan, though it substitutes a connect scan if the user does not have proper privileges to send raw packets (requires root access on Unix). Of the scans listed in this section, unprivileged users can only execute connect and FTP bounce scans. −sS (TCP SYN scan) . SYN scan is the default and most popular scan option for good reasons. It can be performed quickly, scanning thousands of ports per second on a fast network not hampered by restrictive firewalls. It is also relatively unobtrusive and stealthy since it never completes TCP connections. SYN scan works against any compliant TCP stack rather than depending on idiosyncrasies of specific platforms as Nmap's FIN/NULL/Xmas, Maimon and idle scans do. It also allows clear, reliable differentiation between the open, closed, and filtered states. This technique is often referred to as half−open scanning, because you don't open a full TCP connection. You send a SYN packet, as if you are going to open a real connection and then wait for a response. A SYN/ACK indicates the port is listening (open), while a RST (reset) is indicative of a non−listener. If no response is received after several retransmissions, the port is marked as filtered. The port is also marked filtered if an ICMP unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received. The port is also considered open if a SYN packet (without the ACK flag) is received in response. This can be due to an extremely rare TCP feature known as a simultaneous open or split handshake connection (see https://nmap.org/misc/split-handshake.pdf). −sT (TCP connect scan) . TCP connect scan is the default TCP scan type when SYN scan is not an option. This is the case when a user does not have raw packet privileges. Instead of writing raw packets as most other scan types do, Nmap asks the underlying operating system to establish a connection with the target machine and port by issuing the connect system call. This is the same high−level system call that web browsers, P2P clients, and most other network−enabled applications use to establish a connection. It is part of a programming interface known as the Berkeley Sockets API. Rather than read raw packet responses off the wire, Nmap uses this API to obtain status information on each connection attempt. When SYN scan is available, it is usually a better choice. Nmap has less control over the high level connect call than with raw packets, making it less efficient. The system call completes connections to open target ports rather than performing the half−open reset that SYN scan does. Not only does this take longer and require more packets to obtain the same information, but target machines are more likely to log the connection. A decent IDS will catch either, but most machines have no such alarm system. Many services on your average Unix system will add a note to syslog, and sometimes a cryptic error message, when Nmap connects and then closes the connection without sending data. Truly pathetic services crash when this happens, though that is uncommon. An administrator who sees a bunch of connection attempts in her logs from a single system should know that she has been connect scanned. −sU (UDP scans) . While most popular services on the Internet run over the TCP protocol, UDP [6] services are widely deployed. DNS, SNMP, and DHCP (registered ports 53, 161/162, and 67/68) are three of the most common. Because UDP scanning is generally slower and more difficult than TCP, some security auditors ignore these ports. This is a mistake, as exploitable UDP services are quite common and attackers certainly don't ignore the whole protocol. Fortunately, Nmap can help inventory UDP ports. UDP scan is activated with the −sU option. It can be combined with a TCP scan type such as SYN scan (−sS) to check both protocols during the same run. UDP scan works by sending a UDP packet to every targeted port. For some common ports such as 53 and 161, a protocol−specific payload is sent to increase response rate, but for most ports the packet is empty unless the −−data, −−data−string, or −−data−length options are specified. If an ICMP port unreachable error (type 3, code 3) is returned, the port is closed. Other ICMP unreachable errors (type 3, codes 0, 1, 2, 9, 10, or 13) mark the port as filtered. Occasionally, a service will respond with a UDP packet, proving that it is open. If no response is received after retransmissions, the port is classified as open|filtered. This means that the port could be open, or perhaps packet filters are blocking the communication. Version detection (−sV) can be used to help differentiate the truly open ports from the filtered ones. A big challenge with UDP scanning is doing it quickly. Open and filtered ports rarely send any response, leaving Nmap to time out and then conduct retransmissions just in case the probe or response were lost. Closed ports are often an even bigger problem. They usually send back an ICMP port unreachable error. But unlike the RST packets sent by closed TCP ports in response to a SYN or connect scan, many hosts rate limit. ICMP port unreachable messages by default. Linux and Solaris are particularly strict about this. For example, the Linux 2.4.20 kernel limits destination unreachable messages to one per second (in net/ipv4/icmp.c). Nmap detects rate limiting and slows down accordingly to avoid flooding the network with useless packets that the target machine will drop. Unfortunately, a Linux−style limit of one packet per second makes a 65,536−port scan take more than 18 hours. Ideas for speeding your UDP scans up include scanning more hosts in parallel, doing a quick scan of just the popular ports first, scanning from behind the firewall, and using −−host−timeout to skip slow hosts. −sY (SCTP INIT scan) . SCTP [7] is a relatively new alternative to the TCP and UDP protocols, combining most characteristics of TCP and UDP, and also adding new features like multi−homing and multi−streaming. It is mostly being used for SS7/SIGTRAN related services but has the potential to be used for other applications as well. SCTP INIT scan is the SCTP equivalent of a TCP SYN scan. It can be performed quickly, scanning thousands of ports per second on a fast network not hampered by restrictive firewalls. Like SYN scan, INIT scan is relatively unobtrusive and stealthy, since it never completes SCTP associations. It also allows clear, reliable differentiation between the open, closed, and filtered states. This technique is often referred to as half−open scanning, because you don't open a full SCTP association. You send an INIT chunk, as if you are going to open a real association and then wait for a response. An INIT−ACK chunk indicates the port is listening (open), while an ABORT chunk is indicative of a non−listener. If no response is received after several retransmissions, the port is marked as filtered. The port is also marked filtered if an ICMP unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received. −sN; −sF; −sX (TCP NULL, FIN, and Xmas scans) . These three scan types (even more are possible with the −−scanflags option described in the next section) exploit a subtle loophole in the TCP RFC [8] to differentiate between open and closed ports. Page 65 of RFC 793 says that “if the [destination] port state is CLOSED .... an incoming segment not containing a RST causes a RST to be sent in response.” Then the next page discusses packets sent to open ports without the SYN, RST, or ACK bits set, stating that: “you are unlikely to get here, but if you do, drop the segment, and return.” When scanning systems compliant with this RFC text, any packet not containing SYN, RST, or ACK bits will result in a returned RST if the port is closed and no response at all if the port is open. As long as none of those three bits are included, any combination of the other three (FIN, PSH, and URG) are OK. Nmap exploits this with three scan types: Null scan (−sN) Does not set any bits (TCP flag header is 0) FIN scan (−sF) Sets just the TCP FIN bit. Xmas scan (−sX) Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree. These three scan types are exactly the same in behavior except for the TCP flags set in probe packets. If a RST packet is received, the port is considered closed, while no response means it is open|filtered. The port is marked filtered if an ICMP unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received. The key advantage to these scan types is that they can sneak through certain non−stateful firewalls and packet filtering routers. Another advantage is that these scan types are a little more stealthy than even a SYN scan. Don't count on this though—most modern IDS products can be configured to detect them. The big downside is that not all systems follow RFC 793 to the letter. A number of systems send RST responses to the probes regardless of whether the port is open or not. This causes all of the ports to be labeled closed. Major operating systems that do this are Microsoft Windows, many Cisco devices, BSDI, and IBM OS/400. This scan does work against most Unix−based systems though. Another downside of these scans is that they can't distinguish open ports from certain filtered ones, leaving you with the response open|filtered. −sA (TCP ACK scan) . This scan is different than the others discussed so far in that it never determines open (or even open|filtered) ports. It is used to map out firewall rulesets, determining whether they are stateful or not and which ports are filtered. The ACK scan probe packet has only the ACK flag set (unless you use −−scanflags). When scanning unfiltered systems, open and closed ports will both return a RST packet. Nmap then labels them as unfiltered, meaning that they are reachable by the ACK packet, but whether they are open or closed is undetermined. Ports that don't respond, or send certain ICMP error messages back (type 3, code 0, 1, 2, 3, 9, 10, or 13), are labeled filtered. −sW (TCP Window scan) . Window scan is exactly the same as ACK scan except that it exploits an implementation detail of certain systems to differentiate open ports from closed ones, rather than always printing unfiltered when a RST is returned. It does this by examining the TCP Window field of the RST packets returned. On some systems, open ports use a positive window size (even for RST packets) while closed ones have a zero window. So instead of always listing a port as unfiltered when it receives a RST back, Window scan lists the port as open or closed if the TCP Window value in that reset is positive or zero, respectively. This scan relies on an implementation detail of a minority of systems out on the Internet, so you can't always trust it. Systems that don't support it will usually return all ports closed. Of course, it is possible that the machine really has no open ports. If most scanned ports are closed but a few common port numbers (such as 22, 25, 53) are filtered, the system is most likely susceptible. Occasionally, systems will even show the exact opposite behavior. If your scan shows 1,000 open ports and three closed or filtered ports, then those three may very well be the truly open ones. −sM (TCP Maimon scan) . The Maimon scan is named after its discoverer, Uriel Maimon.. He described the technique in Phrack Magazine issue #49 (November 1996).. Nmap, which included this technique, was released two issues later. This technique is exactly the same as NULL, FIN, and Xmas scans, except that the probe is FIN/ACK. According to RFC 793 [8] (TCP), a RST packet should be generated in response to such a probe whether the port is open or closed. However, Uriel noticed that many BSD−derived systems simply drop the packet if the port is open. −−scanflags (Custom TCP scan) . Truly advanced Nmap users need not limit themselves to the canned scan types offered. The −−scanflags option allows you to design your own scan by specifying arbitrary TCP flags.. Let your creative juices flow, while evading intrusion detection systems. whose vendors simply paged through the Nmap man page adding specific rules! The −−scanflags argument can be a numerical flag value such as 9 (PSH and FIN), but using symbolic names is easier. Just mash together any combination of URG, ACK, PSH, RST, SYN, and FIN. For example, −−scanflags URGACKPSHRSTSYNFIN sets everything, though it's not very useful for scanning. The order these are specified in is irrelevant. In addition to specifying the desired flags, you can specify a TCP scan type (such as −sA or −sF). That base type tells Nmap how to interpret responses. For example, a SYN scan considers no−response to indicate a filtered port, while a FIN scan treats the same as open|filtered. Nmap will behave the same way it does for the base scan type, except that it will use the TCP flags you specify instead. If you don't specify a base type, SYN scan is used. −sZ (SCTP COOKIE ECHO scan) . SCTP COOKIE ECHO scan is a more advanced SCTP scan. It takes advantage of the fact that SCTP implementations should silently drop packets containing COOKIE ECHO chunks on open ports, but send an ABORT if the port is closed. The advantage of this scan type is that it is not as obvious a port scan than an INIT scan. Also, there may be non−stateful firewall rulesets blocking INIT chunks, but not COOKIE ECHO chunks. Don't be fooled into thinking that this will make a port scan invisible; a good IDS will be able to detect SCTP COOKIE ECHO scans too. The downside is that SCTP COOKIE ECHO scans cannot differentiate between open and filtered ports, leaving you with the state open|filtered in both cases. −sI zombie host[:probeport] (idle scan) . This advanced scan method allows for a truly blind TCP port scan of the target (meaning no packets are sent to the target from your real IP address). Instead, a unique side−channel attack exploits predictable IP fragmentation ID sequence generation on the zombie host to glean information about the open ports on the target. IDS systems will display the scan as coming from the zombie machine you specify (which must be up and meet certain criteria). This fascinating scan type is too complex to fully describe in this reference guide, so I wrote and posted an informal paper with full details at https://nmap.org/book/idlescan.html. Besides being extraordinarily stealthy (due to its blind nature), this scan type permits mapping out IP−based trust relationships between machines. The port listing shows open ports from the perspective of the zombie host. So you can try scanning a target using various zombies that you think might be trusted. (via router/packet filter rules). You can add a colon followed by a port number to the zombie host if you wish to probe a particular port on the zombie for IP ID changes. Otherwise Nmap will use the port it uses by default for TCP pings (80). −sO (IP protocol scan) . IP protocol scan allows you to determine which IP protocols (TCP, ICMP, IGMP, etc.) are supported by target machines. This isn't technically a port scan, since it cycles through IP protocol numbers rather than TCP or UDP port numbers. Yet it still uses the −p option to select scanned protocol numbers, reports its results within the normal port table format, and even uses the same underlying scan engine as the true port scanning methods. So it is close enough to a port scan that it belongs here. Besides being useful in its own right, protocol scan demonstrates the power of open−source software. While the fundamental idea is pretty simple, I had not thought to add it nor received any requests for such functionality. Then in the summer of 2000, Gerhard Rieger. conceived the idea, wrote an excellent patch implementing it, and sent it to the announce mailing list. (then called nmap−hackers).. I incorporated that patch into the Nmap tree and released a new version the next day. Few pieces of commercial software have users enthusiastic enough to design and contribute their own improvements! Protocol scan works in a similar fashion to UDP scan. Instead of iterating through the port number field of a UDP packet, it sends IP packet headers and iterates through the eight−bit IP protocol field. The headers are usually empty, containing no data and not even the proper header for the claimed protocol. The exceptions are TCP, UDP, ICMP, SCTP, and IGMP. A proper protocol header for those is included since some systems won't send them otherwise and because Nmap already has functions to create them. Instead of watching for ICMP port unreachable messages, protocol scan is on the lookout for ICMP protocol unreachable messages. If Nmap receives any response in any protocol from the target host, Nmap marks that protocol as open. An ICMP protocol unreachable error (type 3, code 2) causes the protocol to be marked as closed while port unreachable (type 3, code 3) marks the protocol open. Other ICMP unreachable errors (type 3, code 0, 1, 9, 10, or 13) cause the protocol to be marked filtered (though they prove that ICMP is open at the same time). If no response is received after retransmissions, the protocol is marked open|filtered −b FTP relay host (FTP bounce scan) . An interesting feature of the FTP protocol (RFC 959 [9] ) is support for so−called proxy FTP connections. This allows a user to connect to one FTP server, then ask that files be sent to a third−party server. Such a feature is ripe for abuse on many levels, so most servers have ceased supporting it. One of the abuses this feature allows is causing the FTP server to port scan other hosts. Simply ask the FTP server to send a file to each interesting port of a target host in turn. The error message will describe whether the port is open or not. This is a good way to bypass firewalls because organizational FTP servers are often placed where they have more access to other internal hosts than any old Internet host would. Nmap supports FTP bounce scan with the −b option. It takes an argument of the form username:password@server:port. Server is the name or IP address of a vulnerable FTP server. As with a normal URL, you may omit username:password, in which case anonymous login credentials (user: anonymous password:−wwwuser@) are used. The port number (and preceding colon) may be omitted as well, in which case the default FTP port (21) on server is used. This vulnerability was widespread in 1997 when Nmap was released, but has largely been fixed. Vulnerable servers are still around, so it is worth trying when all else fails. If bypassing a firewall is your goal, scan the target network for port 21 (or even for any FTP services if you scan all ports with version detection) and use the ftp−bounce. NSE script. Nmap will tell you whether the host is vulnerable or not. If you are just trying to cover your tracks, you don't need to (and, in fact, shouldn't) limit yourself to hosts on the target network. Before you go scanning random Internet addresses for vulnerable FTP servers, consider that sysadmins may not appreciate you abusing their servers in this way. PORT SPECIFICATION AND SCAN ORDER In addition to all of the scan methods discussed previously, Nmap offers options for specifying which ports are scanned and whether the scan order is randomized or sequential. By default, Nmap scans the most common 1,000 ports for each protocol. −p port ranges (Only scan specified ports) . This option specifies which ports you want to scan and overrides the default. Individual port numbers are OK, as are ranges separated by a hyphen (e.g. 1−1023). The beginning and/or end values of a range may be omitted, causing Nmap to use 1 and 65535, respectively. So you can specify −p− to scan ports from 1 through 65535. Scanning port zero. is allowed if you specify it explicitly. For IP protocol scanning (−sO), this option specifies the protocol numbers you wish to scan for (0–255). When scanning a combination of protocols (e.g. TCP and UDP), you can specify a particular protocol by preceding the port numbers by T: for TCP, U: for UDP, S: for SCTP, or P: for IP Protocol. The qualifier lasts until you specify another qualifier. For example, the argument −p U:53,111,137,T:21−25,80,139,8080 would scan UDP ports 53, 111,and 137, as well as the listed TCP ports. Note that to scan both UDP and TCP, you have to specify −sU and at least one TCP scan type (such as −sS, −sF, or −sT). If no protocol qualifier is given, the port numbers are added to all protocol lists. Ports can also be specified by name according to what the port is referred to in the nmap−services. You can even use the wildcards * and ? with the names. For example, to scan FTP and all ports whose names begin with “http”, use −p ftp,http*. Be careful about shell expansions and quote the argument to −p if unsure. Ranges of ports can be surrounded by square brackets to indicate ports inside that range that appear in nmap−services. For example, the following will scan all ports in nmap−services equal to or below 1024: −p [−1024]. Be careful with shell expansions and quote the argument to −p if unsure. −−exclude−ports port ranges (Exclude the specified ports from scanning) . This option specifies which ports you do want Nmap to exclude from scanning. The port ranges are specified similar to −p. For IP protocol scanning (−sO), this option specifies the protocol numbers you wish to exclude (0–255). When ports are asked to be excluded, they are excluded from all types of scans (i.e. they will not be scanned under any circumstances). This also includes the discovery phase. −F (Fast (limited port) scan) . Specifies that you wish to scan fewer ports than the default. Normally Nmap scans the most common 1,000 ports for each scanned protocol. With −F, this is reduced to 100. Nmap needs an nmap−services file with frequency information in order to know which ports are the most common. If port frequency information isn't available, perhaps because of the use of a custom nmap−services file, Nmap scans all named ports plus ports 1−1024. In that case, −F means to scan only ports that are named in the services file. −r (Don't randomize ports) . By default, Nmap randomizes the scanned port order (except that certain commonly accessible ports are moved near the beginning for efficiency reasons). This randomization is normally desirable, but you can specify −r for sequential (sorted from lowest to highest) port scanning instead. −−port−ratio ratio Scans all ports in nmap−services file with a ratio greater than the one given. ratio must be between 0.0 and 1.1. −−top−ports n Scans the n highest−ratio ports found in nmap−services file after excluding all ports specified by −−exclude−ports. n must be 1 or greater. SERVICE AND VERSION DETECTION Point Nmap at a remote machine and it might tell you that ports 25/tcp, 80/tcp, and 53/udp are open. Using its nmap−services. database of about 2,200 well−known services,. Nmap would report that those ports probably correspond to a mail server (SMTP), web server (HTTP), and name server (DNS) respectively. This lookup is usually accurate—the vast majority of daemons listening on TCP port 25 are, in fact, mail servers. However, you should not bet your security on this! People can and do run services on strange ports.. Even if Nmap is right, and the hypothetical server above is running SMTP, HTTP, and DNS servers, that is not a lot of information. When doing vulnerability assessments (or even simple network inventories) of your companies or clients, you really want to know which mail and DNS servers and versions are running. Having an accurate version number helps dramatically in determining which exploits a server is vulnerable to. Version detection helps you obtain this information. After TCP and/or UDP ports are discovered using one of the other scan methods, version detection interrogates those ports to determine more about what is actually running. The nmap−service−probes. database contains probes for querying various services and match expressions to recognize and parse responses. Nmap tries to determine the service protocol (e.g. FTP, SSH, Telnet, HTTP), the application name (e.g. ISC BIND, Apache httpd, Solaris telnetd), the version number, hostname, device type (e.g. printer, router), the OS family (e.g. Windows, Linux). When possible, Nmap also gets the Common Platform Enumeration (CPE). representation of this information. Sometimes miscellaneous details like whether an X server is open to connections, the SSH protocol version, or the KaZaA user name, are available. Of course, most services don't provide all of this information. If Nmap was compiled with OpenSSL support, it will connect to SSL servers to deduce the service listening behind that encryption layer.. Some UDP ports are left in the open|filtered state after a UDP port scan is unable to determine whether the port is open or filtered. Version detection will try to elicit a response from these ports (just as it does with open ports), and change the state to open if it succeeds. open|filtered TCP ports are treated the same way. Note that the Nmap −A option enables version detection among other things. A paper documenting the workings, usage, and customization of version detection is available at https://nmap.org/book/vscan.html. When RPC services are discovered, the Nmap RPC grinder. is automatically used to determine the RPC program and version numbers. It takes all the TCP/UDP ports detected as RPC and floods them with SunRPC program NULL commands in an attempt to determine whether they are RPC ports, and if so, what program and version number they serve up. Thus you can effectively obtain the same info as rpcinfo −p even if the target's portmapper is behind a firewall (or protected by TCP wrappers). Decoys do not currently work with RPC scan.. When Nmap receives responses from a service but cannot match them to its database, it prints out a special fingerprint and a URL for you to submit if to if you know for sure what is running on the port. Please take a couple minutes to make the submission so that your find can benefit everyone. Thanks to these submissions, Nmap has about 6,500 pattern matches for more than 650 protocols such as SMTP, FTP, HTTP, etc.. Version detection is enabled and controlled with the following options: −sV (Version detection) . Enables version detection, as discussed above. Alternatively, you can use −A, which enables version detection among other things. −sR. is an alias for −sV. Prior to March 2011, it was used to active the RPC grinder separately from version detection, but now these options are always combined. −−allports (Don't exclude any ports from version detection) . By default, Nmap version detection skips TCP port 9100 because some printers simply print anything sent to that port, leading to dozens of pages of HTTP GET requests, binary SSL session requests, etc. This behavior can be changed by modifying or removing the Exclude directive in nmap−service−probes, or you can specify −−allports to scan all ports regardless of any Exclude directive. −−version−intensity intensity (Set version scan intensity) . When performing a version scan (−sV), Nmap sends a series of probes, each of which is assigned a rarity value between one and nine. The lower−numbered probes are effective against a wide variety of common services, while the higher−numbered ones are rarely useful. The intensity level specifies which probes should be applied. The higher the number, the more likely it is the service will be correctly identified. However, high intensity scans take longer. The intensity must be between 0 and 9.. The default is 7.. When a probe is registered to the target port via the nmap−service−probesports directive, that probe is tried regardless of intensity level. This ensures that the DNS probes will always be attempted against any open port 53, the SSL probe will be done against 443, etc. −−version−light (Enable light mode) . This is a convenience alias for −−version−intensity 2. This light mode makes version scanning much faster, but it is slightly less likely to identify services. −−version−all (Try every single probe) . An alias for −−version−intensity 9, ensuring that every single probe is attempted against each port. −−version−trace (Trace version scan activity) . This causes Nmap to print out extensive debugging info about what version scanning is doing. It is a subset of what you get with −−packet−trace. OS DETECTION One of Nmap's best−known features is remote OS detection using TCP/IP stack fingerprinting. Nmap sends a series of TCP and UDP packets to the remote host and examines practically every bit in the responses. After performing dozens of tests such as TCP ISN sampling, TCP options support and ordering, IP ID sampling, and the initial window size check, Nmap compares the results to its nmap−os−db. database of more than 2,600 known OS fingerprints and prints out the OS details if there is a match. Each fingerprint includes a freeform textual description of the OS, and a classification which provides the vendor name (e.g. Sun), underlying OS (e.g. Solaris), OS generation (e.g. 10), and device type (general purpose, router, switch, game console, etc). Most fingerprints also have a Common Platform Enumeration (CPE). representation, like cpe:/o:linux:linux_kernel:2.6. If Nmap is unable to guess the OS of a machine, and conditions are good (e.g. at least one open port and one closed port were found), Nmap will provide a URL you can use to submit the fingerprint if you know (for sure) the OS running on the machine. By doing this you contribute to the pool of operating systems known to Nmap and thus it will be more accurate for everyone. OS detection enables some other tests which make use of information that is gathered during the process anyway. One of these is TCP Sequence Predictability Classification. This measures approximately how hard it is to establish a forged TCP connection against the remote host. It is useful for exploiting source−IP based trust relationships (rlogin, firewall filters, etc) or for hiding the source of an attack. This sort of spoofing is rarely performed any more, but many machines are still vulnerable to it. The actual difficulty number is based on statistical sampling and may fluctuate. It is generally better to use the English classification such as “worthy challenge” or “trivial joke”. This is only reported in normal output in verbose (−v) mode. When verbose mode is enabled along with −O, IP ID sequence generation is also reported. Most machines are in the “incremental” class, which means that they increment the ID field in the IP header for each packet they send. This makes them vulnerable to several advanced information gathering and spoofing attacks. Another bit of extra information enabled by OS detection is a guess at a target's uptime. This uses the TCP timestamp option (RFC 1323 [10] ) to guess when a machine was last rebooted. The guess can be inaccurate due to the timestamp counter not being initialized to zero or the counter overflowing and wrapping around, so it is printed only in verbose mode. A paper documenting the workings, usage, and customization of OS detection is available at https://nmap.org/book/osdetect.html. OS detection is enabled and controlled with the following options: −O (Enable OS detection) . Enables OS detection, as discussed above. Alternatively, you can use −A to enable OS detection along with other things. −−osscan−limit (Limit OS detection to promising targets) . OS detection is far more effective if at least one open and one closed TCP port are found. Set this option and Nmap will not even try OS detection against hosts that do not meet this criteria. This can save substantial time, particularly on −Pn scans against many hosts. It only matters when OS detection is requested with −O or −A. −−osscan−guess; −−fuzzy (Guess OS detection results) . When Nmap is unable to detect a perfect OS match, it sometimes offers up near−matches as possibilities. The match has to be very close for Nmap to do this by default. Either of these (equivalent) options make Nmap guess more aggressively. Nmap will still tell you when an imperfect match is printed and display its confidence level (percentage) for each guess. −−max−os−tries (Set the maximum number of OS detection tries against a target) . When Nmap performs OS detection against a target and fails to find a perfect match, it usually repeats the attempt. By default, Nmap tries five times if conditions are favorable for OS fingerprint submission, and twice when conditions aren't so good. Specifying a lower −−max−os−tries value (such as 1) speeds Nmap up, though you miss out on retries which could potentially identify the OS. Alternatively, a high value may be set to allow even more retries when conditions are favorable. This is rarely done, except to generate better fingerprints for submission and integration into the Nmap OS database. NMAP SCRIPTING ENGINE (NSE) The Nmap Scripting Engine (NSE) is one of Nmap's most powerful and flexible features. It allows users to write (and share) simple scripts (using the Lua programming language [11] . ) to automate a wide variety of networking tasks. Those scripts are executed in parallel with the speed and efficiency you expect from Nmap. Users can rely on the growing and diverse set of scripts distributed with Nmap, or write their own to meet custom needs. Tasks we had in mind when creating the system include network discovery, more sophisticated version detection, vulnerability detection. NSE can even be used for vulnerability exploitation. To reflect those different uses and to simplify the choice of which scripts to run, each script contains a field associating it with one or more categories. Currently defined categories are auth, broadcast, default. discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, and vuln. These are all described at https://nmap.org/book/nse-usage.html#nse-categories. Scripts are not run in a sandbox and thus could accidentally or maliciously damage your system or invade your privacy. Never run scripts from third parties unless you trust the authors or have carefully audited the scripts yourself. The Nmap Scripting Engine is described in detail at https://nmap.org/book/nse.html and is controlled by the following options: −sC . Performs a script scan using the default set of scripts. It is equivalent to −−script=default. Some of the scripts in this category are considered intrusive and should not be run against a target network without permission. −−script filename|category|directory|expression[,...] . Runs a script scan using the comma−separated list of filenames, script categories, and directories. Each element in the list may also be a Boolean expression describing a more complex set of scripts. Each element is interpreted first as an expression, then as a category, and finally as a file or directory name. There are two special features for advanced users only. One is to prefix script names and expressions with + to force them to run even if they normally wouldn't (e.g. the relevant service wasn't detected on the target port). The other is that the argument all may be used to specify every script in Nmap's database. Be cautious with this because NSE contains dangerous scripts such as exploits, brute force authentication crackers, and denial of service attacks. File and directory names may be relative or absolute. Absolute names are used directly. Relative paths are looked for in the scripts of each of the following places until found: −−datadir $NMAPDIR. ~/.nmap (not searched on Windows). HOME\AppData\Roaming\nmap (only on Windows). the directory containing the nmap executable the directory containing the nmap executable, followed by ../share/nmap NMAPDATADIR. the current directory. When a directory name is given, Nmap loads every file in the directory whose name ends with .nse. All other files are ignored and directories are not searched recursively. When a filename is given, it does not have to have the .nse extension; it will be added automatically if necessary. Nmap scripts are stored in a scripts subdirectory of the Nmap data directory by default (see https://nmap.org/book/data-files.html). For efficiency, scripts are indexed in a database stored in scripts/script.db,. which lists the category or categories in which each script belongs. When referring to scripts from script.db by name, you can use a shell−style ‘*’ wildcard. nmap −−script "http−*" Loads all scripts whose name starts with http−, such as http−auth and http−open−proxy. The argument to −−script had to be in quotes to protect the wildcard from the shell. More complicated script selection can be done using the and, or, and not operators to build Boolean expressions. The operators have the same precedence [12] as in Lua: not is the highest, followed by and and then or. You can alter precedence by using parentheses. Because expressions contain space characters it is necessary to quote them. nmap −−script "not intrusive" Loads every script except for those in the intrusive category. nmap −−script "default or safe" This is functionally equivalent to nmap −−script "default,safe". It loads all scripts that are in the default category or the safe category or both. nmap −−script "default and safe" Loads those scripts that are in both the default and safe categories. nmap −−script "(default or safe or intrusive) and not http−*" Loads scripts in the default, safe, or intrusive categories, except for those whose names start with http−. −−script−args n1=v1,n2={n3=v3},n4={v4,v5} . Lets you provide arguments to NSE scripts. Arguments are a comma−separated list of name=value pairs. Names and values may be strings not containing whitespace or the characters ‘{’, ‘}’, ‘=’, or ‘,’. To include one of these characters in a string, enclose the string in single or double quotes. Within a quoted string, ‘\’ escapes a quote. A backslash is only used to escape quotation marks in this special case; in all other cases a backslash is interpreted literally. Values may also be tables enclosed in {}, just as in Lua. A table may contain simple string values or more name−value pairs, including nested tables. Many scripts qualify their arguments with the script name, as in xmpp−info.server_name. You may use that full qualified version to affect just the specified script, or you may pass the unqualified version (server_name in this case) to affect all scripts using that argument name. A script will first check for its fully qualified argument name (the name specified in its documentation) before it accepts an unqualified argument name. A complex example of script arguments is −−script−args 'user=foo,pass=",{}=bar",whois={whodb=nofollow+ripe},xmpp−info.server_name=localhost'. The online NSE Documentation Portal at https://nmap.org/nsedoc/ lists the arguments that each script accepts. −−script−args−file filename . Lets you load arguments to NSE scripts from a file. Any arguments on the command line supersede ones in the file. The file can be an absolute path, or a path relative to Nmap's usual search path (NMAPDIR, etc.) Arguments can be comma−separated or newline−separated, but otherwise follow the same rules as for −−script−args, without requiring special quoting and escaping, since they are not parsed by the shell. −−script−help filename|category|directory|expression|all[,...] . Shows help about scripts. For each script matching the given specification, Nmap prints the script name, its categories, and its description. The specifications are the same as those accepted by −−script; so for example if you want help about the ftp−anon script, you would run nmap −−script−help ftp−anon. In addition to getting help for individual scripts, you can use this as a preview of what scripts will be run for a specification, for example with nmap −−script−help default. −−script−trace . This option does what −−packet−trace does, just one ISO layer higher. If this option is specified all incoming and outgoing communication performed by a script is printed. The displayed information includes the communication protocol, the source, the target and the transmitted data. If more than 5% of all transmitted data is not printable, then the trace output is in a hex dump format. Specifying −−packet−trace enables script tracing too. −−script−updatedb . This option updates the script database found in scripts/script.db which is used by Nmap to determine the available default scripts and categories. It is only necessary to update the database if you have added or removed NSE scripts from the default scripts directory or if you have changed the categories of any script. This option is generally used by itself: nmap −−script−updatedb. TIMING AND PERFORMANCE One of my highest Nmap development priorities has always been performance. A default scan (nmap hostname) of a host on my local network takes a fifth of a second. That is barely enough time to blink, but adds up when you are scanning hundreds or thousands of hosts. Moreover, certain scan options such as UDP scanning and version detection can increase scan times substantially. So can certain firewall configurations, particularly response rate limiting. While Nmap utilizes parallelism and many advanced algorithms to accelerate these scans, the user has ultimate control over how Nmap runs. Expert users carefully craft Nmap commands to obtain only the information they care about while meeting their time constraints. Techniques for improving scan times include omitting non−critical tests, and upgrading to the latest version of Nmap (performance enhancements are made frequently). Optimizing timing parameters can also make a substantial difference. Those options are listed below. Some options accept a time parameter. This is specified in seconds by default, though you can append ‘ms’, ‘s’, ‘m’, or ‘h’ to the value to specify milliseconds, seconds, minutes, or hours. So the −−host−timeout arguments 900000ms, 900, 900s, and 15m all do the same thing. −−min−hostgroup numhosts; −−max−hostgroup numhosts (Adjust parallel scan group sizes) . Nmap has the ability to port scan or version scan multiple hosts in parallel. Nmap does this by dividing the target IP space into groups and then scanning one group at a time. In general, larger groups are more efficient. The downside is that host results can't be provided until the whole group is finished. So if Nmap started out with a group size of 50, the user would not receive any reports (except for the updates offered in verbose mode) until the first 50 hosts are completed. By default, Nmap takes a compromise approach to this conflict. It starts out with a group size as low as five so the first results come quickly and then increases the groupsize to as high as 1024. The exact default numbers depend on the options given. For efficiency reasons, Nmap uses larger group sizes for UDP or few−port TCP scans. When a maximum group size is specified with −−max−hostgroup, Nmap will never exceed that size. Specify a minimum size with −−min−hostgroup and Nmap will try to keep group sizes above that level. Nmap may have to use smaller groups than you specify if there are not enough target hosts left on a given interface to fulfill the specified minimum. Both may be set to keep the group size within a specific range, though this is rarely desired. These options do not have an effect during the host discovery phase of a scan. This includes plain ping scans (−sn). Host discovery always works in large groups of hosts to improve speed and accuracy. The primary use of these options is to specify a large minimum group size so that the full scan runs more quickly. A common choice is 256 to scan a network in Class C sized chunks. For a scan with many ports, exceeding that number is unlikely to help much. For scans of just a few port numbers, host group sizes of 2048 or more may be helpful. −−min−parallelism numprobes; −−max−parallelism numprobes (Adjust probe parallelization) . These options control the total number of probes that may be outstanding for a host group. They are used for port scanning and host discovery. By default, Nmap calculates an ever−changing ideal parallelism based on network performance. If packets are being dropped, Nmap slows down and allows fewer outstanding probes. The ideal probe number slowly rises as the network proves itself worthy. These options place minimum or maximum bounds on that variable. By default, the ideal parallelism can drop to one if the network proves unreliable and rise to several hundred in perfect conditions. The most common usage is to set −−min−parallelism to a number higher than one to speed up scans of poorly performing hosts or networks. This is a risky option to play with, as setting it too high may affect accuracy. Setting this also reduces Nmap's ability to control parallelism dynamically based on network conditions. A value of 10 might be reasonable, though I only adjust this value as a last resort. The −−max−parallelism option is sometimes set to one to prevent Nmap from sending more than one probe at a time to hosts. The −−scan−delay option, discussed later, is another way to do this. −−min−rtt−timeout time, −−max−rtt−timeout time, −−initial−rtt−timeout time (Adjust probe timeouts) . Nmap maintains a running timeout value for determining how long it will wait for a probe response before giving up or retransmitting the probe. This is calculated based on the response times of previous probes. If the network latency shows itself to be significant and variable, this timeout can grow to several seconds. It also starts at a conservative (high) level and may stay that way for a while when Nmap scans unresponsive hosts. Specifying a lower −−max−rtt−timeout and −−initial−rtt−timeout than the defaults can cut scan times significantly. This is particularly true for pingless (−Pn) scans, and those against heavily filtered networks. Don't get too aggressive though. The scan can end up taking longer if you specify such a low value that many probes are timing out and retransmitting while the response is in transit. If all the hosts are on a local network, 100 milliseconds (−−max−rtt−timeout 100ms) is a reasonable aggressive value. If routing is involved, ping a host on the network first with the ICMP ping utility, or with a custom packet crafter such as Nping. that is more likely to get through a firewall. Look at the maximum round trip time out of ten packets or so. You might want to double that for the −−initial−rtt−timeout and triple or quadruple it for the −−max−rtt−timeout. I generally do not set the maximum RTT below 100 ms, no matter what the ping times are. Nor do I exceed 1000 ms. −−min−rtt−timeout is a rarely used option that could be useful when a network is so unreliable that even Nmap's default is too aggressive. Since Nmap only reduces the timeout down to the minimum when the network seems to be reliable, this need is unusual and should be reported as a bug to the nmap−dev mailing list.. −−max−retries numtries (Specify the maximum number of port scan probe retransmissions) . When Nmap receives no response to a port scan probe, it could mean the port is filtered. Or maybe the probe or response was simply lost on the network. It is also possible that the target host has rate limiting enabled that temporarily blocked the response. So Nmap tries again by retransmitting the initial probe. If Nmap detects poor network reliability, it may try many more times before giving up on a port. While this benefits accuracy, it also lengthen scan times. When performance is critical, scans may be sped up by limiting the number of retransmissions allowed. You can even specify −−max−retries 0 to prevent any retransmissions, though that is only recommended for situations such as informal surveys where occasional missed ports and hosts are acceptable. The default (with no −T template) is to allow ten retransmissions. If a network seems reliable and the target hosts aren't rate limiting, Nmap usually only does one retransmission. So most target scans aren't even affected by dropping −−max−retries to a low value such as three. Such values can substantially speed scans of slow (rate limited) hosts. You usually lose some information when Nmap gives up on ports early, though that may be preferable to letting the −−host−timeout expire and losing all information about the target. −−host−timeout time (Give up on slow target hosts) . Some hosts simply take a long time to scan. This may be due to poorly performing or unreliable networking hardware or software, packet rate limiting, or a restrictive firewall. The slowest few percent of the scanned hosts can eat up a majority of the scan time. Sometimes it is best to cut your losses and skip those hosts initially. Specify −−host−timeout with the maximum amount of time you are willing to wait. For example, specify 30m to ensure that Nmap doesn't waste more than half an hour on a single host. Note that Nmap may be scanning other hosts at the same time during that half an hour, so it isn't a complete loss. A host that times out is skipped. No port table, OS detection, or version detection results are printed for that host. −−scan−delay time; −−max−scan−delay time (Adjust delay between probes) . This option causes Nmap to wait at least the given amount of time between each probe it sends to a given host. This is particularly useful in the case of rate limiting.. Solaris machines (among many others) will usually respond to UDP scan probe packets with only one ICMP message per second. Any more than that sent by Nmap will be wasteful. A −−scan−delay of 1s will keep Nmap at that slow rate. Nmap tries to detect rate limiting and adjust the scan delay accordingly, but it doesn't hurt to specify it explicitly if you already know what rate works best. When Nmap adjusts the scan delay upward to cope with rate limiting, the scan slows down dramatically. The −−max−scan−delay option specifies the largest delay that Nmap will allow. A low −−max−scan−delay can speed up Nmap, but it is risky. Setting this value too low can lead to wasteful packet retransmissions and possible missed ports when the target implements strict rate limiting. Another use of −−scan−delay is to evade threshold based intrusion detection and prevention systems (IDS/IPS).. −−min−rate number; −−max−rate number (Directly control the scanning rate) . Nmap's dynamic timing does a good job of finding an appropriate speed at which to scan. Sometimes, however, you may happen to know an appropriate scanning rate for a network, or you may have to guarantee that a scan will be finished by a certain time. Or perhaps you must keep Nmap from scanning too quickly. The −−min−rate and −−max−rate options are designed for these situations. When the −−min−rate option is given Nmap will do its best to send packets as fast as or faster than the given rate. The argument is a positive real number representing a packet rate in packets per second. For example, specifying −−min−rate 300 means that Nmap will try to keep the sending rate at or above 300 packets per second. Specifying a minimum rate does not keep Nmap from going faster if conditions warrant. Likewise, −−max−rate limits a scan's sending rate to a given maximum. Use −−max−rate 100, for example, to limit sending to 100 packets per second on a fast network. Use −−max−rate 0.1 for a slow scan of one packet every ten seconds. Use −−min−rate and −−max−rate together to keep the rate inside a certain range. These two options are global, affecting an entire scan, not individual hosts. They only affect port scans and host discovery scans. Other features like OS detection implement their own timing. There are two conditions when the actual scanning rate may fall below the requested minimum. The first is if the minimum is faster than the fastest rate at which Nmap can send, which is dependent on hardware. In this case Nmap will simply send packets as fast as possible, but be aware that such high rates are likely to cause a loss of accuracy. The second case is when Nmap has nothing to send, for example at the end of a scan when the last probes have been sent and Nmap is waiting for them to time out or be responded to. It's normal to see the scanning rate drop at the end of a scan or in between hostgroups. The sending rate may temporarily exceed the maximum to make up for unpredictable delays, but on average the rate will stay at or below the maximum. Specifying a minimum rate should be done with care. Scanning faster than a network can support may lead to a loss of accuracy. In some cases, using a faster rate can make a scan take longer than it would with a slower rate. This is because Nmap's adaptive retransmission algorithms will detect the network congestion caused by an excessive scanning rate and increase the number of retransmissions in order to improve accuracy. So even though packets are sent at a higher rate, more packets are sent overall. Cap the number of retransmissions with the −−max−retries option if you need to set an upper limit on total scan time. −−defeat−rst−ratelimit . Many hosts have long used rate limiting. to reduce the number of ICMP error messages (such as port−unreachable errors) they send. Some systems now apply similar rate limits to the RST (reset) packets they generate. This can slow Nmap down dramatically as it adjusts its timing to reflect those rate limits. You can tell Nmap to ignore those rate limits (for port scans such as SYN scan which don't treat non−responsive ports as open) by specifying −−defeat−rst−ratelimit. Using this option can reduce accuracy, as some ports will appear non−responsive because Nmap didn't wait long enough for a rate−limited RST response. With a SYN scan, the non−response results in the port being labeled filtered rather than the closed state we see when RST packets are received. This option is useful when you only care about open ports, and distinguishing between closed and filtered ports isn't worth the extra time. −−nsock−engine epoll|kqueue|poll|select . Enforce use of a given nsock IO multiplexing engine. Only the select(2)−based fallback engine is guaranteed to be available on your system. Engines are named after the name of the IO management facility they leverage. Engines currently implemented are epoll, kqueue, poll, and select, but not all will be present on any platform. Use nmap −V to see which engines are supported. −T paranoid|sneaky|polite|normal|aggressive|insane (Set a timing template) . While the fine−grained timing controls discussed in the previous section are powerful and effective, some people find them confusing. Moreover, choosing the appropriate values can sometimes take more time than the scan you are trying to optimize. So Nmap offers a simpler approach, with six timing templates. You can specify them with the −T option and their number (0–5) or their name. The template names are paranoid (0), sneaky (1), polite (2), normal (3), aggressive (4), and insane (5). The first two are for IDS evasion. Polite mode slows down the scan to use less bandwidth and target machine resources. Normal mode is the default and so −T3 does nothing. Aggressive mode speeds scans up by making the assumption that you are on a reasonably fast and reliable network. Finally insane mode. assumes that you are on an extraordinarily fast network or are willing to sacrifice some accuracy for speed. These templates allow the user to specify how aggressive they wish to be, while leaving Nmap to pick the exact timing values. The templates also make some minor speed adjustments for which fine−grained control options do not currently exist. For example, −T4. prohibits the dynamic scan delay from exceeding 10 ms for TCP ports and −T5 caps that value at 5 ms. Templates can be used in combination with fine−grained controls, and the fine−grained controls will you specify will take precedence over the timing template default for that parameter. I recommend using −T4 when scanning reasonably modern and reliable networks. Keep that option even when you add fine−grained controls so that you benefit from those extra minor optimizations that it enables. If you are on a decent broadband or ethernet connection, I would recommend always using −T4. Some people love −T5 though it is too aggressive for my taste. People sometimes specify −T2 because they think it is less likely to crash hosts or because they consider themselves to be polite in general. They often don't realize just how slow −T polite. really is. Their scan may take ten times longer than a default scan. Machine crashes and bandwidth problems are rare with the default timing options (−T3) and so I normally recommend that for cautious scanners. Omitting version detection is far more effective than playing with timing values at reducing these problems. While −T0. and −T1. may be useful for avoiding IDS alerts, they will take an extraordinarily long time to scan thousands of machines or ports. For such a long scan, you may prefer to set the exact timing values you need rather than rely on the canned −T0 and −T1 values. The main effects of T0 are serializing the scan so only one port is scanned at a time, and waiting five minutes between sending each probe. T1 and T2 are similar but they only wait 15 seconds and 0.4 seconds, respectively, between probes. is Nmap's default behavior, which includes parallelization. −T4 does the equivalent of −−max−rtt−timeout 1250ms −−min−rtt−timeout 100ms −−initial−rtt−timeout 500ms −−max−retries 6 and sets the maximum TCP scan delay to 10 milliseconds. T5 does the equivalent of −−max−rtt−timeout 300ms −−min−rtt−timeout 50ms −−initial−rtt−timeout 250ms −−max−retries 2 −−host−timeout 15m as well as setting the maximum TCP scan delay to 5 ms. FIREWALL/IDS EVASION AND SPOOFING Many Internet pioneers envisioned a global open network with a universal IP address space allowing virtual connections between any two nodes. This allows hosts to act as true peers, serving and retrieving information from each other. People could access all of their home systems from work, changing the climate control settings or unlocking the doors for early guests. This vision of universal connectivity has been stifled by address space shortages and security concerns. In the early 1990s, organizations began deploying firewalls for the express purpose of reducing connectivity. Huge networks were cordoned off from the unfiltered Internet by application proxies, network address translation, and packet filters. The unrestricted flow of information gave way to tight regulation of approved communication channels and the content that passes over them. Network obstructions such as firewalls can make mapping a network exceedingly difficult. It will not get any easier, as stifling casual reconnaissance is often a key goal of implementing the devices. Nevertheless, Nmap offers many features to help understand these complex networks, and to verify that filters are working as intended. It even supports mechanisms for bypassing poorly implemented defenses. One of the best methods of understanding your network security posture is to try to defeat it. Place yourself in the mind−set of an attacker, and deploy techniques from this section against your networks. Launch an FTP bounce scan, idle scan, fragmentation attack, or try to tunnel through one of your own proxies. In addition to restricting network activity, companies are increasingly monitoring traffic with intrusion detection systems (IDS). All of the major IDSs ship with rules designed to detect Nmap scans because scans are sometimes a precursor to attacks. Many of these products have recently morphed into intrusion prevention systems (IPS). that actively block traffic deemed malicious. Unfortunately for network administrators and IDS vendors, reliably detecting bad intentions by analyzing packet data is a tough problem. Attackers with patience, skill, and the help of certain Nmap options can usually pass by IDSs undetected. Meanwhile, administrators must cope with large numbers of false positive results where innocent activity is misdiagnosed and alerted on or blocked. Occasionally people suggest that Nmap should not offer features for evading firewall rules or sneaking past IDSs. They argue that these features are just as likely to be misused by attackers as used by administrators to enhance security. The problem with this logic is that these methods would still be used by attackers, who would just find other tools or patch the functionality into Nmap. Meanwhile, administrators would find it that much harder to do their jobs. Deploying only modern, patched FTP servers is a far more powerful defense than trying to prevent the distribution of tools implementing the FTP bounce attack. There is no magic bullet (or Nmap option) for detecting and subverting firewalls and IDS systems. It takes skill and experience. A tutorial is beyond the scope of this reference guide, which only lists the relevant options and describes what they do. −f (fragment packets); −−mtu (using the specified MTU) . The −f option causes the requested scan (including ping scans) to use tiny fragmented IP packets. The idea is to split up the TCP header over several packets to make it harder for packet filters, intrusion detection systems, and other annoyances to detect what you are doing. Be careful with this! Some programs have trouble handling these tiny packets. The old−school sniffer named Sniffit segmentation faulted immediately upon receiving the first fragment. Specify this option once, and Nmap splits the packets into eight bytes or less after the IP header. So a 20−byte TCP header would be split into three packets. Two with eight bytes of the TCP header, and one with the final four. Of course each fragment also has an IP header. Specify −f again to use 16 bytes per fragment (reducing the number of fragments).. Or you can specify your own offset size with the −−mtu option. Don't also specify −f if you use −−mtu. The offset must be a multiple of eight. While fragmented packets won't get by packet filters and firewalls that queue all IP fragments, such as the CONFIG_IP_ALWAYS_DEFRAG option in the Linux kernel, some networks can't afford the performance hit this causes and thus leave it disabled. Others can't enable this because fragments may take different routes into their networks. Some source systems defragment outgoing packets in the kernel. Linux with the iptables. connection tracking module is one such example. Do a scan while a sniffer such as Wireshark. is running to ensure that sent packets are fragmented. If your host OS is causing problems, try the −−send−eth. option to bypass the IP layer and send raw ethernet frames. Fragmentation is only supported for Nmap's raw packet features, which includes TCP and UDP port scans (except connect scan and FTP bounce scan) and OS detection. Features such as version detection and the Nmap Scripting Engine generally don't support fragmentation because they rely on your host's TCP stack to communicate with target services. −D decoy1[,decoy2][,ME][,...] (Cloak a scan with decoys) . Causes a decoy scan to be performed, which makes it appear to the remote host that the host(s) you specify as decoys are scanning the target network too. Thus their IDS might report 5–10 port scans from unique IP addresses, but they won't know which IP was scanning them and which were innocent decoys. While this can be defeated through router path tracing, response−dropping, and other active mechanisms, it is generally an effective technique for hiding your IP address. Separate each decoy host with commas, and you can optionally use ME. as one of the decoys to represent the position for your real IP address. If you put ME in the sixth position or later, some common port scan detectors (such as Solar Designer's. excellent Scanlogd). are unlikely to show your IP address at all. If you don't use ME, Nmap will put you in a random position. You can also use RND. to generate a random, non−reserved IP address, or RND:number to generate number addresses. Note that the hosts you use as decoys should be up or you might accidentally SYN flood your targets. Also it will be pretty easy to determine which host is scanning if only one is actually up on the network. You might want to use IP addresses instead of names (so the decoy networks don't see you in their nameserver logs). Decoys are used both in the initial ping scan (using ICMP, SYN, ACK, or whatever) and during the actual port scanning phase. Decoys are also used during remote OS detection (−O). Decoys do not work with version detection or TCP connect scan. When a scan delay is in effect, the delay is enforced between each batch of spoofed probes, not between each individual probe. Because decoys are sent as a batch all at once, they may temporarily violate congestion control limits. It is worth noting that using too many decoys may slow your scan and potentially even make it less accurate. Also, some ISPs will filter out your spoofed packets, but many do not restrict spoofed IP packets at all. −S IP_Address (Spoof source address) . In some circumstances, Nmap may not be able to determine your source address (Nmap will tell you if this is the case). In this situation, use −S with the IP address of the interface you wish to send packets through. Another possible use of this flag is to spoof the scan to make the targets think that someone else is scanning them. Imagine a company being repeatedly port scanned by a competitor! The −e option and −Pn are generally required for this sort of usage. Note that you usually won't receive reply packets back (they will be addressed to the IP you are spoofing), so Nmap won't produce useful reports. −e interface (Use specified interface) . Tells Nmap what interface to send and receive packets on. Nmap should be able to detect this automatically, but it will tell you if it cannot. −−source−port portnumber; −g portnumber (Spoof source port number) . One surprisingly common misconfiguration is to trust traffic based only on the source port number. It is easy to understand how this comes about. An administrator will set up a shiny new firewall, only to be flooded with complaints from ungrateful users whose applications stopped working. In particular, DNS may be broken because the UDP DNS replies from external servers can no longer enter the network. FTP is another common example. In active FTP transfers, the remote server tries to establish a connection back to the client to transfer the requested file. Secure solutions to these problems exist, often in the form of application−level proxies or protocol−parsing firewall modules. Unfortunately there are also easier, insecure solutions. Noting that DNS replies come from port 53 and active FTP from port 20, many administrators have fallen into the trap of simply allowing incoming traffic from those ports. They often assume that no attacker would notice and exploit such firewall holes. In other cases, administrators consider this a short−term stop−gap measure until they can implement a more secure solution. Then they forget the security upgrade. Overworked network administrators are not the only ones to fall into this trap. Numerous products have shipped with these insecure rules. Even Microsoft has been guilty. The IPsec filters that shipped with Windows 2000 and Windows XP contain an implicit rule that allows all TCP or UDP traffic from port 88 (Kerberos). In another well−known case, versions of the Zone Alarm personal firewall up to 2.1.25 allowed any incoming UDP packets with the source port 53 (DNS) or 67 (DHCP). Nmap offers the −g and −−source−port options (they are equivalent) to exploit these weaknesses. Simply provide a port number and Nmap will send packets from that port where possible. Most scanning operations that use raw sockets, including SYN and UDP scans, support the option completely. The option notably doesn't have an effect for any operations that use normal operating system sockets, including DNS requests, TCP connect scan,. version detection, and script scanning. Setting the source port also doesn't work for OS detection, because Nmap must use different port numbers for certain OS detection tests to work properly. −−data hex string (Append custom binary data to sent packets) . This option lets you include binary data as payload in sent packets. hex string may be specified in any of the following formats: 0xAABBCCDDEEFF..., AABBCCDDEEFF... or \xAA\xBB\xCC\xDD\xEE\xFF.... Examples of use are −−data 0xdeadbeef and −−data \xCA\xFE\x09. Note that if you specify a number like 0x00ff no byte−order conversion is performed. Make sure you specify the information in the byte order expected by the receiver. −−data−string string (Append custom string to sent packets) . This option lets you include a regular string as payload in sent packets. string can contain any string. However, note that some characters may depend on your system's locale and the receiver may not see the same information. Also, make sure you enclose the string in double quotes and escape any special characters from the shell. Examples: −−data−string "Scan conducted by Security Ops, extension 7192" or −−data−string "Ph34r my l33t skills". Keep in mind that nobody is likely to actually see any comments left by this option unless they are carefully monitoring the network with a sniffer or custom IDS rules. −−data−length number (Append random data to sent packets) . Normally Nmap sends minimalist packets containing only a header. So its TCP packets are generally 40 bytes and ICMP echo requests are just 28. Some UDP ports. and IP protocols. get a custom payload by default. This option tells Nmap to append the given number of random bytes to most of the packets it sends, and not to use any protocol−specific payloads. (Use −−data−length 0 for no random or protocol−specific payloads.. OS detection (−O) packets are not affected. because accuracy there requires probe consistency, but most pinging and portscan packets support this. It slows things down a little, but can make a scan slightly less conspicuous. −−ip−options S|R [route]|L [route]|T|U ... ; −−ip−options hex string (Send packets with specified ip options) . The IP protocol [13] offers several options which may be placed in packet headers. Unlike the ubiquitous TCP options, IP options are rarely seen due to practicality and security concerns. In fact, many Internet routers block the most dangerous options such as source routing. Yet options can still be useful in some cases for determining and manipulating the network route to target machines. For example, you may be able to use the record route option to determine a path to a target even when more traditional traceroute−style approaches fail. Or if your packets are being dropped by a certain firewall, you may be able to specify a different route with the strict or loose source routing options. The most powerful way to specify IP options is to simply pass in values as the argument to −−ip−options. Precede each hex number with \x then the two digits. You may repeat certain characters by following them with an asterisk and then the number of times you wish them to repeat. For example, \x01\x07\x04\x00*36\x01 is a hex string containing 36 NUL bytes. Nmap also offers a shortcut mechanism for specifying options. Simply pass the letter R, T, or U to request record−route,. record−timestamp,. or both options together, respectively. Loose or strict source routing. may be specified with an L or S followed by a space and then a space−separated list of IP addresses. If you wish to see the options in packets sent and received, specify −−packet−trace. For more information and examples of using IP options with Nmap, see http://seclists.org/nmap-dev/2006/q3/52. −−ttl value (Set IP time−to−live field) . Sets the IPv4 time−to−live field in sent packets to the given value. −−randomize−hosts (Randomize target host order) . Tells Nmap to shuffle each group of up to 16384 hosts before it scans them. This can make the scans less obvious to various network monitoring systems, especially when you combine it with slow timing options. If you want to randomize over larger group sizes, increase PING_GROUP_SZ. in nmap.h. and recompile. An alternative solution is to generate the target IP list with a list scan (−sL −n −oN filename), randomize it with a Perl script, then provide the whole list to Nmap with −iL.. −−spoof−mac MAC address, prefix, or vendor name (Spoof MAC address) . Asks Nmap to use the given MAC address for all of the raw ethernet frames it sends. This option implies −−send−eth. to ensure that Nmap actually sends ethernet−level packets. The MAC given can take several formats. If it is simply the number 0, Nmap chooses a completely random MAC address for the session. If the given string is an even number of hex digits (with the pairs optionally separated by a colon), Nmap will use those as the MAC. If fewer than 12 hex digits are provided, Nmap fills in the remainder of the six bytes with random values. If the argument isn't a zero or hex string, Nmap looks through nmap−mac−prefixes to find a vendor name containing the given string (it is case insensitive). If a match is found, Nmap uses the vendor's OUI (three−byte prefix). and fills out the remaining three bytes randomly. Valid −−spoof−mac argument examples are Apple, 0, 01:02:03:04:05:06, deadbeefcafe, 0020F2, and Cisco. This option only affects raw packet scans such as SYN scan or OS detection, not connection−oriented features such as version detection or the Nmap Scripting Engine. −−proxies Comma−separated list of proxy URLs (Relay TCP connections through a chain of proxies) . Asks Nmap to establish TCP connections with a final target through supplied chain of one or more HTTP or SOCKS4 proxies. Proxies can help hide the true source of a scan or evade certain firewall restrictions, but they can hamper scan performance by increasing latency. Users may need to adjust Nmap timeouts and other scan parameters accordingly. In particular, a lower −−max−parallelism may help because some proxies refuse to handle as many concurrent connections as Nmap opens by default. This option takes a list of proxies as argument, expressed as URLs in the format proto://host:port. Use commas to separate node URLs in a chain. No authentication is supported yet. Valid protocols are HTTP and SOCKS4. Warning: this feature is still under development and has limitations. It is implemented within the nsock library and thus has no effect on the ping, port scanning and OS discovery phases of a scan. Only NSE and version scan benefit from this option so far—other features may disclose your true address. SSL connections are not yet supported, nor is proxy−side DNS resolution (hostnames are always resolved by Nmap). −−badsum (Send packets with bogus TCP/UDP checksums) . Asks Nmap to use an invalid TCP, UDP or SCTP checksum for packets sent to target hosts. Since virtually all host IP stacks properly drop these packets, any responses received are likely coming from a firewall or IDS that didn't bother to verify the checksum. For more details on this technique, see https://nmap.org/p60-12.html −−adler32 (Use deprecated Adler32 instead of CRC32C for SCTP checksums) . Asks Nmap to use the deprecated Adler32 algorithm for calculating the SCTP checksum. If −−adler32 is not given, CRC−32C (Castagnoli) is used. RFC 2960 [14] originally defined Adler32 as checksum algorithm for SCTP; RFC 4960 [7] later redefined the SCTP checksums to use CRC−32C. Current SCTP implementations should be using CRC−32C, but in order to elicit responses from old, legacy SCTP implementations, it may be preferable to use Adler32. OUTPUT Any security tool is only as useful as the output it generates. Complex tests and algorithms are of little value if they aren't presented in an organized and comprehensible fashion. Given the number of ways Nmap is used by people and other software, no single format can please everyone. So Nmap offers several formats, including the interactive mode for humans to read directly and XML for easy parsing by software. In addition to offering different output formats, Nmap provides options for controlling the verbosity of output as well as debugging messages. Output types may be sent to standard output or to named files, which Nmap can append to or clobber. Output files may also be used to resume aborted scans. Nmap makes output available in five different formats. The default is called interactive output,. and it is sent to standard output (stdout).. There is also normal output,. which is similar to interactive except that it displays less runtime information and warnings since it is expected to be analyzed after the scan completes rather than interactively. XML output. is one of the most important output types, as it can be converted to HTML, easily parsed by programs such as Nmap graphical user interfaces, or imported into databases. The two remaining output types are the simple grepable output. which includes most information for a target host on a single line, and sCRiPt KiDDi3 0utPUt. for users who consider themselves |<−r4d. While interactive output is the default and has no associated command−line options, the other four format options use the same syntax. They take one argument, which is the filename that results should be stored in. Multiple formats may be specified, but each format may only be specified once. For example, you may wish to save normal output for your own review while saving XML of the same scan for programmatic analysis. You might do this with the options −oX myscan.xml −oN myscan.nmap. While this chapter uses the simple names like myscan.xml for brevity, more descriptive names are generally recommended. The names chosen are a matter of personal preference, though I use long ones that incorporate the scan date and a word or two describing the scan, placed in a directory named after the company I'm scanning. While these options save results to files, Nmap still prints interactive output to stdout as usual. For example, the command nmap −oX myscan.xml target prints XML to myscan.xml and fills standard output with the same interactive results it would have printed if −oX wasn't specified at all. You can change this by passing a hyphen character as the argument to one of the format types. This causes Nmap to deactivate interactive output, and instead print results in the format you specified to the standard output stream. So the command nmap −oX − target will send only XML output to stdout.. Serious errors may still be printed to the normal error stream, stderr.. Unlike some Nmap arguments, the space between the logfile option flag (such as −oX) and the filename or hyphen is mandatory. If you omit the flags and give arguments such as −oG− or −oXscan.xml, a backwards compatibility feature of Nmap will cause the creation of normal format output files named G− and Xscan.xml respectively. All of these arguments support strftime−like. conversions in the filename. %H, %M, %S, %m, %d, %y, and %Y are all exactly the same as in strftime. %T is the same as %H%M%S, %R is the same as %H%M, and %D is the same as %m%d%y. A % followed by any other character just yields that character (%% gives you a percent symbol). So −oX 'scan−%T−%D.xml' will use an XML file with a name in the form of scan−144840−121307.xml. Nmap also offers options to control scan verbosity and to append to output files rather than clobbering them. All of these options are described below. Nmap Output Formats −oN filespec (normal output) . Requests that normal output be directed to the given filename. As discussed above, this differs slightly from interactive output. −oX filespec (XML output) . Requests that XML output be directed to the given filename. Nmap includes a document type definition (DTD) which allows XML parsers to validate Nmap XML output. While it is primarily intended for programmatic use, it can also help humans interpret Nmap XML output. The DTD defines the legal elements of the format, and often enumerates the attributes and values they can take on. The latest version is always available from https://svn.nmap.org/nmap/docs/nmap.dtd. XML offers a stable format that is easily parsed by software. Free XML parsers are available for all major computer languages, including C/C++, Perl, Python, and Java. People have even written bindings for most of these languages to handle Nmap output and execution specifically. Examples are Nmap::Scanner [15] . and Nmap::Parser [16] . in Perl CPAN. In almost all cases that a non−trivial application interfaces with Nmap, XML is the preferred format. The XML output references an XSL stylesheet which can be used to format the results as HTML. The easiest way to use this is simply to load the XML output in a web browser such as Firefox or IE. By default, this will only work on the machine you ran Nmap on (or a similarly configured one) due to the hard−coded nmap.xsl filesystem path. Use the −−webxml or −−stylesheet options to create portable XML files that render as HTML on any web−connected machine. −oS filespec (ScRipT KIdd|3 oUTpuT) . Script kiddie output is like interactive output, except that it is post−processed to better suit the l33t HaXXorZ who previously looked down on Nmap due to its consistent capitalization and spelling. Humor impaired people should note that this option is making fun of the script kiddies before flaming me for supposedly “helping them”. −oG filespec (grepable output) . This output format is covered last because it is deprecated. The XML output format is far more powerful, and is nearly as convenient for experienced users. XML is a standard for which dozens of excellent parsers are available, while grepable output is my own simple hack. XML is extensible to support new Nmap features as they are released, while I often must omit those features from grepable output for lack of a place to put them. Nevertheless, grepable output is still quite popular. It is a simple format that lists each host on one line and can be trivially searched and parsed with standard Unix tools such as grep, awk, cut, sed, diff, and Perl. Even I usually use it for one−off tests done at the command line. Finding all the hosts with the SSH port open or that are running Solaris takes only a simple grep to identify the hosts, piped to an awk or cut command to print the desired fields. Grepable output consists of comments (lines starting with a pound (#)). and target lines. A target line includes a combination of six labeled fields, separated by tabs and followed with a colon. The fields are Host, Ports, Protocols, Ignored State, OS, Seq Index, IP ID, and Status. The most important of these fields is generally Ports, which gives details on each interesting port. It is a comma separated list of port entries. Each port entry represents one interesting port, and takes the form of seven slash (/) separated subfields. Those subfields are: Port number, State, Protocol, Owner, Service, SunRPC info, and Version info. As with XML output, this man page does not allow for documenting the entire format. A more detailed look at the Nmap grepable output format is available from https://nmap.org/book/output-formats-grepable-output.html. −oA basename (Output to all formats) . As a convenience, you may specify −oA basename to store scan results in normal, XML, and grepable formats at once. They are stored in basename.nmap, basename.xml, and basename.gnmap, respectively. As with most programs, you can prefix the filenames with a directory path, such as ~/nmaplogs/foocorp/ on Unix or c:\hacking\sco on Windows. Verbosity and debugging options −v (Increase verbosity level) . Increases the verbosity level, causing Nmap to print more information about the scan in progress. Open ports are shown as they are found and completion time estimates are provided when Nmap thinks a scan will take more than a few minutes. Use it twice or more for even greater verbosity: −vv, or give a verbosity level directly, for example −v3.. Most changes only affect interactive output, and some also affect normal and script kiddie output. The other output types are meant to be processed by machines, so Nmap can give substantial detail by default in those formats without fatiguing a human user. However, there are a few changes in other modes where output size can be reduced substantially by omitting some detail. For example, a comment line in the grepable output that provides a list of all ports scanned is only printed in verbose mode because it can be quite long. −d (Increase debugging level) . When even verbose mode doesn't provide sufficient data for you, debugging is available to flood you with much more! As with the verbosity option (−v), debugging is enabled with a command−line flag (−d) and the debug level can be increased by specifying it multiple times,. as in −dd, or by setting a level directly. For example, −d9 sets level nine. That is the highest effective level and will produce thousands of lines unless you run a very simple scan with very few ports and targets. Debugging output is useful when a bug is suspected in Nmap, or if you are simply confused as to what Nmap is doing and why. As this feature is mostly intended for developers, debug lines aren't always self−explanatory. You may get something like: Timeout vals: srtt: −1 rttvar: −1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar: 14987 to: 100000. If you don't understand a line, your only recourses are to ignore it, look it up in the source code, or request help from the development list (nmap−dev).. Some lines are self explanatory, but the messages become more obscure as the debug level is increased. −−reason (Host and port state reasons) . Shows the reason each port is set to a specific state and the reason each host is up or down. This option displays the type of the packet that determined a port or hosts state. For example, A RST packet from a closed port or an echo reply from an alive host. The information Nmap can provide is determined by the type of scan or ping. The SYN scan and SYN ping (−sS and −PS) are very detailed, but the TCP connect scan (−sT) is limited by the implementation of the connect system call. This feature is automatically enabled by the debug option (−d). and the results are stored in XML log files even if this option is not specified. −−stats−every time (Print periodic timing stats) . Periodically prints a timing status message after each interval of time. The time is a specification of the kind described in the section called “TIMING AND PERFORMANCE”; so for example, use −−stats−every 10s to get a status update every 10 seconds. Updates are printed to interactive output (the screen) and XML output. −−packet−trace (Trace packets and data sent and received) . Causes Nmap to print a summary of every packet sent or received. This is often used for debugging, but is also a valuable way for new users to understand exactly what Nmap is doing under the covers. To avoid printing thousands of lines, you may want to specify a limited number of ports to scan, such as −p20−30. If you only care about the goings on of the version detection subsystem, use −−version−trace instead. If you only care about script tracing, specify −−script−trace. With −−packet−trace, you get all of the above. −−open (Show only open (or possibly open) ports) . Sometimes you only care about ports you can actually connect to (open ones), and don't want results cluttered with closed, filtered, and closed|filtered ports. Output customization is normally done after the scan using tools such as grep, awk, and Perl, but this feature was added due to overwhelming requests. Specify −−open to only see hosts with at least one open, open|filtered, or unfiltered port, and only see ports in those states. These three states are treated just as they normally are, which means that open|filtered and unfiltered may be condensed into counts if there are an overwhelming number of them. −−iflist (List interfaces and routes) . Prints the interface list and system routes as detected by Nmap. This is useful for debugging routing problems or device mischaracterization (such as Nmap treating a PPP connection as ethernet). Miscellaneous output options −−append−output (Append to rather than clobber output files) . When you specify a filename to an output format flag such as −oX or −oN, that file is overwritten by default. If you prefer to keep the existing content of the file and append the new results, specify the −−append−output option. All output filenames specified in that Nmap execution will then be appended to rather than clobbered. This doesn't work well for XML (−oX) scan data as the resultant file generally won't parse properly until you fix it up by hand. −−resume filename (Resume aborted scan) . Some extensive Nmap runs take a very long time—on the order of days. Such scans don't always run to completion. Restrictions may prevent Nmap from being run during working hours, the network could go down, the machine Nmap is running on might suffer a planned or unplanned reboot, or Nmap itself could crash. The administrator running Nmap could cancel it for any other reason as well, by pressing ctrl−C. Restarting the whole scan from the beginning may be undesirable. Fortunately, if normal (−oN) or grepable (−oG) logs were kept, the user can ask Nmap to resume scanning with the target it was working on when execution ceased. Simply specify the −−resume option and pass the normal/grepable output file as its argument. No other arguments are permitted, as Nmap parses the output file to use the same ones specified previously. Simply call Nmap as nmap −−resume logfilename. Nmap will append new results to the data files specified in the previous execution. Resumption does not support the XML output format because combining the two runs into one valid XML file would be difficult. −−stylesheet path or URL (Set XSL stylesheet to transform XML output) . Nmap ships with an XSL. stylesheet. named nmap.xsl. for viewing or translating XML output to HTML.. The XML output includes an xml−stylesheet directive which points to nmap.xml where it was initially installed by Nmap. Run the XML file through an XSLT processor such as xsltproc [17] . to produce an HTML file. Directly opening the XML file in a browser no longer works well because modern browsers limit the locations a stylesheet may be loaded from. If you wish to use a different stylesheet, specify it as the argument to −−stylesheet. You must pass the full pathname or URL. One common invocation is −−stylesheet https://nmap.org/svn/docs/nmap.xsl. This tells an XSLT processor to load the latest version of the stylesheet from Nmap. Org. The −−webxml option does the same thing with less typing and memorization. Loading the XSL from Nmap. Org makes it easier to view results on a machine that doesn't have Nmap (and thus nmap.xsl) installed. So the URL is often more useful, but the local filesystem location of nmap.xsl is used by default for privacy reasons. −−webxml (Load stylesheet from Nmap. Org) . This is a convenience option, nothing more than an alias for −−stylesheet https://nmap.org/svn/docs/nmap.xsl. −−no−stylesheet (Omit XSL stylesheet declaration from XML) . Specify this option to prevent Nmap from associating any XSL stylesheet with its XML output. The xml−stylesheet directive is omitted. MISCELLANEOUS OPTIONS This section describes some important (and not−so−important) options that don't really fit anywhere else. −6 (Enable IPv6 scanning) . Nmap has IPv6 support for its most popular features. Ping scanning, port scanning, version detection, and the Nmap Scripting Engine all support IPv6. The command syntax is the same as usual except that you also add the −6 option. Of course, you must use IPv6 syntax if you specify an address rather than a hostname. An address might look like 3ffe:7501:4819:2000:210:f3ff:fe03:14d0, so hostnames are recommended. The output looks the same as usual, with the IPv6 address on the “interesting ports” line being the only IPv6 giveaway. While IPv6 hasn't exactly taken the world by storm, it gets significant use in some (usually Asian) countries and most modern operating systems support it. To use Nmap with IPv6, both the source and target of your scan must be configured for IPv6. If your ISP (like most of them) does not allocate IPv6 addresses to you, free tunnel brokers are widely available and work fine with Nmap. I use the free IPv6 tunnel broker. service at http://www.tunnelbroker.net. Other tunnel brokers are listed at Wikipedia [18] . 6to4 tunnels are another popular, free approach. On Windows, raw−socket IPv6 scans are supported only on ethernet devices (not tunnels), and only on Windows Vista. and later. Use the −−unprivileged. option in other situations. −A (Aggressive scan options) . This option enables additional advanced and aggressive options. Presently this enables OS detection (−O), version scanning (−sV), script scanning (−sC) and traceroute (−−traceroute).. More features may be added in the future. The point is to enable a comprehensive set of scan options without people having to remember a large set of flags. However, because script scanning with the default set is considered intrusive, you should not use −A against target networks without permission. This option only enables features, and not timing options (such as −T4) or verbosity options (−v) that you might want as well. Options which require privileges (e.g. root access) such as OS detection and traceroute will only be enabled if those privileges are available. −−datadir directoryname (Specify custom Nmap data file location) . Nmap obtains some special data at runtime in files named nmap−service−probes, nmap−services, nmap−protocols, nmap−rpc, nmap−mac−prefixes, and nmap−os−db. If the location of any of these files has been specified (using the −−servicedb or −−versiondb options), that location is used for that file. After that, Nmap searches these files in the directory specified with the −−datadir option (if any). Any files not found there, are searched for in the directory specified by the NMAPDIR. environment variable. Next comes ~/.nmap. for real and effective UIDs; or on Windows, HOME\AppData\Roaming\nmap (where HOME is the user's home directory, like C:\Users\user). This is followed by the location of the nmap executable and the same location with ../share/nmap appended. Then a compiled−in location such as /usr/local/share/nmap or /usr/share/nmap. −−servicedb services file (Specify custom services file) . Asks Nmap to use the specified services file rather than the nmap−services data file that comes with Nmap. Using this option also causes a fast scan (−F) to be used. See the description for −−datadir for more information on Nmap's data files. −−versiondb service probes file (Specify custom service probes file) . Asks Nmap to use the specified service probes file rather than the nmap−service−probes data file that comes with Nmap. See the description for −−datadir for more information on Nmap's data files. −−send−eth (Use raw ethernet sending) . Asks Nmap to send packets at the raw ethernet (data link) layer rather than the higher IP (network) layer. By default, Nmap chooses the one which is generally best for the platform it is running on. Raw sockets (IP layer). are generally most efficient for Unix machines, while ethernet frames are required for Windows operation since Microsoft disabled raw socket support. Nmap still uses raw IP packets on Unix despite this option when there is no other choice (such as non−ethernet connections). −−send−ip (Send at raw IP level) . Asks Nmap to send packets via raw IP sockets rather than sending lower level ethernet frames. It is the complement to the −−send−eth option discussed previously. −−privileged (Assume that the user is fully privileged) . Tells Nmap to simply assume that it is privileged enough to perform raw socket sends, packet sniffing, and similar operations that usually require root privileges. on Unix systems. By default Nmap quits if such operations are requested but geteuid is not zero. −−privileged is useful with Linux kernel capabilities and similar systems that may be configured to allow unprivileged users to perform raw−packet scans. Be sure to provide this option flag before any flags for options that require privileges (SYN scan, OS detection, etc.). The NMAP_PRIVILEGED. environment variable may be set as an equivalent alternative to −−privileged. −−unprivileged (Assume that the user lacks raw socket privileges) . This option is the opposite of −−privileged. It tells Nmap to treat the user as lacking network raw socket and sniffing privileges. This is useful for testing, debugging, or when the raw network functionality of your operating system is somehow broken. The NMAP_UNPRIVILEGED. environment variable may be set as an equivalent alternative to −−unprivileged. −−release−memory (Release memory before quitting) . This option is only useful for memory−leak debugging. It causes Nmap to release allocated memory just before it quits so that actual memory leaks are easier to spot. Normally Nmap skips this as the OS does this anyway upon process termination. −V; −−version (Print version number) . Prints the Nmap version number and exits. −h; −−help (Print help summary page) . Prints a short help screen with the most common command flags. Running Nmap without any arguments does the same thing. RUNTIME INTERACTION During the execution of Nmap, all key presses are captured. This allows you to interact with the program without aborting and restarting it. Certain special keys will change options, while any other keys will print out a status message telling you about the scan. The convention is that lowercase letters increase the amount of printing, and uppercase letters decrease the printing. You may also press ‘?’ for help. v / V Increase / decrease the verbosity level d / D Increase / decrease the debugging Level p / P Turn on / off packet tracing Print a runtime interaction help screen Anything else Print out a status message like this: Stats: 0:00:07 elapsed; 20 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 33.33% done; ETC: 20:57 (0:00:12 remaining) EXAMPLES Here are some Nmap usage examples, from the simple and routine to a little more complex and esoteric. Some actual IP addresses and domain names are used to make things more concrete. In their place you should substitute addresses/names from your own network. While I don't think port scanning other networks is or should be illegal, some network administrators don't appreciate unsolicited scanning of their networks and may complain. Getting permission first is the best approach. For testing purposes, you have permission to scan the host scanme.nmap.org.. This permission only includes scanning via Nmap and not testing exploits or denial of service attacks. To conserve bandwidth, please do not initiate more than a dozen scans against that host per day. If this free scanning target service is abused, it will be taken down and Nmap will report Failed to resolve given hostname/IP: scanme.nmap.org. These permissions also apply to the hosts scanme2.nmap.org, scanme3.nmap.org, and so on, though those hosts do not currently exist. nmap −v scanme.nmap.org. This option scans all reserved TCP ports on the machine scanme.nmap.org . The −v option enables verbose mode. nmap −sS −O scanme.nmap.org/24. Launches a stealth SYN scan against each machine that is up out of the 256 IPs on the class C sized network where Scanme resides. It also tries to determine what operating system is running on each host that is up and running. This requires root privileges because of the SYN scan and OS detection. Launches host enumeration and a TCP scan at the first half of each of the 255 possible eight−bit subnets in the 198.116 class B address space. This tests whether the systems run SSH, DNS, POP3, or IMAP on their standard ports, or anything on port 4564. For any of these ports found open, version detection is used to determine what application is running. nmap −v −iR 100000 −Pn −p 80. Asks Nmap to choose 100,000 hosts at random and scan them for web servers (port 80). Host enumeration is disabled with −Pn since first sending a couple probes to determine whether a host is up is wasteful when you are only probing one port on each target host anyway. nmap −Pn −p80 −oX logs/pb−port80scan.xml −oG logs/pb−port80scan.gnmap 216.163.128.20/20. This scans 4096 IPs for any web servers (without pinging them) and saves the output in grepable and XML formats. NMAP BOOK While this reference guide details all material Nmap options, it can't fully demonstrate how to apply those features to quickly solve real−world tasks. For that, we released Nmap Network Scanning: The Official Nmap Project Guide to Network Discovery and Security Scanning. Topics include subverting firewalls and intrusion detection systems, optimizing Nmap performance, and automating common networking tasks with the Nmap Scripting Engine. Hints and instructions are provided for common Nmap tasks such as taking network inventory, penetration testing, detecting rogue wireless access points, and quashing network worm outbreaks. Examples and diagrams show actual communication on the wire. More than half of the book is available free online. See https://nmap.org/book for more information. BUGS Like its author, Nmap isn't perfect. But you can help make it better by sending bug reports or even writing patches. If Nmap doesn't behave the way you expect, first upgrade to the latest version available from https://nmap.org. If the problem persists, do some research to determine whether it has already been discovered and addressed. Try searching for the error message on our search page at http://insecure.org/search.html or at Google. Also try browsing the nmap−dev archives at http://seclists.org/.. Read this full manual page as well. If nothing comes of this, mail a bug report to  . Please include everything you have learned about the problem, as well as what version of Nmap you are running and what operating system version it is running on. Problem reports and Nmap usage questions sent to   are far more likely to be answered than those sent to Fyodor directly. If you subscribe to the nmap−dev list before posting, your message will bypass moderation and get through more quickly. Subscribe at https://nmap.org/mailman/listinfo/dev. Code patches to fix bugs are even better than bug reports. Basic instructions for creating patch files with your changes are available at https://svn.nmap.org/nmap/HACKING. Patches may be sent to nmap−dev (recommended) or to Fyodor directly. AUTHOR Gordon “Fyodor” Lyon   (http://insecure.org) Hundreds of people have made valuable contributions to Nmap over the years. These are detailed in the CHANGELOG. file which is distributed with Nmap and also available from https://nmap.org/changelog.html. LEGAL NOTICES Nmap Copyright and Licensing The Nmap Security Scanner is (C) 1996–2015 Insecure. Com LLC. Nmap is also a registered trademark of Insecure. Com LLC. This program is free software; you may redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; Version 2 (“GPL”), BUT ONLY WITH ALL OF THE CLARIFICATIONS AND EXCEPTIONS DESCRIBED HEREIN. This guarantees your right to use, modify, and redistribute this software under certain conditions. If you wish to embed Nmap technology into proprietary software, we sell alternative licenses (contact  ). Dozens of software vendors already license Nmap technology such as host discovery, port scanning, OS detection, version detection, and the Nmap Scripting Engine. Note that the GPL places important restrictions on “derivative works”, yet it does not provide a detailed definition of that term. To avoid misunderstandings, we interpret that term as broadly as copyright law allows. For example, we consider an application to constitute a derivative work for the purpose of this license if it does any of the following with any software or content covered by this license (“Covered Software”): • Integrates source code from Covered Software. • Reads or includes copyrighted data files, such as Nmap's nmap−os−db or nmap−service−probes. • Is designed specifically to execute Covered Software and parse the results (as opposed to typical shell or execution−menu apps, which will execute anything you tell them to). • Includes Covered Software in a proprietary executable installer. The installers produced by InstallShield are an example of this. Including Nmap with other software in compressed or archival form does not trigger this provision, provided appropriate open source decompression or de−archiving software is widely available for no charge. For the purposes of this license, an installer is considered to include Covered Software even if it actually retrieves a copy of Covered Software from another source during runtime (such as by downloading it from the Internet). • Links (statically or dynamically) to a library which does any of the above. • Executes a helper program, module, or script to do any of the above. This list is not exclusive, but is meant to clarify our interpretation of derived works with some common examples. Other people may interpret the plain GPL differently, so we consider this a special exception to the GPL that we apply to Covered Software. Works which meet any of these conditions must conform to all of the terms of this license, particularly including the GPL Section 3 requirements of providing source code and allowing free redistribution of the work as a whole. As another special exception to the GPL terms, Insecure. Com LLC grants permission to link the code of this program with any version of the OpenSSL library which is distributed under a license identical to that listed in the included docs/licenses/OpenSSL.txt file, and distribute linked combinations including the two.. Any redistribution of Covered Software, including any derived works, must obey and carry forward all of the terms of this license, including obeying all GPL rules and restrictions. For example, source code of the whole work must be provided and free redistribution must be allowed. All GPL references to "this License", are to be treated as including the terms and conditions of this license text as well. Because this license imposes special exceptions to the GPL, Covered Work may not be combined (even as part of a larger work) with plain GPL software. The terms, conditions, and exceptions of this license must be included as well. This license is incompatible with some other open source licenses as well. In some cases we can relicense portions of Nmap or grant special permissions to use it in other open source software. Please contact fyodor@nmap.org with any such requests. Similarly, we don't incorporate incompatible open source software into Covered Software without special permission from the copyright holders. If you have any questions about the licensing restrictions on using Nmap in other works, are happy to help. As mentioned above, we also offer alternative license to integrate Nmap into proprietary applications and appliances. These contracts have been sold to dozens of software vendors, and generally include a perpetual license as well as providing for priority support and updates. They also fund the continued development of Nmap. Please email   for further information. If you have received a written license agreement or contract for Covered Software stating terms other than these, you may choose to use and redistribute Covered Software under those terms instead of these. Creative Commons License for this Nmap Guide This Nmap Reference Guide is (C) 2005–2012 Insecure. Com LLC. It is hereby placed under version 3.0 of the Creative Commons Attribution License [19] . This allows you redistribute and modify the work as you desire, as long as you credit the original source. Alternatively, you may choose to treat this document as falling under the same license as Nmap itself (discussed previously). Source Code Availability and Community Contributions Source is provided to this software because we believe users have a right to know exactly what a program is going to do before they run it. This also allows you to audit the software for security holes. Source code also allows you to port Nmap to new platforms, fix bugs, and add new features. You are highly encouraged to send your changes to   for possible incorporation into the main distribution. By sending these changes to Fyodor or one of the Insecure. Org development mailing lists, it is assumed that you are offering the Nmap Project (Insecure. Com LLC) the unlimited, non−exclusive right to reuse, modify, and relicense the code. Nmap will always be available open source,. but this is important because the inability to relicense code has caused devastating problems for other Free Software projects (such as KDE and NASM). We also occasionally relicense the code to third parties as discussed above. If you wish to specify special license conditions of your contributions, just say so when you send them. No Warranty. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License v2.0 for more details at http://www.gnu.org/licenses/gpl-2.0.html, or in the COPYING file included with Nmap. It should also be noted that Nmap has occasionally been known to crash poorly written applications, TCP/IP stacks, and even operating systems.. While this is extremely rare, it is important to keep in mind. Nmap should never be run against mission critical systems unless you are prepared to suffer downtime. We acknowledge here that Nmap may crash your systems or networks and we disclaim all liability for any damage or problems Nmap could cause. Inappropriate Usage Because of the slight risk of crashes and because a few black hats like to use Nmap for reconnaissance prior to attacking systems, there are administrators who become upset and may complain when their system is scanned. Thus, it is often advisable to request permission before doing even a light scan of a network. Nmap should never be installed with special privileges (e.g. suid root).. That would open up a major security vulnerability as other users on the system (or attackers) could use it for privilege escalation. Third−Party Software and Funding Notices This product includes software developed by the Apache Software Foundation [20] . A modified version of the Libpcap portable packet capture library [21] . is distributed along with Nmap. The Windows version of Nmap utilized the Libpcap−derived WinPcap library [22] . instead. Regular expression support is provided by the PCRE library [23] ,. which is open−source software, written by Philip Hazel.. Certain raw networking functions use the Libdnet [24] . networking library, which was written by Dug Song.. A modified version is distributed with Nmap. Nmap can optionally link with the OpenSSL cryptography toolkit [25] . for SSL version detection support. The Nmap Scripting Engine uses an embedded version of the Lua programming language [26] .. The Liblinear linear classification library [27] is used for our IPv6 OS detection machine learning techniques [28] . All of the third−party software described in this paragraph is freely redistributable under BSD−style software licenses. Binary packages for Windows and Mac OS X include support libraries necessary to run Zenmap and Ndiff with Python and PyGTK. (Unix platforms commonly make these libraries easy to install, so they are not part of the packages.) A listing of these support libraries and their licenses is included in the LICENSES files. This software was supported in part through the Google Summer of Code [29] and the DARPA CINDER program [30] (DARPA−BAA−10−84). United States Export Control. Nmap only uses encryption when compiled with the optional OpenSSL support and linked with OpenSSL. When compiled without OpenSSL support, Insecure. Com LLC believes that Nmap is not subject to U.S. Export Administration Regulations (EAR) [31] export control. As such, there is no applicable ECCN (export control classification number) and exportation does not require any special license, permit, or other governmental authorization. When compiled with OpenSSL support or distributed as source code, Insecure. Com LLC believes that Nmap falls under U.S. ECCN 5D002 [32] (“Information Security Software”). We distribute Nmap under the TSU exception for publicly available encryption software defined in EAR 740.13(e) [33] . NOTES https://nmap.org/book/ http://www.rfc-editor.org/rfc/rfc1122.txt http://www.rfc-editor.org/rfc/rfc792.txt http://www.rfc-editor.org/rfc/rfc950.txt http://www.rfc-editor.org/rfc/rfc1918.txt http://www.rfc-editor.org/rfc/rfc768.txt http://www.rfc-editor.org/rfc/rfc4960.txt http://www.rfc-editor.org/rfc/rfc793.txt http://www.rfc-editor.org/rfc/rfc959.txt http://www.rfc-editor.org/rfc/rfc1323.txt http://lua.org http://www.lua.org/manual/5.1/manual.html#2.5.3 http://www.rfc-editor.org/rfc/rfc791.txt http://www.rfc-editor.org/rfc/rfc2960.txt http://sourceforge.net/projects/nmap-scanner/ http://nmapparser.wordpress.com/ http://xmlsoft.org/XSLT/ http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers http://creativecommons.org/licenses/by/3.0/ http://www.apache.org http://www.tcpdump.org http://www.winpcap.org http://www.pcre.org http://libdnet.sourceforge.net http://www.openssl.org http://www.lua.org http://www.csie.ntu.edu.tw/~cjlin/liblinear/ https://nmap.org/book/osdetect-guess.html#osdetect-guess-ipv6 https://nmap.org/soc/ https://www.fbo.gov/index?s=opportunity&mode=form&id=585e02a51f77af5cb3c9e06b9cc82c48&tab=core&_cview=1 http://www.access.gpo.gov/bis/ear/ear_data.html http://www.access.gpo.gov/bis/ear/pdf/ccl5-pt2.pdf http://www.access.gpo.gov/bis/ear/pdf/740.pdf
1.1 2.1 3.1 4.1 5.1 6.1 6.2 6.3 6.4 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 8.1 9.1 9.2 10.1 10.2 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 23.1 24.1 25.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1 39.1 40.1 41.1 42.1 43.1 43.2 44.1 45.1 45.2 45.3 45.4 45.5 46.1 47.1 47.2 47.3 48.1 49.1 50.1 51.1 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 60.1 61.1 62.1 63.1 64.1 65.1 66.1 67.1 68.1 69.1 70.1 71.1 73.1 74.1 75.1 76.1 77.1 78.1 79.1 80.1 81.1 82.1 83.1 84.1 85.1 86.1 87.1 88.1 89.1 90.1 91.1 92.1 93.1 94.1 95.1 96.1 97.1 98.1 99.1 100.1 101.1 102.1 103.1 104.1 105.1 106.1 107.1 108.1 109.1 110.1 111.1 112.1 113.1 114.1 115.1 116.1 117.1 118.1 119.1 120.1 121.1 123.1 124.1 125.1 125.2 126.1 126.2 126.3 126.4 126.5 127.1 127.2 127.3 127.4 127.5 127.6 127.7 128.1 128.2 129.1 129.2 130.1 131.1 132.1 132.2 132.3 132.4 132.5 132.6 132.7 133.1 134.1 134.2 134.3 134.4 134.5 134.6 134.7 135.1 136.1 136.2 136.3 137.1 138.1 138.2 139.1 140.1 140.2 140.3 140.4 140.5 141.1 141.2 141.3 141.4 141.5 141.6 141.7 141.8 142.1 142.2 142.3 142.4 142.5 143.1 143.2 143.3 144.1 145.1 146.1 146.2 146.3 146.4 146.5 146.6 146.7 147.1 147.2 148.1 149.1 149.2 149.3 149.4 150.1 150.2 150.3 150.4 151.1 151.2 151.3 151.4 151.5 151.6 152.1 153.1 153.2 153.3 153.4 153.5 153.6 154.1 155.1 155.2 155.3 155.4 156.1 156.2 156.3 156.4 156.5 157.1 157.2 158.1 158.2 158.3 158.4 158.5 158.6 159.1 160.1 160.2 160.3 161.1 161.2 161.3 162.1 162.2 162.3 162.4 162.5 162.6 162.7 163.1 163.2 163.3 163.4 163.5 164.1 165.1 165.2 165.3 165.4 165.5 165.6 166.1 166.2 166.3 166.4 166.5 166.6 166.7 166.8 167.1 167.2 167.3 168.1 169.1 169.2 169.3 169.4 169.5 170.1 170.2 170.3 170.4 170.5 170.6 170.7 170.8 170.9 171.1 172.1 172.2 172.3 172.4 173.1 173.2 173.3 173.4 174.1 175.1 175.2 176.1 177.1 177.2 178.1 179.1 179.2 179.3 179.4 179.5 180.1 181.1 181.2 181.3 181.4 182.1 183.1 183.2 183.3 184.1 184.2 185.1 186.1 187.1 187.2 187.3 187.4 187.5 188.1 189.1 189.2 189.3 189.4 190.1 191.1 191.2 191.3 191.4 192.1 193.1 193.2 193.3 194.1 195.1 195.2 195.3 195.4 195.5 196.1 197.1 197.2 198.1 199.1 199.2 199.3 199.4 199.5 199.6 199.7 200.1 200.2 200.3 200.4 200.5 200.6 200.7 200.8 200.9 201.1 201.2 201.3 201.4 201.5 202.1 202.2 202.3 202.4 202.5 202.6 203.1 204.1 204.2 204.3 204.4 204.5 205.1 205.2 205.3 205.4 205.5 206.1 207.1 207.2 207.3 207.4 207.5 207.6 208.1 208.2 208.3 208.4 208.5 208.6 208.7 208.8 209.1 210.1 210.2 210.3 210.4 210.5 211.1 211.2 212.1 212.2 212.3 212.4 212.5 212.6 213.1 213.2 213.3 213.4 213.5 213.6 213.7 213.8 214.1 214.2 214.3 215.1 216.1 216.2 217.1 217.2 217.3 218.1 219.1 220.1 221.1 222.1 223.1 223.2 223.3 224.1 224.2 224.3 225.1 225.2 225.3 225.4 225.5 225.6 225.7 225.8 226.1 227.1 227.2 228.1 228.2 228.3 228.4 229.1 230.1 230.2 230.3 230.4 231.1 231.2 231.3 231.4 231.5 232.1 233.1 233.2 233.3 233.4 233.5 233.6 234.1 235.1 235.2 235.3 236.1 236.2 236.3 237.1 237.2 238.1 238.2 238.3 238.4 238.5 239.1 240.1 240.2 240.3 241.1 241.2 241.3 242.1 242.2 243.1 244.1 244.2 244.3 244.4 245.1 245.2 245.3 245.4 246.1 246.2 246.3 246.4 246.5 246.6 246.7 246.8 246.9 246.10 247.1 248.1 248.2 248.3 248.4 248.5 248.6 248.7 248.8 248.9 248.10 248.11 248.12 249.1 249.2 249.3 249.4 249.5 249.6 250.1 251.1 251.2 252.1 253.1 253.2 253.3 253.4 254.1 254.2 254.3 254.4 254.5 254.6 255.1 256.1 256.2 256.3 256.4 257.1 258.1 258.2 259.1 260.1 260.2 260.3 261.1 261.2 261.3 261.4 261.5 262.1 262.2 262.3 262.4 262.5 262.6 262.7 262.8 262.9 262.10 262.11 262.12 263.1 263.2 263.3 264.1 265.1 266.1 266.2 267.1 268.1 268.2 269.1 270.1 270.2 270.3 270.4 270.5 270.6 270.7 270.8 270.9 271.1 272.1 272.2 273.1 274.1 274.2 275.1 276.1 276.2 277.1 278.1 278.2 278.3 278.4 278.5 278.6 279.1 280.1 280.2 280.3 280.4 280.5 280.6 281.1 281.2 282.1 282.2 282.3 282.4 282.5 282.6 282.7 282.8 282.9 282.10 282.11 282.12 282.13 283.1 284.1 285.1 286.1 286.2 287.1 288.1 288.2 288.3 288.4 289.1 290.1 290.2 291.1 292.1 292.2 292.3 292.4 292.5 292.6 293.1 293.2 293.3 293.4 294.1 295.1 295.2 295.3 295.4 295.5 296.1 296.2 296.3 296.4 297.1 297.2 297.3 297.4 298.1 298.2 298.3 298.4 299.1 300.1 300.2 300.3 300.4 300.5 300.6 300.7 301.1 301.2 301.3 301.4 302.1 303.1 304.1 304.2 304.3 304.4 305.1 305.2 305.3 305.4 306.1 306.2 306.3 306.4 306.5 307.1 307.2 308.1 309.1 309.2 309.3 309.4 309.5 309.6 309.7 310.1 310.2 310.3 310.4 310.5 311.1 312.1 312.2 312.3 312.4 312.5 312.6 312.7 312.8 312.9 313.1 314.1 314.2 314.3 314.4 314.5 314.6 314.7 315.1 315.2 315.3 316.1 317.1 318.1 318.2 318.3 318.4 318.5 318.6 318.7 318.8 318.9 319.1 319.2 319.3 319.4 319.5 319.6 319.7 320.1 320.2 320.3 320.4 320.5 321.1 321.2 322.1 322.2 322.3 322.4 323.1 324.1 324.2 324.3 324.4 324.5 324.6 325.1 325.2 325.3 325.4 325.5 325.6 326.1 326.2 326.3 326.4 326.5 326.6 327.1 327.2 327.3 327.4 328.1 328.2 328.3 329.1 330.1 330.2 330.3 330.4 330.5 330.6 330.7 330.8 330.9 330.10 330.11 330.12 330.13 330.14 330.15 330.16 330.17 331.1 332.1 333.1 333.2 333.3 333.4 334.1 334.2 334.3 335.1 335.2 335.3 336.1 336.2 336.3 337.1 337.2 338.1 339.1 339.2 340.1 340.2 340.3 341.1 342.1 342.2 343.1 344.1 344.2 344.3 344.4 344.5 344.6 345.1 345.2 345.3 345.4 345.5 346.1 346.2 346.3 346.4 346.5 347.1 347.2 347.3 347.4 348.1 349.1 349.2 349.3 349.4 349.5 350.1 351.1 352.1 353.1 353.2 353.3 353.4 354.1 355.1 355.2 355.3 355.4 355.5 355.6 355.7 355.8 355.9 355.10 356.1 357.1 357.2 357.3 358.1 359.1 359.2 359.3 360.1 360.2 360.3 361.1 361.2 361.3 362.1 363.1 364.1 364.2 364.3 364.4 364.5 364.6 364.7 365.1 365.2 365.3 365.4 365.5 366.1 366.2 367.1 367.2 368.1 369.1 370.1 370.2 371.1 372.1 372.2 372.3 372.4 372.5 373.1 373.2 373.3 373.4 373.5 374.1 374.2 374.3 374.4 375.1 376.1 376.2 377.1 378.1 378.2 378.3 378.4 379.1 379.2 379.3 379.4 380.1 380.2 380.3 381.1 381.2 381.3 381.4 382.1 383.1 384.1 385.1 385.2 385.3 386.1 387.1 388.1 388.2 388.3 388.4 389.1 389.2 389.3 389.4 390.1 391.1 391.2 391.3 391.4 391.5 391.6 392.1 392.2 392.3 392.4 392.5 393.1 394.1 394.2 394.3 394.4 395.1 396.1 396.2 397.1 398.1 399.1 399.2 399.3 399.4 400.1 401.1 401.2 401.3 401.4 401.5 401.6 401.7 401.8 401.9 401.10 402.1 403.1 403.2 403.3 403.4 403.5 403.6 403.7 403.8 403.9 403.10 403.11 404.1 405.1 406.1 407.1 407.2 408.1 409.1 410.1 411.1 411.2 411.3 411.4 411.5 411.6 412.1 412.2 412.3 412.4 412.5 413.1 414.1 414.2 414.3 414.4 414.5 414.6 415.1 416.1 416.2 416.3 416.4 416.5 417.1 418.1 418.2 418.3 418.4 419.1 420.1 420.2 421.1 422.1 422.2 422.3 422.4 422.5 423.1 424.1 424.2 424.3 424.4 424.5 424.6 425.1 426.1 426.2 426.3 427.1 428.1 429.1 430.1 430.2 431.1 432.1 433.1 434.1 434.2 434.3 434.4 434.5 435.1 436.1 437.1 438.1 439.1 440.1 441.1 442.1 443.1 444.1 445.1 446.1 446.2 446.3 446.4 446.5 447.1 447.2 447.3 447.4 447.5 448.1 449.1 449.2 450.1 451.1 451.2 451.3 453.1 453.2 453.3 454.1 455.1 455.2 456.1 457.1 458.1 459.1 459.2 459.3 459.4 459.5 459.6 459.7 459.8 460.1 460.2 460.3 461.1 462.1 463.1 463.2 464.1 465.1 466.1 466.2 466.3 466.4 466.5 466.6 467.1 467.2 468.1 469.1 470.1 471.1 472.1 473.1 473.2 473.3 473.4 473.5 474.1 474.2 474.3 475.1 475.2 475.3 475.4 476.1 476.2 476.3 477.1 478.1 479.1 479.2 479.3 479.4 480.1 481.1 481.2 482.1 482.2 482.3 482.4 482.5 482.6 483.1 484.1 484.2 485.1 485.2 485.3 485.4 486.1 487.1 487.2 488.1 489.1 490.1 490.2 490.3 490.4 490.5 490.6 490.7 490.8 490.9 491.1 492.1 492.2 492.3 492.4 493.1 494.1 495.1 496.1 497.1 498.1 499.1 500.1 501.1 502.1 503.1 504.1 505.1 506.1 507.1 508.1
NMAP NAME nmap − Alat za istraživanje mreže i sigurnosni/port skener SYNOPSIS OPIS Nmap (“Network Mapper”) je open source alat za istraživanje mreže i sigurnosni auditing. Dizajniran je za brzo skeniranje velikih mreža, ali radi jednako dobro i kad je u pitanju samo jedan host. Nmap koristi sirove (raw) IP pakete na nov i originalan način da bi ustanovio koji hostovi su dostupni na mreži, koji servisi (naziv aplikacije i verzija) su pokrenuti na tim hostovima, o kojim operativnim sustavima (i verzijama) je riječ, koji tipovi paket filtera i vatrozida se koriste, te mnogo drugih karakteristika. Iako je Nmap najčešće korišten za sigurnosni auditing, mnogi sistemski i mrežni administratori pronašli su u njemu koristan alat za rutinske zadatke poput sastavljanja popisa mrežnog inventara, upravljanja vremenima nadogradnje servisa i nadgledanja uptime−a računala ili servisa. Rezultat Nmap pretraživanja je popis skeniranih meta s dodatnim informacijama o svakoj od njih ovisno o korištenim parametrima. Ključna informacija je “ tabela zanimljivih portova”. U tabeli se nalati broj porta i protokol, naziv servisa i stanje.Stanje je ili: otvoreno, filtrirano, zatvoreno ili nefiltrirano. Otvoreno znači da na ciljanom računalu postoji aplikacija koja sluša na tom portu i čeka na konekciju/pakete. Filtrirano znači da između nas i ciljanog računala postoji vatrozid, paket filter ili neki drugi mrežni uređaj koji blokira port, pa Nmap ne može reći da li je port otvoren ili zatvoren. Zatvoreni portovi trenutno nemaju aplikacije koje slušaju na njima. Portovi su klasificirani kao nefiltrirani u situacijama kada odgovaraju na Nmap−ove upite, ali Nmap nije u mogućnosti ustanoviti da li su otvoreni ili zatvoreni. Nmap vraća sljedeće kombinacije u izvještajima: otvoren|filtriran i zatvoren|filtriran kad ne može ustanoviti koje od dva stanja točnije opisuje port. Port tabela može također sadržavati i informacije o verziji softvera, kada je ta opcija upaljena kod skeniranja. Kad je zatraženo skeniranje IP protokola (−sO), Nmap vraća informacije o podržanim IP protokolima, a ne o portovima. Uz navedenu tabelu portova, Nmap može dati i dodatne informacije o ciljanom računalu, uključujući reverse DNS imena, pretopstavku o tome koji operativni sustav je s druge strane, tipove uređaja i MAC adrese. Prikaz tipičnom Nmap skena je prikazan u: Example 1, “Ovako izgleda primjer Nmap skena”. Jedan od Nmap argumenata korišten u navedenom primjeru je −A, opcija za otkrivanje OS−a i njegove verzije, zatim−T4 za brže skeniranje, te nakon toga dva hosta koje želimo skenirati. Example 1. Ovako izgleda primjer Nmap skena # nmap −A −T4 scanme.nmap.org playground Starting nmap ( http://www.insecure.org/nmap/ ) Interesting ports on scanme.nmap.org (205.217.153.62): (The 1663 ports scanned but not shown below are in state: filtered) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 3.9p1 (protocol 1.99) 53/tcp open domain 70/tcp closed gopher 80/tcp open http Apache httpd 2.0.52 ((Fedora)) 113/tcp closed auth Device type: general purpose Running: Linux 2.4.X|2.5.X|2.6.X OS details: Linux 2.4.7 − 2.6.11, Linux 2.6.0 − 2.6.11 Uptime 33.908 days (since Thu Jul 21 03:38:03 2005) Interesting ports on playground.nmap.org (192.168.0.40): (The 1659 ports scanned but not shown below are in state: closed) PORT STATE SERVICE VERSION 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios−ssn 389/tcp open ldap? 445/tcp open microsoft−ds Microsoft Windows XP microsoft−ds 1002/tcp open windows−icfw? 1025/tcp open msrpc Microsoft Windows RPC 1720/tcp open H.323/Q.931 CompTek AquaGateKeeper 5800/tcp open vnc−http RealVNC 4.0 (Resolution 400x250; VNC TCP port: 5900) 5900/tcp open vnc VNC (protocol 3.8) MAC Address: 00:A0:CC:63:85:4B (Lite−on Communications) Device type: general purpose Running: Microsoft Windows NT/2K/XP OS details: Microsoft Windows XP Pro RC1+ through final release Service Info: OSs: Windows, Windows XP Nmap finished: 2 IP addresses (2 hosts up) scanned in 88.392 seconds Najnoviju verziju Nmap−a možete downloadati sa sljedećeg linka: [1] . Najnovija verzija man stranica (uputa) dostupna je na sljedećem linku: http://www.insecure.org/nmap/man/. NAPOMENE O PRIJEVODU Hrvatsku verziju Nmap vodiča je preveo Robert Petrunić s originalne Engleske verije [2] 2991. Iako se nadam da će prijevod učiniti Nmap dostupniji ljudima Hrvatskog govornog područja, ne mogu garantirati da je prijevod kompletan i up to date kao i originalna Engleska verzija. Projevod možete modificirati i redistribuirati pod uvjetima Creative Commons Attribution Licence [3] . Ovo je prva verzija i najvjerovatnije ima dosta nekonzistentnih prijevoda (riječi koje su na različitim mjestima prevedene drugačije), ali smisao prijevoda je i dalje ostao isti. Nadam se da ću u idućim verzijama napisati više "književni" točan prijevod PREGLED OPCIJA Sljedeći pregled opcija je ispisan kad pokrenete Nmap bez ikakvih parametara, a posljednja verzija je uvijek dostupna na: http://www.insecure.org/nmap/data/nmap.usage.txt. Pomaže ljudima zapamtiti najčešće opcije, ali nije zamjena za detaljne upute koje se nalaze u ovom manualu. Neke manje korištene opcije čak se ni ne nalaze u pregledu opcija. Upotreba: nmap [Tip(ovi) skeniranja] [Opcije] {ciljano računalo} CILJANO RAČUNALO: Možete upisati hostname (naziv računala), IP adrese, mreže (subnete) isl. Primjer: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0−255.1−254 −iL  : Naziv datoteke u kojoj se nalazi popis hostova/mreža −iR  : Odaberi nasumične hostove −−exclude  : Ne skeniraj navedene hostove/mreže −−excludefile  : Ne skeniraj navedene hostove/mreže koji se nalaze u navedenoj datoteci OTKRIVANJE HOSTOVA: −sL: List Scan − samo navedi mete koje skeniraš −sP: Ping Scan − samo ustanovi da li je host online i ne radi ništa više −P0: Smatraj sve hostove online −− ne pokušavaj ustanoviti da li postoje. −PS/PA/PU [lista_portova]: koristi TCP SYN/ACK ili UDP za otkrivanje hostova −PE/PP/PM: ICMP echo, timestamp i netmask pokušaji skeniranja −n/−R: Ne pokušavaj raditi DNS rezoluciju/uvijek koristi DNS rezoluciju [default: ponekad] TEHNIKE SKENIRANJA: −sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon skenovi −sN/sF/sX: TCP Null, FIN, and Xmas skenovi −−scanflags  : Navedi TCP flagove pomoću kojih želiš skenirati −sI  : Idlescan −sO: IP protocol scan −b  : FTP bounce scan SPECIFIKACIJA PORTOVA I REDOSLJED SKENIRANJA: −p  : Skeniraj samo navedene portove −F: Brzo − Skeniraj samo portove navedene u nmap−services fileu −r: Skeniraj portove po redu − ne randomiziraj OTKRIVANJE SERVISA/VERZIJA: −sV: Pokušaj na osnovu otvorenih portova saznati informacije o servisu/verziji −−version_light: Koristi najvjerovatnije skenove zbog ubrzane detekcije verzije −−version_all: Isprobaj sve vrste skenova za saznavanje verzije −−version_trace: Pokaži detaljnu aktivnost skeniranja verzije (za debugging) DETEKCIJA OS−a: −O: Uključi OS detekciju −−osscan_limit: Ograniči OS detekciju samo na one ciljeve koji obećavaju −−osscan_guess: Pogađaj OS malo agresivnije TIMING I PERFORMANSE: −T[0−6]: Podesi predložak za timing (veći broj je brže) −−min_hostgroup/max_hostgroup  : Paralelno skeniraj hostove / veličina sken grupe −−min_parallelism/max_parallelism  : Paraleliziraj sonde −−min_rtt_timeout/max_rtt_timeout/initial_rtt_timeout  : Navedi vrijeme potrebno za povratak (engl. round trip time) sonde. −−host_timeout  : Odustani od skeniranja ciljanog računala nakon navedenog vremena u milisekundama −−scan_delay/−−max_scan_delay  : Podesi pauzu između slanja upita OBILAŽENJE FIREWALL−a/IDS−a I SPOOFING: −f; −−mtu  : fragmentiraj pakete (opcionalno sa zadanim MTU−om) −D  : Sakrij skan korištenjem mamaca −S  : Spoofaj ishodišnu (source) adresu −e  : Koristi navedeni interface (mrežni adapter) −g/−−source_port  : Koristi navedeni broj ishodišnog (source) porta −−data_length  : Dodaj random podatke u poslane pakete −−ttl  : Podesi IP time−to−live polje −−spoof_mac  : Spoofaj svoju MAC adresu ISPIS: −oN/−oX/−oS/−oG  : Ispiši scan normalno, kao XML, s|<rIpt kIddi3, i Grep format u navedeni file −oA  : Ispis u tri glavna formata istovremeno −v: Povećaj verbose nivo (ako želite postići veći efekt, stavite opciju −vv) −d[nivo]: Podesi ili povećaj debuging nivo (Ima smisla do brojke 9, više od toga ne) −−packet_trace: Pokaži sve poslane i primljene pakete −−iflist: Ispiši host interface i rute (za debuging) −−append_output: Dodaj ispis u postojeće datoteke − nemoj ih prepisati −−resume  : Nastavi prekinuti scan −−stylesheet  : XSL stylesheet za transformiranje XML generiranog dokumenta u HTML −−no_stylesheet: Spriječi povezivanje XSL stylesheet−a s XML ispisom RAZNO: −6: Omogući skeniranje IPv6 protokola −A: Omogući prepoznavanje OS−a i verzije OS−a −−datadir  : Navedi customizirani Nmap data file −−send_eth/−−send_ip: šalji sirove (RAW) ethernet frame−ove ili IP pakete −−privileged: Pretpostavka da je korisnik koji je pokrenuo Nmap u potpunosti privilegiran (ima admin ovlasti) −V: Ispiši verziju Nmap−a −h: Ispiši ovaj help ekran PRIMJERI: nmap −v −A scanme.nmap.org nmap −v −iR 10000 −P0 −p 80 ODABIR CILJANOG RAčUNALA Sve što unesete u komandnu liniju Nmap−a, a nije opcija ili argument opcije (dakle nije parametar samog programa), tretira se kao ciljano računalo. Najjednostavniji slučaj je da unesete IP adrese ili naziv ciljanog hosta. Ponekad želite skenirati čitavu mrežu hostova. Za tu namjenu Nmap podržava CIDR adresiranje. Dakle, nakon IP adrese ili naziva računala, možete dodati /numbits (broj bitova) koji se koriste kao mrežni ID. Ako smo pak odabrali scanme.nmap.org, a recimo da je IP adresa tog hosta 205.217.153.62, scanme.nmap.org/16 bi skeniralo 65,536 IP adresa između 205.217.0.0 i 205.217.255.255. Najmanja dozvoljena vrijednost je 1 (što bi skeniralo gotovo cijeli internet), dok je najveća dozvoljena vrijednost 32, što skenira samo jednog hosta. CIDR notacija je kratka, ali nije uvijek dovoljno fleksibilna. Npr. želite skenirati 192.168.0.0/16, ali želite izbjeći sve IP adrese koje završavaju s .0 ili .255, jer su to mrežni ID i broadcast IP adresa u klasful adresiranju. Nmap za tu situaciju podržava adresiranje na nivou okteta. Umjesto da navedete normalnu IP adresu, možete navesti listu brojeva odvojenih zarezom (1,2,3) ili područja za svaki oktet (1−254). Npr. 192.168.0−255.1−254 će preskočiti sve adrese u navedenom području koje završavaju na .0 i .255, tj. skenirat će sve IP adrese od 192.168.0.1 do 192.168.255.254, preskačući one IP adrese koje u zadnjem oktetu imaju 0 ili 255. Područja nisu limitirana na zadnji oktet, recimo, 0−255.0−255.13.37 će skenirati SVE IP adrese koje završavaju na 13.37. Ovaj način skeniranja može biti koristan za razna istraživanja i ispitivanja. IPv6 adrese mogu biti specificirane isključivo u potpunosti definirane (fully qualified) kao IP adrese ili naziv hosta. CIDR i oktet područja nisu podržani za IPv6 jer se rijetko koriste. Nmap prihvaća navođenje više hostova u komandnoj liniji, a hostovi ne moraju biti istog tipa. Naredba nmap scanme.nmap.org 192.168.0.0/8 10.0.0,1,3−7.0−255 će učiniti upravo ono što očekujete od nje. Ciljevi skeniranja su obično navedeni u samoj komandnoj liniji, ali podržane su i sljedeće opcije: −iL   (Iščitaj parametre iz liste) Iščita informacije o ciljanom hostu iz ulazne datoteke. Proslijediti Nmapu veliku količinu hostova iz komandne linije izgleda nepregledno, ali to je ono što u većini slučajeva i želimo. Npr. iz DHCP servera ste izvukli popis 10 000 trenutno iznajmljenih IP adresa i želite ih skenirati ili možda želite skenirate sve ip adrese osim tih kako bi pronašli hostove koji imaju neautoriziranu statičku IP adresu. Da bi to postigli, generirajte popis hostova koje želite skenirati u neku datoteku i proslijedite tu datoteku Nmap−u kao argument opciji −iL. U datoteci mogu biti unosi u bilo kojem formatu koji Nmap podržava u samoj komandnoj liniji (IP adresa, naziv hosta, CIDR, IPv6, ili oktet nekog područja). Svaki unos mora biti odvojen s jednim ili s više razmaka, tabom ili novim redom. Isto tako možete staviti minus (−), ukoliko želite da Nmap iščita hostove iz standardnog unosa umjesto iz navedene datoteke. −iR   (Nasumično odaberi ciljano računalo) Za istraživače interneta i ostale koji žele odabrati ciljano računalo nasumično. Argument broj hostova kaže Nmap−u koliko IP adresa da generira. Neželjene IP adrese, poput privatnih, multicast ili nedodjeljenih IP adresnih područja su automatski izbačene. Argument 0 može biti naveden za skeniranje koje nikad neće završiti. Imajte na umu da neki mrežni administratori ne vole neautorizirano skeniranje i mogli bi se žaliti vašem ISP−u, što bi pak moglo rezultirati zabranom pristupa internetu za vas. Koristitte ovu opciju na vlastitu odgovornost. Ukoliko se pak, jednog kišnog popodneva, nađete u situaciji da ne znate što bi sa sobom, iskušajte naredbu nmap −sS −PS80 −iR 0 −p80 kako bi nasumično pronašli web servere za browsanje. −−exclude   (isključi iz skeniranja hostove/mreže) Navedite zarezom odvojenu listu hostova koje želite isključiti iz skena iako se nalaze u mrežnom području koje ste specificirali. Popis koji proslijedite na ovaj način koristi normalnu Nmap sintaksu, pa možete upisati naziv hosta, CIDR mrežne blokove, oktete rangeva isl. To može biti korisno u slučaju kad mreža koju želite skenirati ima nedodirljive i kritične servere, sisteme za koje se zna da će odmah reagirati na port sken, ili postoje podmreže koje administriraju drugi administratori i ne želite skenirati njihov dio mreže. −−excludefile   (Isključi iz skeniranja koristeći ulazni file) Ova opcija nudi istu funkcionalnost kao i prije opisana opcija −−exclude, s tim da hostove koje ne želite skenirati ne navodite u komandnoj liniji, već unutar datoteke. Hostovi mogu biti navedeni u datoteci (naziv_datoteke) koji kao delimiter koristi novi red, razmak ili tab. POSTUPAK PRONALAžENJA HOSTOVA Jedan od prvih koraka kad je u pitanju sakupljanje informacija o mreži je smanjivanje (ponekad velike) količine IP adresnih područja u popis aktivnih i zanimljivih hostova. Skeniranje svih portova za svaku adresu je sporo i najčešće nepotrebno. Naravno, ono što nekog hosta čini zanimljivim uvelike ovisi o razlogu samog skena. Mrežni administratori će možda biti zainteresirani samo za hostove koji imaju pokrenut određeni servis, dok će sigurnosni auditori biti zainteresirani za svaki uređaj s IP adresom. Administratoru će možda biti dovoljno korištenje ICMP pinga kako bi pronašao hostove na mreži, dok će vanjski penetration tester koristiti široki spektar alata i nebrojene sonde u pokušaju da obiđe zabrane postavljene na vatrozidu. Budući da su potrebe korisnika kod pronalaženja hostova tako različite, Nmap nudi široki spektar opcija za prilagođavanje korištenim tehnikama. Pronalaženje hostova (engl host discovery) se ponekad naziva Ping scan, ali ide daleko dalje od običnog ICMP echo paketa povezanog sa sveprisutnim ping alatom. Korisnici mogu preskočiti dio pinganja s list skenom (−sL) ili isključivanjem pinganja (−P0) ili da pristupe mreži s kombinacijama multi port TCP SYN/ACK, UDP i ICMP sondi. Namjena tih sondi je iznuđivanje odgovora koji dokazuje da je IP adresa u stvari aktivna (korištena je od strane hosta ili mrežnog uređaja). Na većini mreža je samo jedan mali postotak IP adresa aktivan. To je pogotovo točno za mreže blagoslovljene RFC1918 dokumentom (privatni adresni prostor poput 10.0.0.0/8). Navedena mreža ima 16 miliona IP adresa, ali imao sam prilike vidjeti da je koriste firme s manje od tisuću mašina. Postupak pronalaženja hostova može pronaći koja su to računala u tom moru neaktivnih IP adresa. Ukoliko ne navedete nikakvu opciju Postupku pronalaženja hostova, Nmap šalje TCP ACK paket namjenjen portu 80 i ICMP echo zahtijev na ciljano računalo. Izuzetak od ovog pravila je taj da je ARP sken korišten za ciljana računala na lokalnoj ethernet mreži. Za neprivilegirane UNIX shell korisnike, Nmap šalje SYN paket umjesto ACK−a korištenjem connect() sistemskog poziva. To je jednako opcijama −PA −PE. Takav način pronalaženja hostova je obično dostatan kad su u pitanju lokalne mreže, ali preporučen je malo potpuniji set sondi za istraživanje kod sigurnosnog auditinga. Opcija −P* (koja odabire ping tipove) može biti kombinirana. Možete povećati šanse provaljivanja vatrozida slanjem mnogo sondi koje koriste različite TCP portove/zastavice (engl. flags) i ICMP kodove. Također imajte na umu da se po defaultu na lokalnoj mreži za otkrivanje hostova koristi ARP discovery (−PR) čak i kad navedete druge −P* opcije zbog toga jer je gotovo uvijek brži i efikasniji. Sljedeće opcije upravljaju postupkom otkrivanja hostova. −sL (List Sken) List sken nije skeniranje hosta, već saznavanje nekih javno dostupnih informacija o njemu bez slanja ijednog paketa prema tom hostu. List scan jednostavno ispiše svakog hosta kojeg smo specificirali i napravi reverse DNS rezoluciju da bi saznao njegovo ime. Iznenađujuće je koliko korisnih informacija možete dobiti ovim načinom "skeniranja". Npr. fw.chi.playboy.com je vatrozid Čikaškog (Chichago) ureda firme Playboy Enterprises. Nmap na kraju navede i ukupan broj IP adresa koje pripadaju tom hostu. List Sken je koristan u situacijama kada se želite uvjeriti da imate ispravne IP adrese koje želite skenirati. Ukoliko List sken izbaci nazive domena koje ne poznajete bilo bi dobro provjeriti prije nego pokrenete skeniranje, jer ne bi bilo dobro da počnete skenirati krive hostove ;−). Kako je ideja samo ispisati popis ciljanih hostova, ne možete kombinirati opcije za funkcionalnosti višeg nivoa, poput skeniranja portova, detekcije OS−a, ping skeniranja isl. Ukoliko želite isključiti ping skeniranje, a ipak koristiti funkcionalnosti višeg nivoa, pročitajte opis −P0 opcije. −sP (Ping Sken) Ova opcija kaže Nmap−u da napravi samo ping sken (otkrivanje hostova) i da ispiše hostove koji su odgovorili na skeniranje. Ne radi se nikakvo dodatno testiranje (poput port skeniranja ili detekcije OS−a). To je način skeniranja koji je stupanj intruzivniji od list skena ali se može koristiti u istu svrhu. Dozvoljava lagano "pretraživanje neprijateljskog teritorija" (engl. reconnaissance), bez pretjeranog privlačenja pažnje, jer znati koliko hostova je stvarno "živo" na mreži je važnija informacija za napadača ili sigurnosnog auditora, nego lista koju je izbacio list scans popisom svih IP adresa i hostova koji postoje. Sistemski administratori također nalaze ovu opciju poprilično korisnom. Može se koristiti za pronalaženje dostupnih računala na mreži ili koristiti kao alat za nadgledanje dostupnosti servera. Taj način primjene se naziva ping sweep i mnogo je pouzdaniji od pinganja broadcast adrese zato jer mnogi hostovi ne odgovaraju na broadcast upite. (Konkretno windows mašine ne odgovaraju na broadcast ping, ali odgovaraju na druge tipove broadcast paketa). Po defaultu −sP opcija šalje ICMP echo i TCP paket na port 80. Kad je pokrenuta od strane neprivilegiranog korisnika (korisnika koji nije lokalni administrator), poslan je SYN paket na port 80 (korištenjem API poziva connect() ). Kad privilegirani korisnik pokušava skenirati hostve na lokalnoj mreži, koriste se ARP zahtjevi (−PR) osim ako nije specificirana opcija −−send_ip. Opciju −sP možete kombinirati s bilo kojim tipom otkrivajućih (discovery) tipova skeniranja (sve −P* opcije osim −P0 opcije) kako bi postigli veću fleksibilnost. Ukoliko se koristi bilo koji od tih tipova skeniranja i port broj, automatski su defaultne postavke skeniranja premošćene (ACK i echo zahtjevi). Ukoliko su između hosta na kojem je pokrenut Nmap i ciljanog hosta nalaze vatrozidi, preporuka je koristiti upravo te tehnike kako vatrozid ne bi filtrirao upite ili odgovore na njih. −P0 (Bez pinganja) Ova opcija preskače fazu otkrivanja hostova. Ukliko ne koristite ovu opciju, Nmap pokušava ping skeniranjem saznati koja računala su dostupna kako bi SAMO njih i skenirao. Ukoliko koristite ovu opciju Nmap će skenirati svakog navedenog hosta bez obzira da li je dostupan ili ne, jer neće raditi provjeru. Ukoliko odaberete kompletnu klasu B (/16 po CIDR notaciji) Nmap će skenirati svih 65536 hostova, bez obzira da li su "živi" ili ne. Napomena: drugi karakter u ovoj opciji je NULA, a ne veliko slovo O. Ukoliko je na hostu zatvoren ICMP protokol (što je slučaj kod 90% računala na internetu), a niste stavili −P0 opciju, Nmap neće skenirati ta računala, dakle, ukoliko želite skenirati računala koja ne odgovaraju na ICMP echo upit, a znate da postoje i da su "živi" stavite ovu opciju. −PS [lista_portova] (TCP SYN Ping) Ova opcija šalje prazan TCP paket s upaljenim SYN flagom. Defaultni odredišni port je 80 (možete se konfigurirati kod kompajliranja programa na način da promijenite DEFAULT_TCP_PROBE_PORT u nmap.h biblioteci), no, možete navesti i neki drugi port kao parametar. Isto tako je moguće poslati zarezom odvojenu listu portova kao parametar ovoj opciji (npr. U tom će slučaju nmap poslati paket na svaki od navedenih portova paralelno. SYN flag u paketu kaže ciljanom hostu da se želite spojiti na navedeni port/portove. Ukoliko je port zatvoren, odgovor koji će Nmap dobiti od ciljanog hosta je RST (reset). Ukoliko je port otvoren, ciljano računalo će poslati SYN/ACK paket, što je drugi korak u trostrukom rukovanju TCP protokola. Računalo na kojem je pokrenut Nmap u tom trenutku prekida konekciju na način da pošalje RST paket (umjesto ACK paketa koji bi završio trostruko rukovanje i uspostavio konekciju sa ciljanim hostom). RST paket je poslao kernel računala na kojem je pokrenut Nmap, jer je dobio SYN/ACK paket koji nije očekivao. Nmap ne zanima da li je port otvoren ili zatvoren, RST ili SYN/ACK odgovor koji je dobio dovoljan su odgovor da je računalo "živo". Bez obzira na to RST odgovor znači da je računalo tu i da je "živo", dok SYN/ACK odgovor uz to znači i da računalo "sluša" na navedenom portu. Na UNIX mašinama samo privilegirani korisnik root može slati i primati sirove (RAW) TCP pakete. Za neprivilegirane korisnike napravljen je obilazni put u kojem Nmap automatski poziva connect() API na svaki navedeni port. To je postiglo efekt slanja SYN paketa na coljani host i iniciran je poušaj ostvarivanja konekcije. Ukoliko connect() API vrati brzi odgovor uspješnog spajanja ili ECONNREFUSED grešku, TCP stack na OS−u je dobio SYN/ACK ili RST od ciljanog hosta i host je označen kao dostupan. Ukoliko konekcija "visi" dok ne istekne timeout, ciljani host je označen kao nedostupan (ugašen). Navedeni obilazni put se koristi i kod IPv6 konekcija, je Nmap još nema implementiranu izradu sirovih (RAW) paketa za IPv6 protokol. −PA [lista_portova] (TCP ACK Ping) TCP ACK ping je sličan SYN pingu. Razlika je, što je lako zaključiti iz samog naziva, u tome što se umjsto SYN flaga upali ACK flag. Takav paket podrazumijeva da je konekcija već uspostavljena iako nije, samim tim bi ciljani hostovi uvijek trebali odgovoriti s RST paketom, te na taj način potvrditi svoje postojanje. −PA opcija koristi isti defaultni port kao i SYN scan (port 80) i isto kao i SYN scan može primiti listu portova u istom formatu. Ukoliko neprivilegirani korisnik pokuša pokrenuti Nmap s ovom opcijom ili je u pitanju IPv6 TCP konekcija, koristi se obilazni put opisan u TCP SYN pingu. Ova opcija nije savršena, jer connect() u stvari šalje SYN pakete umjesto ACK paketa Razlog zašto koristiti i SYN i ACK sonde je radi povećavanja šansi za obilaženje vatrozida. Mnogi administratori konfiguriraju rutere i ostale jednostavne vatrozide na način da zaustavljaju dolazeće SYN pakete osim ako nisu namijenjeni nekim javnim servisima, poput weba ili mail servera. Takav način podešavanja uređaja sprječava nedozovljene konekcije prema računalima tvrtke, ali omogućava neograničen izlazni promet prema internetu. Ovakav pristup konekcija bez stanja (engl. stateless) oduzima malo resursa na vatrozidima/ruterima i podržan je na gotovo svim hardverskim i softverskim filterima. Netfilter/ iptables, poznati vatrozid na Linux operativnom sustavu nudi opciju −−syn kako bi mogli implementirati ovakav pristup konekcija bez stanja (engl. stateless). Kod tako konfiguriranih vatrozida, sonde SYN ping (−PS) će najvjerovatnije biti blokirane kad ih pošaljete na zatvorene portove. No međutim, ACK sonde će bez problema prolaziti kroz njih. Drugi tip vatrozida podržava konekcije sa stanjem (engl. stateful) koji odbacuju sve neočekivane pakete. Ova opcija se u početku koristila samo kod naprednijih vatrozid rješenja, ali je vremenom postala rasprostranjenija. Linux vatrozid Netfilter/iptables podržava ovu opciju korištenjem opcije −−state, koja kategorizira pakete vezano uz stanje konekcije. Skeniranjem takvih sustava veća je vjerovatnost da ćemo od SYN sonde dobiti nekakvu informaciju, nego od ACK, jer se ACK sonde koje nemaju uspostavljenu konekciju tretiraju kao lažne i odbačeni su bez ikakvog odgovora. U slučaju dvojbe, najbolje je poslati i SYN i ACK sonde naviođenjem opcija −PS i −PA. −PU [lista_portova] (UDP Ping) Još jedna metoda detekcije hostova je i UDP ping. UDP ping šalje prazne UDP pakete (osim ako nije definirana opcija −−data_length) na navedene portove. Portlist opcija ima isti format kao i prije obrađene opcije −PS i −PA. Ukoliko nije naveden niti jedan port, defaultni je 31338. To se može promijeniti kod kompajliranja promjenom DEFAULT_UDP_PROBE_PORT u nmap.h biblioteci. Namjerno je odabran visoki nestandardni port, jer bi slanje paketa na otvorene UDP portove dalo neželjene rezultate za ovu vrstu skena. Nakon što je ciljano računalo dobilo paket na zatvoreni port, trebalo bi odgovoriti ICMP paketom " nedostupan port" (engl. port unreachable). Na osnovu toga Nmap može zaključiti da je ciljani host "živ". Drugi tipovi ICMP grešaka, poput nedostupan host/mreža ili premašen TTL (engl. TTL exceeded) nagovještavaju da je host ugašen ili nedostupan. Ukoliko nema nikakvog odgovora, Nmap također zaključi da je host ugašen/ nedostupan. Ukoliko je paket stigao na otvoreni UDP port, većina servisa će jednostavno ignorirati prazan UDP paket i Nmap neće dobiti nikakav odgovor. Zbog toga je defaultni port 32338, jer je mala mogućnost da će neki servis koristiti taj port. Postoje i neki servisi, poput chargen−a, koji će odgovoriti na prazan UDP paket i na taj način otkriti Nmapu da je host "živ". Glavna prednost ovog tipa skeniranja je da obilazi vatrozide i paket filtere koji skeniraju samo TCP promet. Npr. Linksys BEFW11S4 bežični (wireless) ruter na vanjskom mrežnom adapteru filtrira samo TCP portove, a na UDP skenove odgovara s ICMP port nedostupan. −PE; −PP; −PM (ICMP tipovi pinganja) Uz do sad navedene tipove skeniranja i otkrivanja hostova, Nmap može slati i standardne ICMP pakete korištenjem klasičnog ping programa. Nmap šalje ICMP paket tipa 8 (echo request) na ciljanu IP adresu očekujući odgovor tipa 0 (echo reply), ukoliko je host "živ". Na štetu mrežnih istraživača, većina hostova i vatrozida na internetu blokira te pakete umjesto da na njih odgovara kako je opisano u RFC 1122 [4] dokumentu. Zbog toga su ICMP skenovi rijetko ili gotovo nikad pouzdani kad se ciljani host nalazi na internetu, ali za sistem administratore koji nadgledaju unutrašnje mreže, ovo je praktičan i najjednostavniji pristup za skeniranje hostova. Opisani način skeniranja možete upaliti korištenjem −PE opcije. Bez obzira na to što je echo zahtijev standardni ICMP ping upit, Nmap se nije zaustavio na tome. Ako pogledate ICMP standard (RFC 792 [5] ) vidjet ćete da je u njemu naveden i timestamp zahtijev, information zahtijev i zahtijev za adresnom maskom i to pod kodovima 13,15 i 17. Iako je namjena tih upita saznati informacije poput adresne maske i trenutnog vremena, vrlo ih je lako iskoristiti za otkrivanje hostova. Host koji odgovori je "živ". Nmap u trenutnoj verziji ne podržava information zahtijev, jer se ne koristi često. RFC 1122 inzistira na tome da “host NE BI TREBAO implementirati taj ICMP tip poruka”. Upite za timestamp i adresnu masku možete poslati s −PP i −PM opcijama. Timestamp odgovor (ICMP kod 14) ili odgovor adresne maske (kod 18) otkrivaju da je ciljani host "živ". Ta dva upita su korisni u slučajevima kad administratori blokiraju echo zahtijev pakete, ali zaborave blokirati ostale ICMP pakete. −PR (ARP Ping) Jedan od najčešćih scenarija korištenja Nmap−a je skeniranje ethernet LAN−a. Na većini LAN−ova, posebno na onima koji koriste privatne ip adrese definirane u RFC 1918 dokumentu je većina IP adresa u stvari neiskorištena. Kad Nmap pokuša poslati sirovi IP paket poput ICMP echo zahtjeva, operativni sustav mora ustanoviti MAC adresu računala koja pripada ciljanoj IP adresi, kako bi moglo adresirati ethernet frame. To je obično sporo i problematično jer operativni sustavi nisu napisani s pretpostavkom da će u vrlo kratkom vremenskom periodu morati poslati milione ARP zahtjeva prema nepostojećim hostovima. ARP sken zadužuje Nmap i njegove optimizirane algoritme za ARP zahtjeve i ukoliko Nmap dobije odgovor ne mora uopće pokretati IP bazirani ping, jer već zna da je računalo dostupno. Ovo čini ARP scan mnogo bržim i pouzdanijim od IP baziranog skena, pa se defaultno koristi kod skeniranje hostova na ethernetu za koje Nmap zaključi da su na lokalnoj mreži. Čak ako ste i naveli neke druge tipove pinga, (poput −PE ili −PS), Nmap će koristiti ARP sken za sve hostove koji su na istoj mreži. Ukoliko ne želite koristiti ARP sken, navedite opciju −−send−ip. −n (Bez DNS rezolucije) Ova opcija kaže Nmap−u da nikad ne radi obrnutu DNS rezoluciju (engl. reverse DNS lookup) na aktivnim IP adresama koje pronađe. Kako je obrnuta DNS rezolucija često spora, ova opcija ubrzava postupak. −R (DNS rezolucija za sva ciljana računala) Ova opcija kaže Nmap−u da uvijek radi obrnutu rezoluciju ciljanih IP adresa. U normalnim okolnostima to se radi samo kad je potvrđeno da računalo postoji. −−system_dns (Koristi sistemski DNS rezolver) Defaultno Nmap radi rezolving adresa slanjem upita direktno imenskim serverima (engl. name servers) koji su podešeni na vašem računalu i čeka odgovore. Mnogo zahtjeva je poslano istovremeno (10 i više) kako bi brže radilo. Ovu opciju navedite ukoliko želite koristiti sistemski rezolver (jedna po jedna IP adresa pozivom sistemskog API poziva getnameinfo()). Ovo je sporije i rijetko je korisno osim ako u Nmap DNS kodu postoji greška −− molim kontaktirajte nas u tom slučaju. Sistemski rezolver se uvijek koristi za IPv6 skenove. −−dns_servers   (Serveri koji će se koristiti za obrnute DNS upite) U normalnim okolnostima, Nmap će pokušati pronaći vaše DNS servere iz resolv.conf datoteke (na UNIX−u) ili iz registry baze podataka (na Win32). Naravno, postoji mogućnost da navedete servere po želji korištenjem ove opcije. Ova opcija se ne koristi ako koristitite opciju −−system_dns ili IPv6 sken. Korištenje više DNS servera je obično brže nego samo jednog. OSNOVE SKENIRANJA PORTOVA Bez obzira na to što je vremenom Nmap porastao gledano s funkcionalne strane, počeo je kao efikasan port skener, te mu to i dalje ostaje osnovna namjena. Jednostavna naredba nmap ciljani host skenira više od 1660 TCP portova na navedenom računalu. Iako je većina port skenera grupirala portove u otvorene ili zatvorene, Nmap ima granularniji pristup, te dijeli portove na: otvorene, zatvorene, filtrirane, nefiltriran, otvorene|filtrirane i zatvorene|filtrirane. Gore navedena stanja ne potiču od stvarnih stanja portova, već su opis onoga što Nmap u stvari vidi. Npr., ukoliko Nmap−om skenirate neku mrežu, dok ste fizički spojeni na nju, Nmap bi mogao reći da je port 135 otvoren, dok bi isti taj sken u slučaju da tu istu mrežu skenirate s interneta, najvjerovatnije rekao da je port filtriran (nalazi se iza vatrozida ili paket filtera). Šest stanja portova kako ih Nmap prepoznaje otvoren Aplikacija aktivno prihvaća TCP konekcije ili UDP pakete na navedenom portu. To je ujedno i cilj skoro svakog skeniranja. Osobe koje se bave sigurnošću znaju da je svaki otvoreni port, potencijalno mjesto napada. Napadači i penetration testeri žele iskoristiti otvorene portove, dok ih administratori pokušavaju zatvoriti ili zaštititi vatrozidima, bez da zabrane pristup legitimnim korisnicima. Skeniranje otvorenih portova je zanimljivo ne samo za sigurnosne skenove, već i u slučaju kad želite saznati koji servisi i aplikacije su dostupni na mreži. zatvoren Zatvoreni port je dostupan (odgovorio je na Nmap−ov upit), ali na njemu ne sluša niti jedna aplikacija. Zatvoreni port nam govori da se na toj IP adresi nalazi host koji je upaljen, koji najvjerovatnije nije iza vatrozida ili paket filtera, a to nam može pomoći i i otkrivanju verzije OS−a. Kako su zatvoreni portovi dostupni (nitko nam nije zabranio pristup do njih), isplati se kasnije ponoviti sken, jer možda će kasnije biti otvoreni. Administratori se trude zabraniti pristup takvim portovima korištenjem vatrozida i paket filtera, u tom bi slučaju port bio filtriran, a ne zatvoren (što je objašnjeno u nastavku). filtriran Nmap ne može ustanoviti da li je port otvoren ili ne, jer neki uređaj (vatrozid, pravila na ruteru, paket filter) blokira upite prema tom portu. Ti su portovi frustrirajući za hakere, jer ne daju gotovo nikakve informacije. Ponekad odgovaraju s ICMP porukom o grešci poput tip 3 kod 13 (odredište je nedostupno − komunikacija administrativno zabranjena), ali filteri koji samo odbace paket i ne daju nikakav odgovor na njegu su najčešći. Zbog toga Nmap mora poslati upit više puta kako bi bio siguran da je paket odbačen zbog filtriranja, a ne zbog mrežnog zagušenja te samim tim usporava skeniranje. nefiltriran Ovo stanje znači da je port dostupan, ali Nmap ne može ustanoviti da li je otvoren ili zatvoren. Samo ACK sken (koji se koristi za otkrivanje pravila na vatrozidu može vratiti nefiltriran kao odgovor. Skeniranje nefiltriranih portova nekom drugom metodom (poput Windows skena, SYN skena ili FIN skena može dati odgovor na pitanje da li je port otvoren ili zatvoren. otvoren|filtriran Nmap okarakterizira port ovim stanjem kada nije u mogućnosti ustanoviti da li je port otvoren ili filtriran. To se dogodi u situacijama kada na upit ne dobije nikakav odgovor. Nedostatak odgovora može značiti da je paket filter odbacio paket i/ili bilo kakav odgovor koji je taj paket inicirao. Samim tim Nmap nije siguran da li je port otvoren ili filtriran. UDP, IP protokol, FIN Null i Xmas scan mogu klasificirati port ovim stanjem. zatvoren|filtriran U slučaju kad Nmap ne može ustanoviti da li je port zatvoren ili filtriran, okarakterizirat će ga ovim stanjem. IPID Idle Scan je jedina sken metoda koja može vratiti ovakav rezultat. TEHNIKE SKENIRANJA PORTOVA Kako nisam previše vičan popravcima na automobilu, mogu potrošiti sate i sate samo da nađem odgovarajući alat (poput čekića, ljpljive trake, ključa isl.). Nakon što odustanem od smješnih pokušaja da nešto popravim i odvezem auto kod stvarnog mehaničara, začuđen sam kako jednostavno i nadasve uspješno izvadi iz velike kutije s alatatom baš onaj koji je potreban za uspješan popravak. Umjestnost skeniranja portova je slična. Stručnjak razumije mnoštvo tehnika skeniranja i odabere baš onu (ili kombinaciju više tehnika) koja je odgovarajuća za određeni posao. Neiskusni korisnisi i script kiddies (osobe koje koriste skripte koje je napisao netko drugi ne razumijevajući što i kako te skripte rade), pokušavaju sve riješiti defaultnim SYN skanom. Kako je Nmap besplatan program, jedina prepreka između Vas i masteriranja port skeninga je znanje. To je definitivno suprotno od automehaničarskog posla, u kojem recimo mož ete znati da Vam treba zračni kompresor, ali to ne umanjuje činjenicu da ga trebate i kupiti. Većina tipova skeniranja koje nmap podržava dostupni su privilegiranim korisnicima (morate biti ulogirani kao administrator). To je zbog toga jer šalju sirove (RAW) pakete koji zahtjevaju root pristup u UNIX svijetu. Korištenje administratorskog korisničkog accounta je preporučeno na windows operativnim sustavima, mada Nmap ponekad radi i s neprivilegiranim korisnicima, ako je WinPCap prethodno instaliran na sustav i aktivan. Zahtjev za root privilegijama je bila ozbiljna prepreka kad je Nmap prvi put pušten u javnost 1997. godine, jer je većina korisnika imala pristup dijeljenim shell accountima. Sada je svijet drugačiji. Kompjutori su jeftiniji, veći broj ljudi ima stalni pristup internetu, a desktop UNIX sustavi su dominantni (uključujući linux i MAC OS X). Windows verzija Nmap−a je također dostupna, te je samim tim i Nmap dostupniji većem broju korisnika. Zbog svih tih razloga, sve je manja potreba korisnika da pokreću Nmap logirani sa dijeljenim shell accountima. To je naravno super stvarm jer je Nmap pokrenut pod accountom privilegiranog korisnika mnogo moćniji i fleksibilniji. Iako Nmap pokušava reproducirati ispravan rezultat svojih skenova, imajte na umu da su sve unutrašnje komponente Nmap−a bazirane na paketima vraćenim od ciljanih računala (ili firewall uređaja ispred njih). Neki hostovi mogu biti nepouzdani i podešeni na način da vrate pakete koji će zavarati Nmap i dati krivi rezultat. Još češći su hostovi koji ne podržavaju RFC standard, te ne odgovaraju onako kako Nmap očekuje od njih. FIN, Null i Xmas skenovi su pogotovo podložni tim problemima. Problemi poput gore navedenih su specifični za pojedine tipove skeniranja i o tome se raspravlja u svakoj od tih tehnika skeniranja. Ovo poglavlje dokumentira hrpu tehnika skeniranja portova koje podržava Nmap. Samo jedna od spomenutih metoda može biti korištena u jednom trenutku, osim UDP skena (−sU) koji može biti kombiniran s bilo kojom od TCP sken matoda. Radi lakšeg pamćenja, opcije skeniranja portova su u obliku −sC, gdje je C vidljiv iz samog naziva sken tipa i obično je to prvo slovo. Jedini izuzetak je FTP bounce scan (−b). Defaultno, Nmap radi SYN scan iako će ga zamijeniti s Connect() skenom, ako korisnik nema odgovarajuće ovlasti slanja raw paketa (root pristup na UNIX sustavima) ili ako je specificirana IPv6 kao ciljana IP adresa. Od svih navedenih tipova skenova u ovom poglavlju, neprivilegirani korisnik može pokrenuti samo Connect() i FTP bounce scan. −sS (TCP SYN scan) SYN scan je defaultni i najpopularniji način skeniranja i to zbog opravdanih razloga. Može ga se izvesti brzo, može skenirati tisuće portova u sekundi na brzim mrežama koje nisu opterećene firewall uređajima koji utječu na kretanje paketa. SYN scan je relativno neagresivan i nevidljiv, jer nikad ne završi TCP konekciju (ne uspostavi trostruko rukovanje do kraja). Također je jednako efikasan na svim implementacijama TCP stacka, jer ne ovisi o specifičnim platformama kao što je to slučaj kod Nmap−ovog Fin/Null/Xmas, Maimon i Idle skena. Također je u mogućnosti čisto i pouzdano razlučiti između otvorenog, zatvorenog i filtriranog stanja porta. Tehnika SYN scana se najčešće naziva poluotvoreno skeniranje, jer nikad ne uspostavite potpunu TCP konekciju. Naime, pošaljete SYN paket, kao što bi ga poslali u slučaju da želite uspostaviti stvarnu TCP konekciju i čekate na odgovor. Ako kao odgovor dobijete SYN/ACK, znači da postoji aplikacija koja sluša na tom portu (port je otvoren), dok RST (reset) znači da ne postoji aplikacija koja sluša na tom portu (port je zatvoren). Ukoliko i nakon nekoliko ponovnih slanja upita nema nikakvog odgovorar, port je okarakteriziran kao filtriran. Port je također označen kao filtriran ako kao odgovor dođe ICMP unreachable error (ICMP nedostupan − tip 3, kodovi 1, 2, 3, 9, 10 ili 13). −sT (TCP connect() scan) TCP Connect() scan je defaultni TCP tip skeniranja ukoliko je SYN scan nedostupan. To se događa u slučajevima kad korisnik nema privilegiju slanja raw paketa ili kad je skenirani host na IPv6 mreži. Umjesto da šalje raw pakete, kao što to radi većina drugih tipova skeniranja, Nmap zatraži operativni sustav da uspostavi konekciju s ciljanim računalom na poru kojiželimo skenirati, na način da pošalje connect() sistemski poziv. To je isti sistemski poziv koji koriste web preglednici, P2P klijenti i većina drugih mrežnih aplikacija kad ž ele uspostaviti konekciju. Dio je programskog unosa poznatog kao Berkeley Sockets API. Umjesto da iščitava raw pakete Nmap koristi navedeni API kako bi dobio statusne informacije svake pokušane konekcije. Ukoliko je SYN scan dostupan, obično je i bolji odabir. Naime, Nmap ima puno manje kontrole nad connect() API pozivom, nego nad raw paketima, te je samim tim Nap manje efikasan. Sistemski poziv napravi potpunu konekciju na otvorene portove ciljanog računala umjesto da napravi reset kao što je slučaj kod SYN skena. Tim postupkom ne samo da gubimo više vremena kako bi saznali da li su portovi otvoreni ili ne, nego postoji i veća vjerovatnost dsa će host zapisati u log pokušaj spajanja. Činjenica je da će svaki IDS sustav logirati i SYN i Connect scan, ali isto tako je činjenica da većina računala nema IDS sustav. Većina servisa na UNIX−oidima će dodati zapis u syslog i (ponekad) kriptičnu poruku o grešci, kad se Nmap spoji i odmah odspoji bez slanja podataka. Jadno napisani servisi se skrše kad se to dogodi, mada je to stvarno rijetkost. Administrator koji vidi hrpu pokušaja spajanja u logovima koji su svi inicirani s jednog hosta, odmah će znati da je netko skenirao portove Connect() metodom. −sU (UDP skenovi) Iako većina popularnih servisa na internetu korisiti TCP protokol, UDP [6] servisi su isto tako široko zastupljeni. DNS, SNMP i DHCP (registrirani portovi 53, 161/162 i 67/68) su tri najpoznatija. Zbog toga što je UDP skeniranje mnogo sporije i teže za izvesti nego TCP, neki sigurnosni auditori, ignoriraju UDP portove. To je velika pogreška, jer su exploitabilni UDP servisi česta pojava i napadači ih sigurno neće ignorirati. Srećom, Nmap može pomoći u istraživanju UDP portova. UDP scan aktivirate naredbom −sU. Može biti kombinirana s TCP skenom poput SYN skena ( −sS), kako bi oba protokola bili provjereni "jednim udarcem". UDP scan radi na način da pošalje prazan UDP header (bez podataka) na svaki ciljani port. Ukoliko je vraćen ICMP port unreachable (ICMP nedostupan port) i to tip 3 kod 3, onda je port zatvoren. Druge ICMP greške (tip 3, kodovi 1, 2, 9, 10 ili 13) označavaju port kao filtriran.Povremeno će servis odgovriti s UDP paketom, dokazujući da je port otvoren. Ukoliko nakon nekoliko retransmisija nema nikakvog odgovora, port je okarakteriziran kao otvoren|filtriran. To znači da bi port mogao biti otvoren ili možda paket filteri blokiraju promet prema njemu. Version scan (−sV) može pomoći da se ustanovi koji portovi su stvarno otvoreni, a koji su filtrirani. Veliki izaziv kod skeniranja UDP portova je napraviti ti brzo. Otvoreni i filtrirani portovi rijetko pošalju ikakav odgovor, ostavljajući Nmap da napravi time out, te nakon toga ponovno pošalje paket u slučaju da je prethodni iz bilo kojeg razloga bio izgubljen. Zatvoreni portovi su često još veći problem. Oni najčešće pošalju kao odgovor ICMP port unreacheble grešku. No, za razliku od RST paketa koje pošalju zatvoreni portovi na TCP protokolu kao odgovr na SYN ili Connect() scan, mnogi hostovi ograničavaju ICMP port urnreachable poruku po defaultu. Linnux i Solaris su jako striktni vezano za to. Tako npr. Linux 2.4.20 kernel ograničava destination unreachable poruku na jednu po sekundi (u net/ipv4/icmp.c biblioteci).. Nmap pokušava ustanoviti da li je to slučaj i smanjuje brzinu skeniranja veano uz to, kako bi spriječio zaguš ivanje nekorisnim paketima koje će ciljano računalo tako i tako tiho odbaciti. Nažalost, spomenuti limit koji je postavljen kod linuxa, znači da će skeniranje svih 65536 portova trajati više od 18 sati. Ideja ubrzavanja UDP skena je da se paralelno skenira više hostova, na način da se najprije skleniraju najpopularniji portovi na brz način, skenirajući iza firewall−a i koristeći −−host−timeout kako bi se izbjegli spori hostovi. −sN; −sF; −sX (TCP Null, FIN i Xmas skenovi) Ova tri tipa skenova (moguće ih je postići i više korištenjem −−scanflags opcije opisane u sljedećoj sekciji) iskorištavaju rupu u standardu TCP RFC [7] , kako bi razlučili koji port je otvoren, a koji zatvoren. Na strani 65 piše: “Ukoliko je stanje odredišnog porta ZATVORENO ... dolazeći segment koji ne sadrži RST prouzročuje da RST bude poslan kao odgovor.” Na idućoj stranici se raspravlja o paketima poslanim na otovorene portove bez upaljenih SYN, RST ili ACK bitova i kaže da: “najvjerovatnije se nećete naći u takovoj situaciji, ali ako se nađete, jednostavno odbacite paket.” Kod skeniranja sistema koji su kompatibilni s tim RFC tekstom, svaki paket koji u sebi ima upaljene bitove SYN, RST ili ACK rezzultirat će vraćenim RST paketom ako je port zatvoren, a neće dati nikakav odgovor, ako je port otvoren. Dok god nije upaljen niti jedan od tih bitova, bilo koja kombinacija druga tri bita (FIN, PSH i URG) je u redu. Nmap to iskorištava s tri dolje navedena tipa skeniranja: Null scan (−sN) Ne uključuje niti jedan od bitova (TCP oznaka zaglavlja je 0) FIN scan (−sF) Uključuje samo TCP FIN bit Xmas scan (−sX) Uključuje FIN, PSH i URG flagove, "osvjetljavajući" paket kao božićno drvce. (op. prev. Xmas=Božić Sva tri tipa skeniranja su potpuno ista što se ponašanja tiče, samo što su im upaljene različite TCP oznake u paketima. Ukoliko je kao odgovor dobiven RST paket, port se smatra zatvorenim, dok situacija u kojoj nema odgovora, smatra da je port otvoren|filtriran. Port je označen kao filtriran, ako je odgovor na scan ICMP unreachable greška (tip 3, kodovi 1, 2, 3, 9, 10 ili 13). Glavna prednost ovih tipova skeniranja je ta da mogu "proviriti" kroz neke ne stateful firewall uređaje i paket filtering rutere. Druga prednost im je ta da su još više nevidljivi od SYN skena. No, nemojte se u to pouzdavati, jer većina modernih IDS sustava može biti konfigurirana da ih prepozna. Veliki nedostatak je da ne podržavaju svi sistemi RFC 793 do zadnjeg slova, pa tako većina sustava odgovara RST paketom bez obzira na to da li je port otvoren ili nije. Kod takvih sustava su svi portovi koje Nmap skenira okarakterizirani kao zatvoreni. Većina operativnih sustava koji se tako ponašaju su Microsoft Windows, većina Cisco uređaja, BSDI i IBM OS/400. No, ovaj tip skeniranja radi na većini UNIX sustava. Dodatan nedostatak ovih tipova skenova je taj što ne mogu razlikovati otvorene portove od nekih filtriranih, te kao odgovor dobijete otvoren|filtriran, pa si vi mislite... −sA (TCP ACK scan) Ovaj tip skeniranja razlikuje se od ostalih do sad opisanih po tome što nikad ne otkrije otvorene ili čak otvorene|filtrirane portove. Namjena mu je mapirati pravila firewall−a, tj. da zaključi da li je firewall stateful, te koji su portovi filtrirani. Kad je u pitanju ACK scan, onda je upaljena samo ACK zastavica (flag) (osim ako koristite −−scanflags ). Kad skenirate nefiltrirane hostove, otvoreni i zatvoreni portovi će vratiti RST paket. Nmap ih u tom slučaju označi kao nefiltrirane, što znači da su dostupni ACK paketima, ali nije definirano da li su otvoreni ili zatvoreni. Portovi koji ne odgovaraju na upite ili pošalju određene ICMP greške (tip 3, kod 1, 2, 3, 9, 10 ili 13) su označeni kao filtrirani. −sW (TCP Window scan) Window scan je sličan ACK scanu, samo što exploatira implamentacijske detalje operativnih sustava kako bi razlučio otvorene portove od zatvorenih, umjesto da uvijek ispiše nefiltriran kad dobije RST kao odgovor. To radi na način da pregleda TCP Window polje RST paketa koji je dobio. Na nekim sustavima otovreni portovi koriste pozitivnu veličinu prozora (čak i za RST pakete), dok zatvoreni portovi imaju prozor veličine 0. Dakle, umjesto da uvijek označi port kao nefiltriran kad dobije RST kao odgovor, Window scan označi portove kao otvorene ili zatvorene, ovisno o tome da li je veličina prozora pozitivna ili 0. Ovaj način skeniranja se pouzdaje u implementacijske detalje nekih operativnih sustava, tako da mu ne morate uvijek vjerovati. Sistemi koji su "otporni" na ovaj način skeniranja obično će vratiti sve portove kao zatvorene. Naravno isto tako je moguće da računal stvarno nema otovrenih portova. Ukoliko je većina portova zatvorena, ali ima onih koji su označeni kao filtrirani, (npr. češće korišteni portovi poput 22, 25, 53) , sustav je podložan ovom načinu skeniranja i rezultat je najvjerovatnije ispravan. Ukoliko pokrenete sken koji vam vrati 1000 zatvorenih portova i 3 otvorena ili filtrirana porta, najvjerovatnije su ta 3 porta uistinu i otvorena. −sM (TCP Maimon scan) Maimon scan je dobio naziv po osobi koja ga je otkrila − Uriel Maimon. Tehniku skeniranja je opisao u časopisu Phrack broj 49 (Studeni 1996). Nmap je izdan 2 godine kasnije i omogućavao je tu tehniku skeniranja. Tehnika je ista kao i Null, Xmas i FIN scan, osim što je paket koji se šalje FIN/ACK. Po RFC dokumentu 793 (TCP), treba odgovoriti RST paketom, bez obzira da li je port otvoren ili zatvoren. No, Uriel je primjetio da većina BSD sistema jednostavno odbaci paket ako je port otvoren. −−scanflags (Custom TCP scan) Napredni Nmap korisnici nisu vezani uz poznate tipove skenova. −−scanflags opcija dozvoljava da dizajnirate vlastiti tip skeniranja, navodeći bilo koju kombinaciju TCP zastavica (flagova). Neka važi kreativni sokovi teku, dok izbjegavate otkrivanje svojih radnji od strane IDS sustava čiji su autori samo prošli kroz Nmap opcije i dodali pravila koja prepoznaju navedene tipove skeniranja. −−scanflags argument može biti brojčana vrijednost poput 9 (PSH i FIN), ali korištenje simboličnih imena je jednostavnije. Jednostavno izmješajte zajedno bilo koju kombinaciju zastavica (flagova) URG, ACK, PSH, RST, SYN i FIN. Npr. −−scanflags URGACKPSHRSTSYNFIN postavlja sve zastavice, ali nije pretjerano koristan za skeniranje. Redosljed navođenja zastavica je nebitan. Uz navođenje željenih zastavica, možete navesti i bazni TCP tip skeniranja (poput −sA ili −sF), što će objasniti Nmap−u kako da interpretira odgovore. Npr. SYN scan tretira paket na koji nije dobio odgovor kao filtriran port, dok ga FIN scan tretira kao otvoren|filtriran. Nmap će se ponašati isto kao što se ponaša kod specificiranog baznog skena, osim što će koristiti zastavice koje ste naveli. Ukoliko ne navedete bazni tip skeniranja, koristit će se SYN scan. −sI   (Idlescan) Ova napredna metoda skeniranja omogućava slijepo skeniranje ciljanog računala (niti jedan paket nije poslan na ciljano računalo s vaše stvarne IP adrese).Umjesto toga koristite zombie host računalo i predvidljiv IP fragmentation ID na njemu kako bi dobili informaciju o tome koji su portovi otvoreni na ciljanom računalu. IDS sustavi će pokazati da scan dolazi sa zombie mašine kojju ste specificirali kod pokretanja ovog tipa skeniranja (zombie mora biti upaljen i mora zadovoljavati neke kriterije). Ovaj način skeniranja je prekompleksan da bi ga ovdje opisali u potpunosti, pa sam napisao i postao informativni članak sa svim detaljima na http://nmap.org/book/idlescan.html. Osim što je nevjerovatno nevidljiv (zbog načina na koji radi) ovaj tip skeniranja omogućava mapiranje IP baziranih pravila između računala. Ispis portova pokazuje otvorene portove kako ih vidi zombi računalo. Dakle, možete koristiti više zombie računala za skeniranje ciljanog računala. Možete staviti dvotočku i broj porta iza nje, kako bi na tom portu provjerili da li su IPID promjene predvidljive. Ukoliko to ne navedete, Nmap će koristiti standardni port za TCP pinganje (80). −sO (IP protocol scan) IP protokol scan Vam omogućava da provjerite koji IP protokoli (TCP, ICMP, IGMP isl.) su podržani na ciljanim mašinama. Tehnički gledano, to i nije port scan jer prolazi kroz brojeve IP protokola, a ne kroz brojeve TCP i UDP portova. No ipak koristi opciju −p, kako bi odabrao skenirane brojeve IP protokola, ispisuje rezultate u normalnoj tabeli kao i kod skeniranja portova, pa čak koristi i isti engine za skeniranje kao i kod skeniranja portova. Kad sve to uzmemo u obzir − ova metoda skeniranja je dovoljno slična skeniranju portova, pa je stoga i uključena u ovo poglavlje. Osim što je koristan sam po sebi, protokol scan pokazuje i snagu open source softvera. Iako je temeljna metoda vrlo jednostavna, nisam je mislio uključiti u Nmap, niti sam dobio zahtjev za tom funkcionalnošću, sve dok u ljeto 2000, Gerhard Rieger nije razvio ideju, napisao izvanredan patch koji to implementira u Nmap i posalo na nmap−hakers listu. Uključio sam taj patch u Nmap i pustio novu verziju već drugi dan. Jako malo komercijalnog softvera ima korisnike koji su toliki entuzijasti da bi razvili vlastita poboljšanja za pojedine produkte! Protokol scan radi vrlo slično kao i UDP scan. Umjesto da prolazi kroz brojeve portova UDP paketa, šalje IP pakete i prolazi kroz 8 bitnio polje samog IP protokola. Headeri (zaglavlja) su obično prazni i ne sadrže nikakve podatke, pa čak niti ispravni header za određeni protokol. Izuzeci od tog pravila su TCP, UDP i ICMP protokol. Za te protokole je uključen ispravan protokol header (zaglavlje), jer neki sustavi u suprotonom ne žele poslati paket, tako da Nmap već ima funkcije za kreiranje ispravnih headera. Umjesto da čeka ICMP unreachable poruku, protokol scan traži ICMP protoKol unreachable poruku. Ukoliko Nmap dobije bilo kakav odgovor u bilo kojem protokolu od ciljanog računala, Nmap označi taj protokol kao oOtvoren. ICMP protocol unreachable greška (tip 3, kod 2) označi protokol kao Zatvoren. Sve ostale ICMP poruke (tip 3, kod 1, 3, 9, 10 i 13) označe protokol kao filtriran (iako je to istovremeno dokaz da je ICMP protokol otvoren). Ukoliko ne dođe nikakav odgovor nakon ponovnih pokušaja slanja, protokol je označen kao otvoren|filtriran. −b   (FTP bounce scan) Zanimljiva funkcionalnost FTP protokola (RFC 959 [8] ) je podrška za tzv. proxy ftp konekcije. To omogućuje korisniku da se spoji na jedan FTP server, te nakon toga zatraži da fileovi budu poslani na neki drugi FTP server. Ta funkcionalnost je sazrijela za napade na mnogo nivoa, tako da je većina servera prestala pružati podršku za to. Jedan od napada koji je izvediv je taj da omogućava napadaču natjerati FTP server da skenira druge FTP servera u potrazi za otvorenim portovima. Jednostavno zatražite od FTP servera da poš alje datoteku na svaki od portova koji vas zanima na ciljanom računalu. Poruka o grešci koju ćete dobiti će vam raći da li je port otvoren ili nije. To je ujedno i dobar način obilaženja firewall−a (vatrozida), jer su mnogi FTP serveri smješteni tamo gdje imaju veći pristup unutrašnjim računalima, nego bilo koje računalo s interneta. Nmap podržava FTP bounce scan s opcijom −b. Prima parametar u sljedećem obliku: username: password@server:port. Server je naziv ili IP adresa ranjivog FTP servera. Kao i kod normalnog URL−a, možete zanemariti username:password, te ćete se u tom slučaju spojiti kao anonymous user i koriste se sljedeći parametri anonymous password:−wwwuser@. Broj porta i dvotočka ispred njega također mogu biti zanemarini, a u tom slučaju ćete se spojiti na standardni FTP port (21). 1997., kad je Nmap lansiran, ova ranjivost je bila široko rasprostranjena, ali do sad je uglavnom "pokrpana" na većini računala. Ipak, još uvijek postoji ranjivi serveri, pa nije loše pokušati i ovu opciju kad sve oostale zataje. Ukoliko je obilaženje vatrozida vaš cilj, skenirajte ciljanu mrežu za otvorenim portom 21 (ili bilo koji ftp servis, ako skenirate sve portove s otkrivanjem verzije programa − version detection), te nakon toga pokušajte ftp bounce scan. Nmap će vam reći da li je host ranjiv ili nije. Ukoliko samo pokušavate sakriti tragove, ne biste trebali (u stvari ne biste smjeli) skenirati samo hostove na ciljanoj mreži. No, prije nego nasumično počnete skenirati za ranjivim ftp serverima na internetu, imajte na umu da većina sysadmina neće cijeniti što im "iskorištavate" servere na taj način SPECIFIKACIJA PORTOVA I REDOSLJED SKENIRANJA Uz sve do sad nabrojane metode skeniranja, Nmap nudi opcije pomoću kojih možete specificirati koje portove želite skenirati, da li će skeniranje portova biti nasumično ili sekvencionalno. Defaultno Nmap skenira sve portove od 0 do 1024 (uključujući i njih) kao i sve portove iznad 1024 koji su navedeni u nmap−services datoteci. −p   (Skeniraj samo navedene portove) Pomoću ove opcije možete odabrati koje portove ćete skenirati i na taj način obići defaultne postavke. Možete unijeti pojedinačne brojeve i/ili niz brojeva odvojenih minusom (npr. 1−1023).Ukoliko ž elite skenirati sve portove možete napisati samo parametar −p− i Nmap će skenirati sve portove od 1−65535. Port 0 je moguće skenirati jedino ako ga navedete. Kad je u pitanju IP protokol scan (−sO), opcija −p definira koji protokol želite skenirati (od 0−255). Kad skenirate i TCP i UDP portove zajedno, možete navesti identifikator protokola na način da prije brojeva portova stavite identifikator T: za TCP porove ili U: za UDP portove. Parametar vrijedi sve dok ne navedete neki drugi. Na taj bi način skenirali UDP portove 53, 111 i 137, kao i TCP portove 21−25, 80, 139 i 8080. Imajte na umu da morate navesti parametar −sU i bar jedan TCP tip skeniranja (kao npr. −sS, −sF ili −sT) kako bi mogli istovremeno skenirati i TCP i UDP portove. Ukoliko niste naveli identifikator protokola, navedeni portovi će biti skenirani i po TCP i po UDP protokolu. −F (brzi scan (s ograničenim portovima)) Ova opcija kaže Nmapu da skenira samo portove navedene u nmap−services datoteci, koja dolazi s Nmap−om. (ili protokol datoteke kad je u pitanju opcija −sO ) To je mnogo brže nego skeniranje svih 65535 portova. Kako navedeni popis ima preko 1200 TCP portova, razlika u brzini između ove opcije i defaultnog TCP scana (koji ima oko 1650 portova) nije dramatična. Razlika može biti osjetno velika ako koristite svoju nmap−services datoteku koristeći opciju −−datadir −r (Ne miješaj portove) Defaultno, Nmap nasumično odabire potove koje skenira (osim nekih standardnih portova koji su stavljeni na početak zbog efikasnosti). To "miješanje" portova je u normalnim situacijama poželjno, ali pomoću ove opcije možete skenirati portove baš onim redosljedom kojim ste ih naveli. PREPOZNAVANJE SERVISA I NJIHOVIH VERZIJA Skenirajte neko računalo pomoću Nmap−a i mogao bi vam reći da su portovi 25/tcp, 80/tcp i 53/tcp otvoreni. Koristeći nmap−services bazu podataka u kojoj se nalazi preko 2200 poznatih servisa, Nmap će vam reći da su na navedenim portzovima najvjerovatnije mail server (SMTP), web server (HTTP) i name server (DNS). To je u većini slučajeva ispravno, većina servera koji slušaju na portu 25 su uistinu mail serveri, ali nemojte biti 100% sigurni u to, jer postoje ljudi koji pokreću servise na "čudnim" portovima. Ako je Nmap ipak u pravu i server o kojem je riječ ima pokrenut SMTP, HTTP i DNS server, to ipak nije pretjerano mnogo informacija. Ukoiko radite pregled ranjivosti (vulnerability assessment) ili samo jednostavan inventar mrež nih servisa na računalima u firmi, činjenica je da trebate mnogo više informacija od gore navedenih. Želite znati koje verzije mail, HTTP i DNS servera su pokrenute na tom računalu. Kad imate "pri ruci" ispravnu verziju serverske komponente nije teško ustanoviti koje ranjivosti dotični server ima. Otkrivanje verzije vam pomaže u dobivanju tih informacija. Nakon što ste otkrili koji TCP i/ili UDP portovi su otvoreni korištenjem neke od do sad opisanih tehnika, otkrivanje verzije ispituje te portove ne bi li otkrilo što je u stvari na tim portovima, tj. koja aplikacija je otvorila dotičpne portove. nmap−service−probes baza podataka sadži upite za ispitivanje raznih servisa i prepoznavanje na osnovu odgovora koje dobije. Nmap pokušava ustanoviti protokol na kojem radi servis (npr. ftp, ssh, telnet, http), naziv aplikacije (npr. ISC Bind, Apache, httpd, Solaris telnetd) , verziju, naziv hosta, tip uređaja (npr. printer, ruter), porodicu iz koje dolazi OS (npr. Windows, Linux) i ponekad neke detalje poput toga da li je otvoren X server, verziju protokola koju koristi SSH ili KaZaA korisničko ime. Naravno, većina servisa ne daje sve te informacije. Ukoliko je Nmap kompajliran s podrškom za OpenSSL protokol, spojit će se na SSL servere kako bi ustanovio servise koji se nalaze iznad enkripcijskog sloja. Ako su otkriveni RPC servisi, Nmap RCP istraživač (−sR) je automatski uključen kako bi otkrio koji program se nalazi iz RPC−a i koja mu je verzija. Neki UDP portovi su označeni s otvoren|filtriran, ako UDP scan nije mogao odrediti da li je port otvoren ili filtriran. Otkrivanje verzije će pokušati dobiti odgovor s tih portova (isto kao što to radi i kod otvorenih portova), te će promijeniti njihovo stanje u otvoren ako uspije dobiti odgovor. TCP portovi koji su okarakterizirani kao otvoreni|filtrirani, tretirani su na isti način. Imajte na umu da opcija −A omogućije otkrivanje verzije uz ostale stvari koje podržava. Dokument koji objašnjava rad, korištenje i mijenjanje ovog dijela programa je dostupan na linku: http://www.insecure.org/nmap/vscan/. Kad Nmap dobije odgovr od servisa, a ne može ga usporediti s ni jednim zapisom u svojoj bazi podataka, ispisat će scepijalni "fingerprint" i URL linka na koji ga možete poslati ukoliko ste sigurni u to što se nalazi na tom portu. Molim vas da odvojite nekoliko minuta svog vremena kako bi poslali te informacije, jer će kasnije nekom drugom biti od velike koristi. Zahvaljujući upravo takvom načinu prikupljanaj informacija, Nmap ima preko 3000 zapisa koji odgovaraju (prepoznavaju) preko 350 protokola, poput smtp−a, ftp−a, http−a, itd.. Otkrivanje verzije se uključuje i njime se upravlja korištenjem sljedećih opcija: −sV (Otkrivanje verzije) Uključuje otkrivanje verzije, kao što je opisano gore. Kao zamjenu, možete koristiti opciju −A da bi istovremeno uključili OS detekciju i otkrivanje verzije servisa. −−allports (koristi sve portove u otkrivanju verzije servisa) Nmap−ovo otkrivanje verzije servisa preskače port 9100, jer neki printeri jednostavno isprintaju sve što se pošalje na taj port, što rezultira s hrpom stranica na kojima su HTTP GET zahtjevi, binarni SSL zahtjevi isl. Ukoliko ipak želite koristiti i takve portove, možete to napraviti na način da maknete Exclude naredbu u nmap−service−probes datoteci ili jednostavno uključite opciju −−allports, koja će ignorirati Exclude naredbu u nmap−services−probes. −−version−intensity   (podesite intenzitet otkrivanja verzije servisa) Kad radite scan otkrivanja verzije (−sV), Nmap šalje seriju upita od kojih je svakom dodijeljen broj od 1 do 9. Oni upiti koji imaju niže brojeve u efikasni kod većine često korištenih servisa, dok su oni s višim brojevima rijetko korisni. Nivo nntenziteta skeniranja određuje koji upiti će biti korišteni. Što je veći broj, to je veća vjerovatnost da će servis biti ispravno identificiran. No, takvi skenovi traju duže. Intenzitet mora biti između 0 i 9. Preddefinirana vrijednost je 7. Ukoliko je upit registriran u nmap−service−probes ports naredbi, bit će isproban bez obzira na nivo intenziteta. To garantira da će DNS upiti uvijek biti odrađeni na portu 53, SSL na portu 443 itd. −−version−light (omogući "lagani" mod) To je jednostavniji način pozivanja opcije −−version−intensity 2. Lagani mod ubrzava skeniranje, ali je samim tim i manja vjerovatnost da će identificirati servis. −−version−all (isprobaj sve upite) Zamjena za opciju −−version−intensity 9. Isprobat će sve upite u bazi podataka −−version−trace (prati sve što se događa tijekom skena) Nmap ispiše opširne debug informacije o tome što trenutno radi opcija otkrivanja verzije servisa. To je dio onoga što ćete dobiti opcijom −−packet−trace. −sR (RPC scan) Ova metoda radi u sprezi s različitim port scan metodama Nmap−a. Uzme sve TCP/UDP portove koji su identificirani kao otvoreni i preplavi ih sa SunRPC NULL naredbama pokušavajući ustanoviti da li su RPC portovi i ako jesu za koje programe rade. Stoga možete efikasno dobiti iste informacije kao i s naredbom rpcinfo −p, čak i kad je ciljani portmapper iza firewall−a (ili zaštićen TCP omotačima). Mamci trenutno NE rade s RPC skenom. To je automatski uključeno kao dio skeniranja verzije servisa (−sV). Budući da otkrivanje verzije servisa samo po sebi već ima uključenu ovu opciju, −sR se rijetko koristi. OTKRIVANJE OS-A Jedna od najpoznatijih odlika Nmapa je otkrivanje OS−a na ciljanom računalu korištenjem TCP/IP stack otiska (engl. fingerprint). Nmap šalje mnoštvo TCP i UDP paketa na udaljeno računalo i istražuje svaki bit vraćenih paketa. Nakon što je učinio hrpu testova poput TCP ISN sampling, podrška i redosljed TCP opcija, IPID sampling i provjeru veličine inicijalnog TCP prozora, Nmap uspoređuje rezultate s nmap−os−fingerprints bazom podataka s više od 1500 poznatih OS otisaka (engl fingerprint), te ispiše detalje o OS−u ukoliko ga je uspio "pogoditi". Svaki otisak sadrži neformatirani tekstualni opis OS−a i klasifikaciju u koju ulazi naziv izdavača (npr. Sun), OS (npr. Solaris), generacija OS−a (npr. 10) i tip uređaja (općenite namjene, ruter, switch, igraća konzola isl.). Ukoliko Nmap nije u stanju odrediti koji OS je pokrenut na ciljanom računalu, a uvjeti su dobri (npr. postoji barem jedan otvoreni port na računalu), Nmap će vam ponuditi URL link preko kojeg možete poslati otisak ukoliko ste sigurni u to koji OS se nalazi na tom računalu. Na taj način pomažete u nastojanjima da Nmap nauči raspoznati što je moguće više sistema i samim tim postane precizniji u pogađanju. Otkrivanje OS−a omogućava još neke dodatne testove koji koriste informacije prikupljene tijekom procesa pogađanja. Jedan od tih dodatnih testova je i vrijeme od kad je upaljeno računalo (uptime), koji koristi TCP timestamp opciju (RFC 1323) kako bi pogodio kad je računalo zadnji put resetirano.To je prikazano samo za ona računala koja daju tu informaciju. Drugi test je predvidljivost TCP sekvenci. Taj test mjeri koliko je teško uspostaviti lažiranu TCP vezu s udaljenim računalom. To je korisno ukoliko želite iskoristiti povjerenje bazirano na ishodišnoj IP adresi (recimo kod rlogin−a, vatrozida, filtera itd.) ili u situacijama kada želite sakriti svoje tragove. Ovaj način prikrivanja se danas rijetko koristi, no još uvijek postoji velika količina računala koja su ranjiva. Stvarni broj "težine" je baziran na statističkom skupljanju podataka i varira. Obično je bolje koristiti klasifikaciju poput “popriličan izazov” i “toliko jednostavno da je smiješno” . Ovakakv način izvještavanja dobit ćete u normalnom ispisu kad uključite verbose opciju (−v). Kad je verbose opcija uključena zajedno s −O, onda kao rezultat dobijete i izvještaj generiranja IPID sekvence. Većina računala je u tzv. “inkrementalnoj” klasi, što znači da sa svakim poslanim paketom uvećaju ID polje IP zaglavlja. To ih čini ranjivima na nekoliko naprednih načina sakupljanja informacija i napade zavaravanja (engl. spoofing). Dokument u kojem je opisano kako radi, kako se koristi i kako se može prilagoditi otkrivanje verzije, dostupan je u podosta jezika na linku: http://www.insecure.org/nmap/osdetect/. Otkrivanje OS−a se uključuje i upravlja sa sljedećim opcijama −O (Uključi otkrivanje OS−a) Ova opcije uključi otkrivanje OS−a kako je opisano u prethodnom odlomku. Isto tak omožete koristiti opciju −A da istovremeno uključite otkrivanje OS−a i verzije −−osscan−limit (ograniči otkrivanje OS−a samo na ciljeve koji obećavaju) Otkrivanje OS−a je mnogo učinkovitije ako postoji bar jedan otvoren i zatvoren port. Ukoliko uključite ovu opciju, Nmap neće niti pokušati raditi otkrivanje OS−a na hostovima koji nisu zadovoljili ovaj kriterij. To vam može uštedjeti mnogo vremena, pogotovo kod skeniranja s opcijom −P0 kad koristite mnogo ciljanih računala. Ovu opciju možete koristiti samo su kombinaciji s opcijama −O ili −A. −−osscan−guess; −−fuzzy (probaj pogoditi OS na osnovu rezultata) Ukoliko Nmap nije našao idealan rezultat, ponekad ponudi najbliži rezultat koji bi mogao biti. Ukoliko odaberete neku od ovih opcija, Nmap će “pogađati agresivnije”. VRIJEME ODAZIVA I PERFORMANSE Jedan od najviših prioriteta tijekom razvijanja Nmap−a su performase. Defaultni scan (nmaphostname) nekog računala na lokalnoj mreži traje petinu sekunde. To je manje od vremena koje vam je potrebno za treptaj oka, ali naravno kad skenirate 10 ili 100 tisuća hostova postane osjetno. Uz to, neki tipovi skenova, poput UDP skeniranja i otkrivanja verzijemogu to vrijeme poprilično produžiti. Isto tako skeniranje mogu usporiti i neke konfiguracije vatrozida, pogptovo limitiranje količine odgovora u jedinici vremena.Iako Nmap koristi paralalno izvršavanje skenova kako bi ih dodatno ubrzao, sam korisnik ima potpunu kontrolu nad time. Napredni korisnici pažljivo kombiniraju Nmap naredbe kako bi dobili samo informacije koje im trebaju poštivajući vremenske termine koje su si zadali. Tehnike za ubrzavanje skeniranja sastoje se od toga da izbacite nepotrebne testove i naravno da nadogradite Nmap na posljednju verziju (poboljšanja performansi se konstantno rade). Optimiziranje vremena odziva (engl. Timing) takođem može utjecati na brzinu skeniranja. Opcije slijede: −−min−hostgroup  ; −−max−hostgroup   (Podešava veličinu grupe paralelnih skenova) Nmap ima mogućnost skeniranja više hostova paralelno. To radi na način da podijeli adresni prostor ciljanih računala u grupe i onda skenira grupu po grupu. U principu ispada da su veće grupe učinkovitije. Nedostatak je taj š to rezultati ne mogu biti prikazani dok cijela grupa nije odskenirana do kraja. Dakle, ako je Nmap krenuo skenirati grupu od 50 računala, korisnik nrćr vidjeti nikakve rezultate (osim onih koje ispisuje opcija −v) dok svih 50 hostova nije odskenirano. Defaultno Nmap radi kompromis. Počinje s grupom od 5 hostova, tako da se prvi rezultati brzo pojave na ekranu, a nakon toga poveća veličinu grupe na 1024. Točan broj ovisi o uključenim opcijama. Zbog povećane efikasnosti Nmap koristi veće grupe za UDP skenove, a manje za TCP skenove. Kad definirate maksimalnu veličinu grupe pomoću opcije −−max−hostgroup, Nmap je neće nikad premašiti. Ukoliko pak specificirate minimalnu veličinu grupe s −−min−hostgroup, Nmap će pokušati zadržati veličinu grupe iznad tog nivoa. Naravno, ukoliko broj hostova koji su ostali za skeniranje bude manji od minimalne grupa Nmap će normalno odraditi svoj posao. Obje opcije možete koristiti istovremeno kako bi veličinu grupe zadržali u željenim okvirima, ali to je rijetko potrebno. Primarna upotrenba ovih opcija je navođenje što veće minimalne veličine grupe kako bi skenovi brže odradili svoj posao. Najčeđći odabir je 256, kako bi skeniranje mreže išlo u odsječcima C klase. Za skenove u kojima se skenira mnogo portova, povećanje tog broja iznad 256 će rijetko pomoći. Ukoliko pak skenirate samo nekoliko portova, veličina grupe od 2048 ili više, može biti od pomoći. −−min−parallelism  ; −−max−parallelism   (Podesi paralelizam) Ove opcije upravljaju brojem sondi (engl. probe) koje mogu biti poslane po grupi hostova. Koriste se za skeniranje portova i otkrivanje hostova. Defaultno Nmap svaki put izračuna idealni paralelizam vezano uz mrežne performanse, a mijenja ga tijekom skena, ovisno o ujetima. Ukoliko dolazi do odbačenih paketa, Nmap uspori tj. šalje manje sondi. Broj sondi polako raste ako mreža daje naznaku da može prihvatiti više od trenutnog broja. Ove opcije postavljaju minimalnu i maksimalnu granicu. Defaultno paralelizam može pasti na 1 ako je mreža nepouzdana ili narasti na nekoliko stotina, ako imamo idealne uvjete. Najčešći način upotrebe je da se podesi −−min−parallelism na broj veći od 1 kako bi se ubrzalo skeniranje sporijih hostova i mreža. To je ujedno i riskantna opcija, jer ako podesite prevelik broj, utjecat ćete na točnost skena. Isto tako, ukolik opodesite ovu opciju, sprječavate Nmap da dinamički upravlja paralelizmom vezano uz stvarne uvjete na mreži. Broj 10 ima smisla, ali osobno podešavam tu vrijednost kad nemam ništa drugo na rapolaganju. Opcija −−max−parallelism stavite na 1 ukoliko želite spriječiti Nmap da koristi paralelizam, tj. želite da šalje samo jednu po jednu sondu.To može biti korisno u kombinaciji s opcijom −−scan−delay (objasnit ćemo je kasnije), mada ta opcija sama po sebi služi svrsi dovoljno dobro. −−min_rtt_timeout  , −−max−rtt−timeout  , −−initial−rtt−timeout   (Podesi vrijeme trajanja sondi) Nmap pazi na vrijeme isteka da bi mogao ustanoviti koliko dugo će čekati na odgovor sonde prije nego odustane ili ponovno pokuša poslati istu sondu. To se izračunava na osnovu prethodnih sondi i vremenskog odaziva koji su imale. Ukoliko se mrežno kašnjenje pokaže značajnim i promjenjivim, vrijeme isteka može narasti i na nekoliko sekundi. Također počinje na konzervativnom (visokom) nivou i takvo će ostati u slučaju da Nmap skenira hostove koji ne odgovaraju. Ove opcije primaju vrijednost u milisekundama, ali vi možete navesti vrijeme u sekundama, minutama ili satima na način da stavite opciju s, m ili h. Navođenje nižeg −−max−rtt−timeout i −−initial−rtt−timeout od defaultnog može osjetno skratiti vrijeme potrebno za skeniranje. To je posebno vidljivo kod (−P0) skenova i skenova prema jako filtriranim mrežama. Ipak, nemojte biti preagresivni, jer vam u tom slučaju skeniranje može i dulje potrajati, jer će Nmap ponovno slati sonde, a odgovr na prethodne je možda na putu nazad. Ukoliko su svi hostovi na lokalnoj mreži, 100ms je razumna vrijednost za −−max−rtt−timeout _timeout. Ukoliko postoje ruteri između Nmapa i hostova, najprije pingajte hosta s ICMP ping alatom ili s naprednijim alatom poput Hping2 koji ima veće mogućnosti proći kroz vatrozid. Pogledajte koja je srednja vrijednost vremena portebnog da se paket vrati za 10−tak paketa. Tu vrijednost pomnožite s 2 za −−initial−rtt−timeout i s 3 ili 4 za −−max−rtt−timeout. Osobno ne postavljam maksimalni rtt ispod 100ms, bez obzira na vrijednosti koje dobijem pinganjem, niti stavljam više od 1000ms. −−min−rtt−timeout je rijetko korištena opcija koja može biti korisna kod jako nepouzdanih mrež a na kojima su čak i Nmap−ove defaultne postavke preagresivne. Kako Nmap spušta vrijeme isteka na minimum tek kad zaključi da je mreža pouzdana, ovo bi trebalo prijeviti kao bug na nmap−dev mailing listu. −−max−retries   (Navedi maksimalni broj ponovnih slanja sondi) Kad Nmap ne dobije odgovor na sondu koja skenira port, to može značiti da je port filtriran ili to da je sonda ili odgovor na nju izgubljen na mreži. Isto tako je moguće da ciljani host ima podešenu granicu na količinu paketa na koje odgovara, pa je samo privremeno blokiran odgovor. Kako bi bio siuguran o čemiu je riječ, Nmap ponovno šalje sonde na koje nije dobio odgovor. Ukoliko ustanovi da je mreža nepouzdana, može se dogoditi da pošalje sondu još mnogo puta prije nego odustane. Ovo je opcija koja daje točnije rezultate, ali isto tako i usporava postupak skeniranja. Kad je brzina skeniranja ključna, možete koristiti ovu opciju kako bi ograničili broj ponovnih slanja sondi. Čak možete navesti i −−max−retries 0 kako bi u potunosti spriječili ponovno slanje, makar je to rijetko preporučljivo. Defaultna postavka (bez −T predloška) je 10 ponovnih slanja. Ukoliko se mreža pokaže pouzdanom i ciljani hostovi ne ograničavaju skeniranje, Nmap će napraviti samo jedno ponovno slanje. Gledano iz tog kuta, na većinu ciljanih računala ne utječe ako stavite −−max−retries na nizak broj poput 3. To je vrijednost koja može mnogostruko ubrzati skeniranje sporih hostova (onih koji ne dozvoljavaju mnogo port skenova s jedne IP adrese, nego ih jednostavno blokiraju). Istina je da obično izgubite neke informacija ako Nmap prerano odustane od hosta, ali i to je bolje nego ostaviti −−host−timeout da istekne i izgibiti sve informacije o ciljanom hostu. −−host−timeout   (odustani od skeniranja sporih hostova) Skeniranje nekih hostova jednostavno traje jako dugo. To može biti zbog lošeg mrežnog hardvera ili softvera, ograničavanju količine paketa ili restriktivnih vatrozida. Nekoliko posto sporih hostova, mogu “pojesti” većinu vremena koje je potrebno za skeniranje. Ponekad je najbolje odustati od skeniranja takvih hostova kako bi stvar brže završila. To možete napraviti navođenjem parametra −−host−timeout s brojem milisekundi koliko ste voljni čekati odgovor. Možete staviti i s, m ili h kako bi naveli sekunde, minute i sate. Osobno obično stavim 30m kako bih se osigurao da Nmap ne troši više od 30m vremena po hostu. Imajte na umu da će Nmap za to vrijeme skenirati i ostale hostove, tako da to nije u potpunosti izgubljeno vrijeme. Host koji je dosegao vrijeme isteka je preskočen i z anjega nije ispisan nikakav rezultat poput port tabele, OS detekcije ili detekcije verzija. −−scan−delay  ; −−max_scan−delay   (podesi stanke između sondi) Ova opcija prisiljava Nmap da pričeka barem navedeno vrijeme u milisekundama prije nego pošalje iduću sondu prema tom hostu. Kao i kod većine drugih opcija koje imaju veze s vremenom, možete navesti s, m ili h da bi definirali kašnjenje u sekundama, minutama ili satima. To je itekako korisno kod računala koja imaju upaljen "rate limiting". Solaris računala (između ostalih) će na UDP sken sonde odgovarati samo s jednom ICMP porukom po sekundi. Ako Nmap šalje UDP pakete češće od 1 sekunde, ti su paketa jednostavno uludo bačeni. Opcija −−scan−delay od 1s će zadržati Nmap u sporom tempu. Nmap pokušava ustanoviti koji je "rate limit" podešen na jostu i prilagođava sken ovisno o tome, ali neće škoditi ako ga unaprijed definirate za hostove za koje ste sigurni da će se tako ponašati. Kad Nmap podesi sken shodno tome, dolazi do dramatičnog usporavanja. −−max_scan−delay opcija definira najveće kašnjanje koje će Nmap dozvoliti. Ukoliko podesite ovu opciju na premalu vrijednost, doći će do uzaludnog (prečestog) slanja paketa i samim tim promašenih otvorenih portova ako ciljani host ima uključen “ rate limiting”. Još jedno način korištenja opcije −−scan−delay je da se izbjegnu intrusion detection i intrusion prevention (IDS/IPS) sustavi, koji su bazirani na zadanoj vrijednosti (engl. treshold). −T   (Podesite predložak za vremenske postavke) Iako su do sad navedene opcije snažne i efikasne, većini ljudi su nerazumljive i zbunjujuće. Uz to, odabrati prave vrijednosti ponekad može potrajati duže od skena koji želite optimizirati. Zbog toga Vam Nmap nudi jednostavniji pristup, korištenjem 6 preddefiniranih predložaka. Možete ih navesti korištenjem −T opcije s brojevima od 0−5 ili njihovim imenima.Nazivi predložaka su: paranoidno (engl. paranoid) (0), skriven (engl. sneaky) (1), pristojan (eng. polite) (2), normalan (engl. normal) (3), agresivan (engl. aggressive) (4) i lud (engl. insane) (5). Prva dva su za obilaženje IDS sustava. Predložak pristojan usporava skeniranje kako bi što je moguće manje opteretio mrežne resurse i računalo koje skenirate. Normalni mod je defaultna postavka i postavljanje opcije −T3 zapravo ne uvodi nikakve promjene. Agresivni mod ubrzava skeniranje pod pretpostavkom da ste na poprilično brzoj i pouzdanoj mreži. Na kraju "ludi" mod pretpostavlja da ste na posebno brzoj mreži i da ste spremni žrtvovati točnost rezultata kako bi dobili na brzini. Navedeni predlošci omogućavaju korisnicima da navedu koliko agresivni žele biti, ostavljajući Nmap−u da odabere točne vrijednosti. Predlošci također rade neka manja podešavanja brzine za koja trenutno ne postoje drugi načini. Npr. −T4 sprječava da dinamičko kašnjenje skeniranja prijeđe 10ms za TCP portove, dok −T5 drži tu vrijednost na 5ms. Predlođke možete kombinirati s finijim kontrolama, sve dok je template naveden prvi inače će vrijednosti iz predloška nadjačati one koje ste naveli. Predlažem korisštenje opcije −T4 kod skeniranja modernih i pouzdanih mreža. Ostavite tu opciju na početku komandne linije čak i kad koristite neke finije naredbe kako bi imali koristi od dodatnih optimizacija koje predložak donosi. Ukoliko ste na pristojnoj broadband ili eternet konekciji, predlažem korištenje opcije −T4. Neki ljudi vole −T5, mada je preagresoivan za moj ukus. Isto tako ljudi ponekad stave −T2 misleći da je manja vjerovatnost da će tako srušiti host ili se inače smatraju pristojnima. No oni u stvari ne razumiju koliko je opcije −T pristojno u stvari spora. Ovaj način skeniranja može potrajati i do 10 puta duže nego defaultni.Padovi računala i problemi s bandwithom su rijetki s korištenjem defaultne opcije −T3, pa je normalno preporučam opreznim skenerima.Izbjegavanje otkrivanja verzije je u svakom slučaju efikasnije u pokušaju rješevanja tih problema nego igranje s vremenima odaziva. Iako su opcije −T0 i −T1 korisne u izbjegavanju otkrivanja od strane IDS sustava, skeniranje tisuću portova će trajati jaaaako dugo. Kod takcih skenova je možda bolje direktno navesti vremena odaziva nego se pouzdati u preddefinirane vrijednosti opcija −T0 i −T1. Glavni efekt korištenja opcije T0 je taj da su skenovi serijski (skenira se port po port) i nakon odskeniranog porta čeka 5 minuta prije nego će poslati iduću sondu.T1 i T2 su slični s tim da T1 čeka 15 sekundi između sondi, dok T2 čeka 0.4 sekunde između sondi. T3 je defaultna postavka koja uključuje paralilizam (skenirano je više portova istovremeno). Opcije T3 je isto kao i −−max−rtt−timeout 1250 −−initial−rtt−timeout 500 −−max−retries 6, te podešava maksimalno TCP kašnjenje na 10ms. Opcija T5 je isto kao i −−max−rtt−timeout 300 −−min_rtt_timeout 50 −−initial−rtt−timeout 250 −−max−retries 2 −−host−timeout 900000 kao i postavljanje maksimalnog TCP sken kaš njenja na 5ms. IZBJEGAVANJE I ZAVARAVANJE VATROZIDA I IDS-A Mnogo pionira interneta zu zamislili globalnu otvorenu mrežu univerzalnog adresnog prostora u kojoj je dozvoljeno spajanje bilo koja dva čvora. To bi omogućilo hostovima da šalju i primaju informacije jedan od drugog. Ljudi bi mogli pristupiti svim svojim sustavima s posla i mijenjati postavke grijanja i hlađenja, pa čak i otključavati vrata gostima koji su uranili.Ta verzija univerzalne povezanosti je ugušena nedovoljnim adresnim prostorom i ponajviše iz sigurnosnih razloga. U ranim 90−tima, firme su počele uvoditi vatrozide s primarnom namjenom da smanje mogućnosti povezivanja koje su postojale. Ogromne mreže su ofgrađene od nefiltriranog interneta korištenjem aplikacijskih proxy−a, NAT uređajai paket filtera. Otvoreno kolanje informacija predalo je tron kontroliranim komunikacijskim kanalima i sadržajem koji je njima prolazio. Mrežne barijere poput vatrozida mogu otežati mapiranje mreže, a vremenom neće biti ništa lakše, jer ugušiti lagodno istraživanje mreže je primarni cilj većine uređaja. No ipak, Nmap nudi mnogo mogućnosti kako bi nam pomogao u razumijevanju tih kompleksnih mreža i kako bi provjerio da li filteri uistinu rade onako kako smo zamislili. Čak podržava mehanizme za obilaženje loše implementiranih mjera zaštite. Jedna od najboljeh metoda pomoću koje ćete razumjeti postavke svoje mrežne sigurnosti je pokušaj da je obiđete. Pokušajte se postaviti u mentalni sklop napadača i iskoristite tehnike iz ovog poglavlja protiv svojih mreža. Pokrenite FTP bounce sken, idle sken, napad fragmentacijom ili pokušajte tunelirati kroz svoj proxy server. Uz to što brane mrežnu aktivnost, firme sve više nadgledaju promet sa sustavima za otkrivanje upada (engl. intrusion detection system) IDS. Većina poznatijih IDS sustava dolaze s podešenim pravilima koja mogu prepoznati Nmap skenove, jer ponekad je sken u stvari prethodnik napada. Većina tih sustava je nedavno prerasla u sustave za zaštitu od upada (engl. intrusion prevention system) IPS koji aktivno blokiraju promet koji ocjene kao zloćudan. Na štetu mrežnih administratora i proizvođača IDS sustava, pouzdano ustanoviti što je zloćudno, a što nije samo analizom paketa je teško. Napadači koji imaju strpljenja i sposobnosti obično mogu uz pomoć nekin Nmap−ovih opcija proći nezapaženo od IDS sustava. U međuvremenu admnistratori se moraju boriti s velikom količinom lažnih uzbuna, gdje je normalna mrežna aktivnost pogrešno dijagnosticirana i možda čak blokirana od IPS sustava. Ponekad ljudi predlažu da Nmap ne bi trebao nuditi mogućnosti za obilaženjem vatrozida i provlašenja pored IDS−a. Tvrde da će te mogućnosti biti korištene od strane napadača isto kao i od strane administratora. Problem u ovoj logici je taj što će metode tako i tako biti dostupne napadačima koji će koristiti neki fdrugi alat ili sami doprogramirati funkcionalnost u Nmap, dok bi administratori imali puno teži posao u sprješavanju upada na svoje sustave. Postavljanje samo modernih, zakrpanih FTP servera je mnogo učinkovitija obrana od sprječavanja distribucije alata koji mogu napraviti FTP bounce napad. Ne postoji čarobni metak (ili Nmap opcija) za otkrivanje i potkopavanje vatrozida i IDS sustava. Za to je potrebna vještina i iskustvo. Tutorial je nešto što ne spada u ovaj dokument, koji samo navodi opcije i opisuje što one mogu. −f (fragmentiraj pakete); −−mtu (koristi navedeni MTU) −f opcija prisiljava pokrenuti sken (uključujući i ping sken) da koristi male fragmente IP paketa. Ideja se sastoji od toga da zaglavlje TCP paketa prelomi na više paketa kako bi paket filterima, IDS−ovima i drugim dosadnjakovićima bilo teže otkriti što radite. Budite pažljivi s tim! Neki programi imaju problema u radu s takvim malim paketima. Jedan stari sniffer imenom Sniffit, je automatski pukao kad bi primio prvi fragment. Nakon što navedete ovu opciju jednom, Nmap podijeli pakete u 8 bytova ili manje. Tako će 20 bytno TCP zaglavlje biti podijeljeno u 3 paketa, dva po 8 bytova i jedan od 4. Imajte na umu da svaki od tih paketa koje smo prelomili dobiva novo zaglavlje, koje nema nikakve veze s originalnim. Navedite −f još jednom i Nmap će koristiti 16 bytova po fragmentu (smanjujući broj fragmenata). Isto tako možete definirati bilo koju željenu veličinu korištenjem −−mtu opcije. Ukoliko koristite −−mtu opciju nemojte koristiti i −f opciju. Fragment mora biti višekratnik broja 8. Iako fragmenti neće proći pored paet filtera i vatrozida koji skupljaju se fragmente kako bi vidjeli što je u originalnom paketu, popout opcije CONFIG_IP_ALWAYS_DEFRAG u linux jezgri operativnog sustava, činjenica je da si neke mreže ne mogu dozvoliti udar na performanse koji ta opcija ima, pa je stoga na njima isključena. Drugi pak sustavi ne mogu imati upaljnu tu opciju, jer fragmenti mogu doći u njihovu mrežu drugom rutom. Neki sustavi defragmentiraju izlazne pakete u samoj jezgri, poput linuxa koji ima iptables s upaljenim modulom praćenja konekcije. Pokrenite sken dok je upaljen snifer poput ethereal−a kako bi se osigurali da su odlazni paketi fragmentirani. Ukoliko vaš OS radi probleme (kao što smo naveli malo prije kod linuxa i iptables−a), pokušajte slati sirove eternet frame−ove opcijom −−send−eth. −D   (sakrij sken pomoću mamaca) Ovaj način skeniranja učini to da na hostu koji skenirate izgleda kao da ga skeniraju i sustavi koje ste stavili u mamce. Tako će IDS navesti 5− port skenova s jedne IP adrese i tako za sve mamce koje ste naveli i za vas. Samim tim neće znati tko je stvarno skenirao mrežu, a tko je bio nevina žrtva (mamac). Ovo može biti eliminirano traženjem ruterskog puta (engl. router path tracing), odbacivanja odgovora (engl. response−dropping) i nekim drugim aktivnim mehanizmima, ali je ipak efikasna tehnika za sakrivanj IP adrese. Odvojite svaki host mamac sa zarezimaa možete opcionalno navesti i ME (što predstavlja vašu IP adresu), kako bi bila pozicionirana baš na onom mjestu u skeniranju na kojem je želite. Ako postavite ME na 6. mjesto ili kasnije, neki uobičajeni detektori port skenova (poput alata "scanlogd" firme Solar Designer´s) uopće neće pokazati Vašu IP adresu. Ukoliko ne kkoristite ME opciju, Nmap će staviti vašu IP adresu na proizvoljno mjesto. Imajte na umu da hostovi koje navodite kao mamce moraju biti upaljeni, jer ćete inače slučajno napasti host koji skenirate Syn flood napadom. Isto tako poprilično je lako ustanoviti tko vas skenira ako samo jedan host od navedenih uistinu postoji na mreži. Možete koristiti IP adrese umjesto imena (kako vas mamci ne bi vidjeli u svojim name server logovima). Mamci se koriste u inicijalnom ping skenu (korištenjem ICMP, SYN, ACK ili bilo kojeg drugog načina) kao i za trajanja stvarnog skena portova. Mamci se također koriste i kod udaljenog otkrivanja operativnog sustava (−O). Mamci NE rade s otkrivanjem verzije ili TCP connect() skena. Činjenica je da će korištenje previše mamaca usporiti skeniranje i potencijalno ga učiniti manje točnim. Isto tako, neki ISP−ovi će filtrirati lažirane pakete, ali većina ih ne zabranjuje. −S   (Lažiraj ishodišnu adresu) U nekim situacijama Nmap neće moći ustanoviti vašu ishodišnu IP adresu (Nmap će vam reći ako dođe do toga). U tom slučaju koristite opciju −S s IP adresom mrežnog adaptera preko kojeg želite poslati paket. Još jedna mogućnost korištenja ove opcije je lažirati sken kako bi ciljano računalo mislilo da ga skenira netko drugi. Zamislite firmu koju konstantno skenira konkurencija! −e opcija j eobično potrebna za ovu namjenu i −P0 je također preporučeno. −e   (koristi navedenu mrežnu karticu) Ova opcija kaže Nmap−u koju mrežnu karticu da koristi za slanje i primanje paketa. Nmap bi to trebao otkriti automatski, a sam će vam reći ako to ne uspije. −−source−port  ; −g   (Lažiraj broj ishodišnog porta) Iznenađujuće česta greška je samo vjerovanje prometu koji dolazi s određenog porta. Jednostavno je shvatiti odakle to dolazi. Administrator podesi novi novcati vatrozid i najednom je obasut pritužbama korisnika kako su im aplikacije prestale raditi. Čak štoviše, možda je prestao raditi i DNS, jer UDP DNS odgovori s vanjskih servera više ne mogu ući u mrežu. FTP je još jedan dobar primjer. Kod aktivnih FTP prijenosa, FTP pokuša uspostaviti vezu nazad prema klijentu da bi poslao zatraženu datoteku. Postoje sigurna rješenja tih problema, često u obliku proxy−a na aplikacijskom nivou ili modula na vatrozidu koji parsaju protokol. Nažalost postoje i lakša, manje sigurna rješenja. Vidjevši da DNS odgovori dolaze s porta 53 i aktivni FTP s porta 20, mnogi su administratori pali u zamku jednostavno dozvoljavajući ulazni promet s tih portova. Obično pretpostavljaju da napadači neće uočiti i iskoristiti takve rupe u vatrozidu. U nekim slučajevima administratori smatraju to rješenje kao privremenu zakrpu, dok ne implementiraju bolje rješenje, a onda zaborave na to. U te zamke ne padaju samo preopterećeni mrežni administratori. Mnogo uređaja je isporučeno s takvim nesigurnim pravilima. Čak je i Microsoft bio kriv. IPSec filter koji dolazi s Windows 2000 i s WIndows XP OS−om ima implicitno pravilo koje dozvoljava sav TCP i UDP promet s porta 88 (Kerberos). Još jedan dobro poznati primjer je ZOne Alarm osobni vatrozid, koji je do verzije 2.1.25 dozvoljavao bilo koje dolazne UDP pakete sa ishodišnog porta 53 (DNS) i 67 (DHCP). Nmap nudi opcije −g i −−source−port (iste su) kako bi iskoristili ovakve slabosti. Jednostavno navedite broj porta i Nmap će ga koristiti kao ishodišni port gdje je to moguće. Nmap mora koristiti različite portove kako bi neki testovi otkrivanja OS−a radili ispravno,a DNS zahtjevi ignoriraju opciju −−source−port, jer se kod toga Nmap oslanja na sistemske biblioteke. Većina TCP skenova uključujući i SYN sken podržava ove opcije u potpunosti isto kao i UDP sken. −−data−length   (Dodaj proizvoljne podatke na pakete koje šalješ) U normalnim situacijama Nmap šalje minimalističke pakete koji se sastoje samo od zaglavlja. Tako da su Nmap−ovi TCP paketu u načelu veličine 40 bytova, a ICMP paketi 28 bytova. Ova opcija kaže Nmap−u da doda određenu količinu proizvoljnih bytova u paket koji šalje. Paketi koje koristi otkrivanje OS−a (−O) nisu zahvaćeni ovom opcijom, dok većina ping skenova i portskenova je. To usporava skeniranje, ali ga isto tako čini manje sumnjivim. −−ttl   (Podesi polje IP time−to−live) Podešava polje time−to−live i IPv4 paketima na zadanu vrijednost. −−randomize−hosts (Proizvoljno poredaj hostove koje skeniraš) Ova opcija kaže Nmap−u da pomiješa svaku grupu od 8096 hostova prije nego ih počne skenirati. To može učiniti skeniranje manje očitim za većinu sustava za nadgledanje mreže, pogotovo kad ovu opciju kombinirate sa sporim vremenima kašnjenja (engl. timing options). Ukoliko želite pomiješati veće grupe, povećajte PING_GROUP_SZ u nmap.h biblioteci i ponovno kompajlirajte Nmap. Alternativno rješenje je da kreirate listu ciljanih IP adresa s list skenom (−sL −n −oN naziv datoteke), pomiješate je s perl skriptom i onda dodate tu listu Nmap−u s opcijom −iL. −−spoof−mac   (Lažiraj MAC adresu) Ova opcija zatraži Nmap da koristi navedenu MAC adresu za sve ethernet frame−ove koje pošalje. Ova opcija podrazumijeva −−send−eth opciju kako bi osigurala da Nmap uistinu šalje pakete na nivou etherneta. MAC adresa može imati nekoliko formata. Ukoliko je string “0”, Nmap će sam odabrtati proizvoljnu MAC adresu za trajanje sesije. Ukoliko je zadani string sačinjen od parnog broja hex znamenaka (gdje su parovi opcionalno odvojenih dvotočkom), Nmap će korisiti tu MAC adresu. Ako je upisano manje od 12 znamenaka, Nmap će ostatak nadopuniti s proizvoljnim vrijednostima. Ako nije navedena 0 niti hex string, Nmap pregleda datoteku nmap−mac−prefixes tražeći naziv proivođača koji sadrži navedeni string (case sensitive). Ako se nešto poklopi, Nmap koristi OUI (3 bytni prefix) proizvođača, a ostatak dopuni proizvoljno. Ispravni −−spoof−mac argumenti su npr. Apple, 0, 01:02:03:04:05:06, deadbeefcafe, 0020F2, and Cisco. −−badsum (Šalji pakete s lažnim TCP/UDP checksumom) Ova opcija traži od Nmap−a da koristi neispravne TCP i UDP checksume za pakete koje šalje na ciljano računalo. Kako skoro svaki IP stack odbacuje takve pakete, svaki odgovor koji dobijete najvjerovatnie dolazi od vatrozida ili IDS sustava koji nisu provjeravali checksum. Za više detalja o ovoj tehnici, pogledajte: http://www.phrack.org/phrack/60/p60-0x0c.txt. IZVJEšTAJI Svaki sigurnosni alat je koristan onoliko koliko dobar izvještaj ponudi. Kompleksni testovi i algoritmi su od malo koristi ako njihov rezultat nije predstavljen na organiziran i razumljiv način. Obzirom na različite načine korištenja Nmap−a od strane ljudi i drugih programa, jedan format ne može zadovoljiti sve, tako da Nmap nudi više formata izvještaja, uključujući interaktivni mod koji direktno možete pročitati i XML kako bi ga kasnije mogli pregledavati i analizirati drugi automatizirani alati. Uz to što nudi različite formate izvještaja, Nmap nudi opcije za upravljanje količinom prikazanih informacija, kao i poruke za debugiranje. Izvještaji mogu biti standardni (na ekran op prev.) ili spremljeni u datoteke, u koje Nmap može dodavati podatke ili ih prepisati. Datoteke u koje se spremaju rezultati taskođer mogu biti korištene za prekinute skenove koje ste nastavili. Nmap nam nudi izvještaje u 5 različitih formata. Defaultni se zove interaktivni izvješ taj i poslan je na standardni izlaz (sdtout) (zaslon računala, op. prev.). Također postoji i normalni izvještaj koji je sličan interaktivnom s tim da prikazuje manje informacija i upozorenja, jer je predviđen za kasniju analizu, a ne trenutnu.. XML izvještaj je jedan od najbitnijih, jer ga lako možete konvertirati u HTML, može lako biti pregledavan pomoću programa poput Nmap−ovog grafičkog korisničkog sučelja, te može biti importiran u bazu podataka. Dva preostala tipa izvještaja su jednostavni grepabilni izvještaj koji uključuje većinu informacija o hostu u jednoj liniji i sCRiPt KiDDi3 Izvj3št4j za korisnike koji se smatraju |<−r4d. Dok je interaktivni izvještaj defaultni i nema komandnolinijskih opcija, preostale 4 opcije koriste istu sintaksu. Mogu preuzeti jedan parametar, a to je naziv datoteke u koji će biti pohranjeni rezultati. Možete navesti više različitih formata, ali svaki od njih smijete navesesti samo jednom. Npr. želite gledati normalni izvještaj za sebe, dok istovremeno želite razultate pohraniti i u XML datoteku, za kasniju programsku analizu. To možete postići opcijama −oX myscan.xml −oN myscan.nmap. Iako su u ovom poglavlju korištena imena poput myscan.xml zbog jasnoće, preporučeno je korištenje određenijih i jasnijih imena. Imena koja ćete odabrati ovise o vašim željama i navikama, mada osobno koristim dugačka imena u kojima se nalazi datum skeniranjai nekoliko riječi koje opisuju što je u stvari skenirano, a sve to pohranim u direktorij nazvan imenom tvrtke koju skeniram. Iako navedene opcije spremaju rezultat u datoteke, Nmap i dalje ispisuje interaktivni izvještaj na zaslon računala. Npr. naredba nmap −oX myscan.xml target sprema rezultate skena u XML datoteku imenom myscan.xml i također ispisuje na zaslon računala ono što bi ispisao da opcija −oX nije bila navedena. Ovo možete promijeniti dodajući znak "−" (minus op. prev.) kao parametar jednom od tipova izvještaja, što će prisiliti Nmap da deaktivira interaktivni izvještaj i umjesto njega na stdout pošalje format koji ste naveli. Tako će naredba nmap −oX − target posalti samo XML na stdout. Ozbiljne greške će i dalje biti ispisane na normalni tok grešaka − stderr. Za razliku od nekih Nmap−ovih opcija, razmak između opcije za naziv log datoteke (poput −oX) i naziva datoteke ili znamka minus je obavezan. Ukoliko ga izostavite, npr. napišete −oG− ili −oXscan.xml, Nmap će napraviti datoteke normalnog formata imenom G− i Xscan.xml. Nmap također nudi i opcije za upravljanje količinom prikazanih informacija i opcije da doda podatke u postojeću datoteku , a ne da je prepiše. Sve navedene opcije opisane su u daljnjem tekstu: Formati Nmap−ovih izvještaja −oN   (Normalni izvještaj) Zahtjeva da normalni izvještaj bude spremljen u navedeno ime. Kao što je opisano gore u tekstu, to se malo razlikuje od interactivnog izvještaja. −oX   (XML izvještaj) XML izvještaj će biti pohranjen u navedenu datoteku. Nmap ima i definiciju tipa dokumenta (engl Document Type Definition) kratica: DTD koja dozvoljava XML parserima da provjere Nmap−ov XML izvještaj. Iako je primarno namijenjeno za programsko korištenje, može pomoći i ljudima da interpretiraju Nmap−ov XML izvještaj. DTD definira ispravne elemente formata i često navodi atribute i vrijednosti koje mogu poprimiti. Najsvježija verija je uvijek dostupna na: http://www.insecure.org/nmap/data/nmap.dtd. XML nudi stabilan format koji je lako čitljiv od strane programa. Besplatni XML parseri su dostupni za većinu kompjutorskih jezika, uključujući C/C++, Perl, Python i Java−u. Čak postoje i poveznice za većinu tih jezika koje omogućuju direktno interpretiranje Nmap−ovih izvještaja. Primjeri su: Nmap::Scanner [9] i Nmap::Parser [10] u Perlu i CPAN−u. U većini slučajeva kad neka ozbiljnija aplikacija komunicira s Nmap−om, XML je željeni format. XML izvještaj se poziva na XSL stilove, koji mogu biti korišteni za formatiranje rezultata u HTML. Najjednostavniji način je da jednostavno učitate XML izvještaj u web preglednik poput firefox−a ili IE−a. Defaultno će to raditi samo na računalu nakojem ste pokrenuli nmap (ili na računalu koje je slično konfigurirano), jer je nmap.xsl hardkodiran. Koristite opciju −−webxml ili −−stylesheet kako bi kreirali prenosive XML datoteke koje prikazuju podatke u HTML−u na bilo kojem računalu spojenom na web. −oS   (ScRipT KIdd|3 izvještaj) Script kiddie izvještaj je poput interaktivnog s tim d je naknadno obrađen kako bi bolje odgovarao l33t HaXXorZ koji je prije pazio na Nmap zbog njegovog konstantnog pisanja velikih slova i spelinga. Osobe koje ne razumiju humor (prije nego me počnu napadati), trebale bi shvatiti da ova opcija tu da bi ismijavala script kiddie−je, a ne da bi im “pomagala”. −oG   (Grepabilni izvještaj) Ovaj format zvještaja je obrađen zadnji jer nije previše popularan. XML je mnogo moćniji i odgovara većini iskusnih korisnika. XML je format za koji postoji hrpa izvrsnih parsera, dok je grepabilni izvještaj moj osobni mali hack. XML je proširiv i podržava nove stvari koje budu ugrađene u Nmap, dok je to često ispušteno u grepabilnom izvještaju, jer nema mjesta za njih. No ipak, grepabilni izvještaj je poprilično popularan. To je jednostavni format koji prikazuje svakog hosta na jednoj liniji i može ga se lako pretraživati standardnim UNIX alatima, poput grep−a, awk−a, cut−a, sed−a, diff−a i Perl−a. Čak ga i ja koristim za jednokratne testove iz komandne linije. Pronaći sve hostove koji imaju otvoren ssh port ili se na njima vrti Solaris je vrlo lako pomoću grep naredbe, a to pak može biti poslano awk ili cut naredbi da bi se prikazala željena polja. Grepabilni izvještaj sastoji se od komentara (linija koje počinju s pound znakom (#)) i ciljanih linija. Ciljana linija sadrži kombinaciju od 6 imenovanih polja, odvojenih tabovima i iza njih dolazi dvotočka. Polja su: Host, Ports, Protocols, Ignored State, OS, Seq Index, IPID, and Status. Najvažnije od tih polja je obično Ports, koje daje datalje o svakom zanimljivom portu. To je zarezom odvojena lista portova. Svaki zapis o portu predstavlja jedan zanimljivi port i ima oblik sedam podpolja odvojenih slash znakom (/). Podpolja su: Port number, State, Protocol, Owner, Service, SunRPC info, and Version info. Kao i kod XML formata, više informacija možete naći na sljedećem linku: http://www.unspecific.com/nmap-oG-output. −oA   (Izvještaj u svim formatima) Radi jednostavnosti, možete navesti opciju −oA basename, kako bi spremili rezultate u normalnom, XML i grepabilnom formatu odjednom. spremljeni su u datoteke imanom basename.nmap, basename.xml i basename.gnmap. Kao i kod većine programa možete staviti prefiks ispred naziva datoteke kako bi je spremili u željeni direktorij, kao npr. ~/nmaplogs/foocorp/ na UNIX−u ili c:\hacking\sco na Windows platformi. Opcije za prikaz količine informacija i debugiranje −v (povećaj količinu prikazanih informacija) Povećava nivo količine prikazanih informacija, te Nmap prikazuje više informacija o tekućem sken procesu. Otvoreni portovi su prikazani odmah čim su otkrivani i Nmap prikazuje procjenu koliko vremena mu treba za završetak posla ako procijeni da će sken trajati više od nekoliko minuta. Ukoliko želite još više informacija, upišite ga dvaput. Korištenje −v opcije više od dva puta nema nikakav učinak. Većina promjena koje se dobiju korištenjem ove opcije utječu na normalni i script kiddie izvještaj. Ostali izvještaji su namijenjeni za automatiziranu obradu, pa Nmap u njima može navesti dodatne informacije bez suvišnog opterećivanja korisnika. Ipak, postoji nekoliko promjena u ostalim modovima gdje veličinu izvještaja možete osjetno smanjiti ne navodeći neke detalje. Npr. komentirana linija u gerepabilnom formatu, koja daje listu svih skeniranih portova isprintana je samo u verose modu, jer može biti poprilično velika. −d [level] (povećaj ili podesi nivo debugiranja) Čak i kad verbose mod ne daje dovoljno informacija, debuging Vam stoji na raspolaganju, kako bi vas preplavio s još više podataka! Kao i kod opcje verbose (−v), uključujete ga s opcijom (−d), a sam nivo debugiranja možete povećati navođenjem opcije više puta. Čak možete navesti nivo debugiranja i navođenjem brojke nakon opcije (−d). Npr. (−d9) podešava nivo debugiranja 9. To je najviši mogući nivo i kao rezultat će dazi tisuće linija osim ako ste pokrenuli jako jednostavan sken s par ciljeva i portova. Debuging izvještaj je koristan kad sumnjate da u Nmap−u postoji greška ili ako ste jednostavno zbunjeni oko toga što Nmap radi i zašto. Kako je ova opcija najviše namjenjena developerima, debug linije nisu uvijek samoobjaš njavajuće. Možete dobiti nešto poput: Timeout vals: Timeout vals: srtt: −1 rttvar: −1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar: 14987 to: 100000. Ukoliko ne razumijete liniju, jedini smjer kojim možete nastaviti je da je ignorirate, potražite u izvornom kodu programa ili zatražite pomoć na razvojnoj listi (nmap−dev). Neke linije su samoobjašnjavajuće, ali poruke postaju sve čudnije što je nivo debugiranja veći. −−packet−trace (Prati pakete i podatke koji su poslani/primljeni) Nmap ispiše informaciju o svakom poslanom i primljenom paketu. Ovo se najčešće koristi za debugiranje, ali je isto tako dobar način za nove korisnike da saznaju što Nmap radi ispod haube. Kako bi izbjegli ispisivanje tisuća linija, odaberite ograničeni broj portova koje skenirate, npr. Ako Vas pak zanima samo što radi podsustav otkrivanja verzije, radije koristite opciju −−version−trace. −−iflist (Izlista mrežne adaptere i rute) Ispiše popis mrežnih adaptera i ruta kako ih vidi Nmap. To je korisno u debugiranju problema s rutanjem ili krivog prepoznavanja uređaja (kao kad recimo Nmap tretira PPP konekciju kao ethernet). Ostale opcije izvještaja −−append−output (Dodaj rezultate u postojeći file umjesto da ih prepišeš) Kad navedete naziv datoteke nakon opcija poput −oX ili −oN, datoteka istog imena je prepisan aako postoji. Ukoliko želite zadržati sadržaj postojeće datoteke i u njega dodati nove rezultate, navedite −−append−output opciju. Svie navedene datoteke u tom pokretanju Nmap−a će biti sačuvane i u njoh će biti dodani novi podaci. To ne radi dobro s XML datotekama (−oX), jer tako dobivena datoteka neće biti ispravna dok je ručno ne prepravite. −−resume   (Nastavi prekinut sken) Neka temeljita Nmap skeniranja mogu potrajati i danima. Takvi skenovi ne uspiju uvijek odraditi posao do kraja. Zabrane mogu spriječiti Nmap da radi tijekom radnih sati, mreža može pasti, računalo na kojem je pokrenut Nmap može biti resetirano (planski ili neplanski) ili se čak sam Nmap može srušiti. Čak i osoba koja je pokrenula Nmap sken može biti ta koja će ga prekinuti korištenjem tipaka ctrl−C. Ponovno pokretanje cijelog skena nije isplativo. Na sreću, ukoliko ste spremali normalne (−oN) ili grepabilne (−oG) logove, možete zatraž iti Nmap da nastavi skeniranje tamo gdje je stalo. Jednostavno navedite opciju −−resume i proslijedite naziv datoteke normalnom ili grepabilnom načinu skeniranja. Nisu dozvoljeni nikakvi drugi argumenti, jer će Nmap pretražiti postojeću datoteku i koristiti iste opcije koje je koristio i prije. jednostavno pozovite Nmap: nmap −−resumelogfilename. Nmap će dodati nove rezultate u postojeću datoteku. Nastavljanje ne podržava XML izvještaje, jer bi spajanje dvije datoteke u jednu ispravnu bilo prekomplicirano. −−stylesheet   (Podesi XSL stil za transformiranje XML izvještaja) Nmap dolazi s XSL stilom nazvanim nmap.xsl koji je namijenjen za gledanje ili prevođenje XML izvještaja u HTML. XML izvještaj sadrži xml−stylesheet naredbu koja pokazuje na nmap.xml datoteku gdje je inicijalno instalitrana od Nmap−a (ili u trenutni direktorij u kojem je pokrenut Nmap kad je u pitanju Windows OS). Jednostavno otvorite Nmap−ov XML izvještaj u neki noviji web preglednik i on bi trebao dohvatiti nmap.xsl i iskoristiti ga za prikaz rezultata. Ukoliko ž elite koristiti neki drugi stil, navedite ga kao argument opciji −−stylesheet. Morate navesti kompletnu putanju do njega ili URL. Npr. −−stylesheet −−stylesheet http://www.insecure.org/nmap/data/nmap.xsl. Ova naredba kaže pregledniku da učita zadnju verziju stila s isecure.org. Opcija −−webxml čini isto to bez potrebe pretjeranog pisanja i pamćenja linka. Učitavanje XSL stila sa stranica insecure.org omogućava gledanje rezultata na jednostavniji način čak i računalima koja nemaju instaliran Nmap (a samim tim i nmap.xsl). Tako da je URL najčešće i korisniji, no, nmap.xsl−a koji se nalazi na datotečnom sustavu koristi se ukoliko želite imati više privatnosti. −−webxml (Učitaj stil sa stranice Insecure.Org) Ovo je jednostavno kratica za −−stylesheet http://www.insecure.org/nmap/data/nmap.xsl . −−no_stylesheet (Izbaci deklaraciju stila iz XML−a) Ukoliko ne želite da Nmap poveže XSL stil s XML−om, odaberite ovu opciju. U tom slučaju se ne koristi naredba xml−stylesheet RAZNE OPCIJE Ovo poglavlje opisuje neke važne (i neke ne toliko važne) opcije koje jednostavno ne spadaju nigdje drugdje. −6 (Uključi skeniranje IPv6 protokola) Od 2002. godine, Nmap nudi i podršku za IPv6 svojih najpopularnijih svojstava. Točnije, ping scan ( samo TCP), connect() scan i otkrivanje verzije podržavaju IPv6. Sintaksa je jednaka osim što dodate opciju −6. Naravno, morate koristiti IPv6 sintaksu IP adrese ako navedete IP Adresu,a ne naziv hosta. Adresa može izgledati kao 3ffe:7501:4819:2000:210:f3ff:fe03:14d0, pa je stoga preporučeno korištenje host imena. Izvještaj izgleda isto osim što je na liniji “ zanimljivih portova” IPv6 IP adresa. Iako IPv6 nije pregazila svijet ipak se poprilično koristi u nekim zemljama (osobito Azijskim), a i većina modernih OS−ova ima ugrađenu podršku. Da bi mogli koristiti Nmap s IPv6 protokolom i ciljano računalo i vaše računalo moraju biti podešeni za korištenje IPv6. Ukoliko vaš ISP (poput većine drugih) ne dodjeljuje IPv6 IP adrese, postoje oni koji nude besplatno IPv6 tuneliranje, što poprilično dobro radi s Nmap−om. Jedan od boljih davatelja takvih usluga je BT Exact https://tb.ipv6.btexact.com/. Također sam koristio i usluge tvrtke Hurricane Electric http://ipv6tb.he.net/. 6to4 tuneli su još jedan popularan besplatan pristup. −A (opcija agresivnog skeniranja) OVa opcija omogućuje dodatne napredne i agresivne opcije. Još uvijek nisam u potpunosti odlučio na š to će se sve odnositi. Trenutno ova opcija omogućuje OS detekciju (−O) i skeniranje verzije (−sV). U budućnosti mogu biti dodane nove mogućnosti. Poanta je u tome da se ljudima omogući pristojan set scan opcija bez potrebe za pamćenjem velikog broja zastavica (engl. flag). Ova opcija samo uključuje navedene stvari bez podešavanja vremena odaziva (engl. timing) (poput −T4) ili verbose opcija (−v) kojU najvjerovatnije također želite navesti. −−datadir   (Navedi korisnički definiranu lokaciju Nmap−ovih datoteka) Nmap dohvaća neke podatke tijekom izvršavanja programa iz datoteka: nmap−service−probes, nmap−services, nmap−protocols, nmap−rpc, nmap−mac−prefixes, and nmap−os−fingerprints. Najprije ih traži u direktoriju navedenom u −−datadir opciji (ako postoji). Sve datoteke koje se ne nalaze u navedenom direktoriju potražit će u direktoriju navedenom u NMAPDIR varijabli. Nakon toga je na redu ~/.nmap za stvarne i efektivne UID−e (samo kod POSIX sustava) ili lokacija Nmap izvršne datoteke (samo kod Win32 sustava), te na kraju u kompajliranoj lokaciji poput /usr/local/share/nmap ili /usr/share/nmap. Kao posljednju đansu, Nmap će potražiti u tekućem direktoriju. −−send−eth (koristi sirove (raw) pakete za slanje preko etherneta) Zatraži Nmap da šalje pakete na sirovom (raw) ethernet (data link) sloju umjesto na višem IP (mrež nom) sloju. Defaultno, Nmap odabire koja je opcija bolja za platformu na kojoj je pokrenut. Sirove utičnice (engl. raw sockets) (IP sloj) su obično najefikasnije na UNIX mašinama, dok su ethernet frame−ovi obavezni na Windows OS−u (IP sloj), jer je Microsoft izbacio podršku za sirove utičnice. Nmap ipak koristi sirove IP pakete na UNIX−u, bez obzira na ovu opciju, ako nema drugog izbora (recimo kad ste na mreži koja nije ethernet). −−send−ip (Šalji na sirovom (raw) IP sloju) Zatraži Nmap da šalje pakete preko sirovih IP utičnica umjesto preko nižih ethernet okvira ( engl.frame). To je dodatak opciji −−send−eth objašnjenoj malo prije. −−privileged (Pretpostavka da je korisnik u potpunosti privilegiran (op. prev. administrator sustava)) Kaže Nmap−u da jednostavno pretpostavi kako je dovoljno privilegiran da može koristiti sirove utičnice (engl. raw sockets), snifati pakete i slične radnje koje na UNIX sustavima zahtjevaju root prava. Defaultno, Nmap prekida rad, ako su takve radnje zatražene od njega, ali getuid() nije nula (op. prev. korisnik nema ta prava). −−privileged opcija je korisna na onim sustavima koji omogućuju neprivilegiranim korisnicima korištenje sirovih paketa (poput Linux kernela isl.). Obavezno navedite ovu opciju prije bilo koje druge koja zahtijeva privilegije (poput SYN scan−a, OS detekcije isl.). Alternativa ovoj opciji je NMAP_PRIVILEGED varijabla. −−interactive (Startaj u interaktivnom modu) Starta Nmap u interaktivnom modu, što omogućava lako pokretanje više skenova (sinhrono ili u pozadini). Ovo je korisno za korisnike koji skeniraju s multikorisničkih sustava, jer često žele testirati sigurnost, bez da dozvole svima ostalima koji su ulogirani na sustav da vide što i koga oni skeniraju. Koristite −−interactive opciju kako bi aktivirali ovaj mod, te nakon toga pritisnite h za pomoć. Ovo se rijetko koristi, jer su shell−ovi obično poznatiji i imaju dovoljno mogućnosti. Ova opcija uključuje bang (!) operator za izvršavanje shell naredbi, što je jedan od glavnih razloga zašto ne bi trebalo instalirati Nmap sa setuid = root (op. prev. Ako instalirate Nmap sa setuid=root, svatko tko ga pokrene, moći će napraviti na sustavu što god hoće, jer može iz Nmap−a pokrenuti bilo koju naredbu s root pravima). −−noninteractive (Za pokretanje Nmap−a iz nekog drugog programa) Ovu opciju možete navesti kad je Nmap pokrenut od strane neke druge aplikacije. Trenutno je jedina razlika u tome što je Runtime interaction (opisano u poglavlju nazvanom the section called “INTERAKCIJA ZA VRIJEME IZVRšAVANJA”) isključeno. Bez obzira na zbunjujuće slično ime, ova opcija nije jednostavna suprotnost −−interactive opciji. −V; −−version (Ispiši broj verzije) Ispiše broj verzije Nmap−a i prekine izvršavanje programa −h; −−help (Ispiši sumarnu help stranicu) Ispiše kratki help ekran s najčešće korištenim mokandama i zastavicama. Pokretanje Nmap−a bez ijednog argumenta napravi isto to. INTERAKCIJA ZA VRIJEME IZVRšAVANJA Note Ova opcija je za sad nedostupna na Windows OS−u Tijekom izvršavanja Nmap−a sve tipke koje pritisnete su uhvaćene. To omogućvava interakciju s programom bez da ga zaustavljate u radu. Određene specijalne tipke će mijenjati opcije, dok će druge ispisati statusne poruke koje vas obavještavaju o tekućem skenu. Konvencija je takva da mala slova povećavaju količinu ispisa, dok velika slova smanjuju količinu ispisa. Ova funkcionalnost može biti isključena navođenjem −−noninteractive opcije. v / V Povećaj / smanji količinu prikazanih informacija d / D povećaj / smanji nivo debugiranja p / P Uključi / isključi praćenje paketa Bilo što drugo Ispiše statusnu poruku poput sljedeće: Stats: 0:00:08 elapsed; 111 hosts completed (5 up), 5 undergoing Service Scan Service scan Timing: About 28.00% done; ETC: 16:18 (0:00:15 remaining) PRIMJERI Ovdje su neki primjeri korištenja Nmap−a i to od jednostavnih i rutinskih do malo manje kompleksnih i ezoteričnih. Korištene su neke stvarne IP adrese i domene kako bi stvar bila malo konkretnija. Umjesto njih trebali bi staviti adrese/domene iz svoje mreže.. Iako osobno ne smatram da je skeniranje tuđih mreža iligelano i da bi trebalo biti, neki mrežni administratori ne vole nedozvoljeno skeniranje njihovih mreža i mogli bi se žaliti. Dobiti dozvolu prije samog čina je u svakom slučaju ispravan postupak. Za testiranje imate dozvolu skenirati host scanme.nmap.org. Dozvola vrijedi samo za skeniranje korištenjem Nmap−a i ne vrijedi za testiranje exploita i DOS (denial of Service) napada. Kako ne bi preopteretili mrežu, molim Vas da ne skenirate više od 12−tak portova dnevno. Ukoliko će ovaj host biti napadan na bilo koji način, uklonit ću ga s NET−a i Nmap će javiti grešku Failed to resolve given hostname/IP: scanme.nmap.org. Ova dozvola vrijedi i za hostove scanme2.nmap.org, scanme3.nmap.org itd., iako navedeni hostovi za sad ne postoje. nmap −v scanme.nmap.org Ova naredba skenira sve rezervirane TCP portove na računalu scanme.nmap.org. Opcija −v uključuje verbose mod.. nmap −sS −O scanme.nmap.org/24 Pokreće skriveni (engl. stealth) SYN scan prema svakom računalu koje je upaljeno od njih 255 mogućih na mreži “class C” na kojoj se nalazi scanme host. Također pokuša ustanoviti koji OS je pokrenut na svakom od otkrivnih (upaljenih) hostova. Ovo zahtijeva root prava zbog SYN scan−a i OS detekcije. Pokreće enumeraciju hostova i TCP scan na prvoj polovici svakog od 255 mogućih 8 bitnih subneta u mrežnog ID−a 192.168 klase B adresnog prostora. Scan provjerava da li je na ciljanim računalima pokrenut sshd, DNS, pop3d, imapd i/ili port 4564. Za svaki od navedenih portova koji su otvoreni, pokrenuto je i otkrivanje verzije, kak obi se ustanovilo koja aplikacija je otvorila taj port. nmap −v −iR 100000 −P0 −p 80 Ova naredba zatraži Nmap da nasumično odabere 100 000 hostova i skenira ih u potrazi za web serverom (port 80). Enumeracija hostova je isključena opcijom −P0, jer slanje nekoliko sondi kako bi se ustanovilo da li je host upaljen ili ne kad se skenira samo jedan port je ionako nepotrebno. nmap −P0 −p80 −oX logs/pb−port80scan.xml −oG logs/pb−port80scan.gnmap 216.163.128.20/20 Skenira 4096 IP adresa za web serverom (bez prethodnog pinganja) i sprema izvještaj u grepabilnom iXML formatu. GREšKE Poput svog autora niti Nmap nije savršen, no Vi možete pomoći slanjem prijava o greškama, pa čak i pišući patcheve. Ukoliko se Nmap ne ponaša onako kako očekujete od njega, najprije ga nadogradite na najnoviju verziju dostupnu na http://www.insecure.org/nmap/. Ukoliko je problem i dalje tu, istražite da li je već otkriven i prijavljen. Pokušajte "zaguglati" poruku o grešci ili otiđite na Nmap−dev arhive na http://seclists.org/. Također pročitajte i kompletan manual. Ukoliko ništa od toga ne pomogne, pošaljite izvještaj o grešci na nmap−dev@insecure.org. Molim Vas napišite sve što ste do tad otkrili o problemu, te koju verziju Nmap− imate i koju verziju OS−a imate. Izvještaji o prijavljenim problemima i upiti o korištenju Nmap−a koji su poslani na nmap−dev@insecure.org imaju više šansi da budu odgovoreni nego oni poslani direktno Fyodor−u. Patchevi za otklanjanje bugova su još i bolji od samih prijava. Osnovne upute za kreiranje patch datoteka s promjenama su dostupne na http://www.insecure.org/nmap/data/HACKING. Patchevi mogu biti poslani na nmap−dev (što je preporučeno) ili direktno Fyodoru. AUTHOR Fyodor fyodor@insecure.org (http://www.insecure.org) Stotine ljudi su doprinjeli u stvaranju Nmap−a tijekom godina. To je navedeno u CHANGELOG datoteci koja je distribuirana s Nmap−om, a dostupna je i na sljedećem linku: http://www.insecure.org/nmap/changelog.html. PRAVNE SMJERNICE Nmap Copyright i licenciranje Nmap sigurnosni skener je (C) 1996−2005 Insecure.Com LLC. Nmap je također reigistered trademark Insecure.Com LLC. Program je besplatan;možete ga redistribuirati a/ili modificirati pod uvjetima GNU General Public License kako je objavljeno od strane Free Software Fondacije;Verzija 2. To vam garantira pravo korištenja, modificiranja i redistribuiranja ovog softvera pod određenim uvjetima. Ukoliko želite inkorporirati Nmap tehnologiju u svoj softver, možda ćemo vam prodati dodatne licence (kontaktirajte sales@insecure.com). Mnogi proizvođači sigurnosnih skenera već imaju licencu Nmap tehnologije poput otkrivanja hostova, skeniranja portova, OS detekcije i otkrivanja servisa/verzije. Imajte na umu da GPL postavlja važna ograničenja na “derivirana djela”, ali ne daje detaljne definicije istih. Kako bi se izbjegli nesporazumi, za potrebe ove licence, mi smatramo da aplikacija sadrži “ derivirano djelo”, ako čini bilo što od navedenog: • Uključuje izvorni kod iz Nmap−a • Čita ili sadrži Nmap datoteke koje imaju copyright, poput nmap−os−fingerprints ili nmap−service−probes. • Pokreće Nmap i čita njegove rezultate (za razliku od tipičnih shell ili izvršnih meni aplikacija, koje jednostavno ispišu sirovi Nmap izvještaj i time nisu derivirana djela). • Integrira/sadrži/agregira Nmap u neki izvršni instaler, poput onog napravljenog od strane InstallShield−a. • Linka na biblioteku (dll, op. prev.) ili izvršu datoteku koja radi bilo što od gore navedenog. Naziv “Nmap” je također uključen u to. Ova lista nije eksluzivna, ali je navedena kako bi pojasnila našu interpretaciju deriviranih djela s najčešćim primjerima. Zabrane se primjenjuju samo u slučaju da uistinu redistribuirate i Nmap. Npr. mišta vas ne sprječava da napišete i prodate front−end za Nmap. Distribuirajte front end i usmjerite ljude na http://www.insecure.org/nmap/ kako bi preuzeli Nmap. Ne smatramo da su to dodatne zabrane povrh GPL−a, nego samo pojašnjenja toga kako mi interpretiramo “ derivirano djelo” jer se primjenjuje na naš produkt pod GPL licencom. To je slično načinu na koji je Linus Torvalds objavio svoju interpretaciju “deriviranog djela” i kako se to odnosi na module linux kernela. Naša interpretacija se odnosi samo na Nmap − ne govorimo o nijednom drugom produktu licenciranom po GPL−u. Ukoliko imate bilo kakvo pitanje o GPL licenciranju i restrikcijama kod korištenja Nmap−a u ne GPL djelima, rado ćemo Vam pomoći. Kao što je gore navedeno, također nudimo i alternativne licence za integriranje Nmapa u neke druge aplikacije i uređaje. Takvi ugovori su prodani mnogim sigurnosnim izdavačima i generalno sadrže stalnu licencu kao i uslugu prioritetne podrške, a uz to financijski pomažu kontinuirani razvoj Nmap tehnologije. Molimo Vas da poš aljete mail na sales@insecure.com za daljne informacije. Kao posebno izuzeće od GPL uvjeta, Insecure.Com LLC daje dozvolu za povezivanje koda ovog programa s bilo kojom verzijom OpenSSL biblioteke koja je distribuirana pod sličnom licencom kao i s licencom koja se nalazi u datoteci Copying.OpenSSL i distribuirati povezanu kombinaciju oba programa. Morate poštivati GNU GPL na svim područjima za bilo koji kod koji nije OpenSSL. Ukoliko modificirate navedenu datoteku možete proširiti to izuzeće i na svoju verziju programa, ali niste obavezni to napraviti. Ukoliko dobijete navedene datoteke s pismenom licencom ili ugovorom koji navodi drukčije uvjete od navedenih gore, onda je ta alternativna licenca jača i preuzima primat. Creative Commons licenca za ove upute Nmap referentne upute su (C) 2005 Insecure.Com LLC. Time su stavljene pod verziju 2.5 Creative Commons Attribution License [3] . To Vam omogućuje da redistribuirate, modificirate tekst po želji, dok god navodite druge izvore koji su radili na njemu. Osim toga, možete tretirati ovaj dokument kao da spada pod istu licencu kao i Nmap (obajšnjeno prije). Dostupnost izvornog koda i doprinos zajednici (engl. comunity) Izvorni kod je dostupan s programom zato jer vjerujemo da korisnik ima pravo znati što uistinu program radi prije nego će ga pokrenuti. To Vam isto tako omogućava provjeru softvera na sigurnosne rupe (do sad nije pronađena niti jedna). Izvorni Vam kod isto tako omogućava prijenos Nmap−a na nove platforme, popravljanje grešaka i dodavanje novih mogućnosti. Potaknuti ste da promjene pošaljete na fyodor@insecure.org kako bi eventualno bile inkorporirane u buduće verzije glavne distribucije. Slanjem promjena Fyodoru ili nekom na Insecure.Org mailing listi developera, podrazumijeva se da Fyodoru i Insecure.Org−u dajete puna prava na korištenje, modificiranje i relicenciranje koda. Nmap će uvijek biti dostupan kao open source, ali to je bitno jer je nemogućnost relicenciranja koda stvorila ogromne probleme nekim drugim besplatnim softverskim projektima (poput KDE−a i NASM−a). Također povremeno relicenciramo kod drugim tvrtkama kako je navedeno gore. Ukoliko želite definirati posebne licenčne uvjete za svoj doprinos, navedite to odmah kad ih pošaljete. Nema garancije Program je distribuiran u nadi da će bit koristan, ali BEZ IKAKVE GARANCIJE; čak i bez pretopstavljene garancije na PRIHVATLJIVU KVALITETU ili SPOSOBNOST ZA ODREĐENE ZADAĆE. Pogledajte GNU General Public License za više detalja na http://www.gnu.org/copyleft/gpl.html ili u COPYING datoteci uključenoj s Nmap distribucijom. Treba uzeti u obzir da je Nmap povremeno srušio loše napisane aplikacije, TCP/IP stackove, pa čak i operativne sustave. Iako je to ekstremno rijetko, važno je za znati. Nmap nikad ne bi trebalo pokrenuti na kritičnim sustavima osim ako ste spremni prihvatiti da sustav neko vrijeme ne radi. Ovdje potvrđujemo da Nmap može srušiti vaš sustav ili mrežu i ograđujemo se od bilo kakve odgovornosti za bilo kakvu štetu ili problem prouzročen od Nmap−a. Neispravno korištenje Zbog male mogućnosti pada sustava i zbog toga što neki crno šeširaši vole koristiti Nmap za prikupljanje informacija, postoje administratori koji se uznemire i mogu se žaliti kad primjete da im je mreža skenirana. Stoga je uvijek preporučeno zatražiti dozvolu prije nego započnete i lagani scan mreže. Nmap nikad ne bi trebao biti instaliran sa specijalnim privilegijama (npr. suid root) iz sigurnosnih razloga. Softver drugih tvrtki Ovaj produkt sadrži softver razvijen od Apache Software Fondacije [11] . Modificirana verzija Libpcap prijenosne paket capture biblioteke [12] je distribuirana zajedno s Nmap−om. Windows verzija Nmap−a koristi obradu libpcap−a − WinPcap [13] . Podrška za regularne izraze je dana od PCRE biblioteke [14] koja je open source softver. Napisao ga je Philip Hazel. Neke funkcije sirovog netvorkinga koriste Libdnet [15] mrežnu biblioteku koju je napisao Dug Song. Modificirana verzija je distribuirana s Nmap−om. Nmap se opcionalno može povezati s OpenSSL kriptografskim alatima [16] za podršku detekcije SSL verzije. Sav gore navedeni softver se slobodno redistribuira pod softverskom licencom po BSD−u. Klasifikacija kontrole izvoza u US−u. Klasifikacija kontrole izvoza u US−u: Insecure.Com LLC vjeruje da Nmap spada pod US ECCN (export control clasification number − klasifikacijski broj kontrole izvoza) 5D992. Ta se kategorija zove “Softver informacijske sigurnosti koji nije kontroliran ECCN−om 5D002”. Jedina zabrana te klasifikacije je AT (anti terorizam), koja se primjenjuje na gotovo svu robu i zabranjuje izvoz hrpi lažljivih zemalja, poput Iran−a i Sjeverne Koreje (op. prev. iliti onih s kojima Ameri nisu dobri). Tako da Nmap ne zahtijeva nikakvu posebnu licencu, dozvolu ili bilo kakvu drugu autorizaciju američke vlade. NOTES http://www.insecure.org/nmap/man/ http://creativecommons.org/licenses/by/2.5/ http://www.rfc-editor.org/rfc/rfc1122.txt http://www.rfc-editor.org/rfc/rfc792.txt http://www.rfc-editor.org/rfc/ rfc768.txt http://www.rfc-editor.org/rfc/rfc793.txt http://www.rfc-editor.org/rfc/rfc959.txt http://sourceforge.net/projects/nmap-scanner/ http://www.nmapparser.com http://www.apache.org http://www.tcpdump.org http://www.winpcap.org http://www.pcre.org http://libdnet.sourceforge.net http://www.openssl.org