{"id":656,"date":"2022-01-17T16:52:00","date_gmt":"2022-01-17T15:52:00","guid":{"rendered":"http:\/\/vroamam.com\/wordpress\/?p=656"},"modified":"2024-04-07T14:43:24","modified_gmt":"2024-04-07T13:43:24","slug":"nmap-part-2","status":"publish","type":"post","link":"https:\/\/vroamam.com\/wordpress\/blog\/nmap-part-2\/","title":{"rendered":"Nmap &#8211; Getting Help"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Getting Help<\/h2>\n\n\n\n<p>The first thing that I must urge you to do is become self sufficient. <\/p>\n\n\n\n<p>There is a <a rel=\"noreferrer noopener\" href=\"https:\/\/www.amazon.co.uk\/Nmap-Network-Scanning-Official-Discovery\/dp\/0979958717\/ref=sr_1_1?crid=1ZFSNP11LYPNP&amp;keywords=nmap&amp;qid=1671647612&amp;sprefix=nmap%2Caps%2C120&amp;sr=8-1\" target=\"_blank\">printed manual<\/a> available for purchase from Amazon, but it is now over two decades old and quite out of date. It is useful if you want to understand principles, but many of the switches and commands have changed over the years. I fell foul of this when I started.<\/p>\n\n\n\n<p>There is an online manual at <a href=\"https:\/\/nmap.org\/book\/man.html\">https:\/\/nmap.org\/book\/man.html<\/a> but don&#8217;t rely on that being available. One day you may find yourself onsite somewhere with internet access that is very restricted, or even without access at all. What would you do then? <\/p>\n\n\n\n<p>Use and become comfortable with the two inbuilt help systems. This will stand you in good stead not just with Nmap but with most Linux based command line tools.<\/p>\n\n\n\n<p>You can get a list and description of common switches by just typing Nmap at the command line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@kali:~# nmap\n\nNmap 7.80 ( &lt;https:\/\/nmap.org&gt; )\nUsage: nmap &#91;Scan Type(s)] &#91;Options] {target specification}\nTARGET SPECIFICATION:\n  Can pass hostnames, IP addresses, networks, etc.\n  Ex: scanme.nmap.org, microsoft.com\/24, 192.168.0.1; 10.0.0-255.1-254\n  -iL &lt;inputfilename&gt;: Input from list of hosts\/networks\n  -iR &lt;num hosts&gt;: Choose random targets\n  --exclude &lt;host1&#91;,host2]&#91;,host3],...&gt;: Exclude hosts\/networks\n  --excludefile &lt;exclude_file&gt;: Exclude list from file\nHOST DISCOVERY:\n  -sL: List Scan - simply list targets to scan\n  -sn: Ping Scan - disable port scan\n  -Pn: Treat all hosts as online -- skip host discovery\n  -PS\/PA\/PU\/PY&#91;portlist]: TCP SYN\/ACK, UDP or SCTP discovery to given ports\n  -PE\/PP\/PM: ICMP echo, timestamp, and netmask request discovery probes\n  -PO&#91;protocol list]: IP Protocol Ping\n  -n\/-R: Never do DNS resolution\/Always resolve &#91;default: sometimes]\n  --dns-servers &lt;serv1&#91;,serv2],...&gt;: Specify custom DNS servers\n  --system-dns: Use OS's DNS resolver\n  --traceroute: Trace hop path to each host\nSCAN TECHNIQUES:\n  -sS\/sT\/sA\/sW\/sM: TCP SYN\/Connect()\/ACK\/Window\/Maimon scans\n  -sU: UDP Scan\n  -sN\/sF\/sX: TCP Null, FIN, and Xmas scans\n  --scanflags &lt;flags&gt;: Customize TCP scan flags\n  -sI &lt;zombie host&#91;:probeport]&gt;: Idle scan\n  -sY\/sZ: SCTP INIT\/COOKIE-ECHO scans\n  -sO: IP protocol scan\n  -b &lt;FTP relay host&gt;: FTP bounce scan\nPORT SPECIFICATION AND SCAN ORDER:\n  -p &lt;port ranges&gt;: Only scan specified ports\n    Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9\n  --exclude-ports &lt;port ranges&gt;: Exclude the specified ports from scanning\n  -F: Fast mode - Scan fewer ports than the default scan\n  -r: Scan ports consecutively - don't randomize\n  --top-ports &lt;number&gt;: Scan &lt;number&gt; most common ports\n  --port-ratio &lt;ratio&gt;: Scan ports more common than &lt;ratio&gt;\nSERVICE\/VERSION DETECTION:\n  -sV: Probe open ports to determine service\/version info\n  --version-intensity &lt;level&gt;: Set from 0 (light) to 9 (try all probes)\n  --version-light: Limit to most likely probes (intensity 2)\n  --version-all: Try every single probe (intensity 9)\n  --version-trace: Show detailed version scan activity (for debugging)\nSCRIPT SCAN:\n  -sC: equivalent to --script=default\n  --script=&lt;Lua scripts&gt;: &lt;Lua scripts&gt; is a comma separated list of\n           directories, script-files or script-categories\n  --script-args=&lt;n1=v1,&#91;n2=v2,...]&gt;: provide arguments to scripts\n  --script-args-file=filename: provide NSE script args in a file\n  --script-trace: Show all data sent and received\n  --script-updatedb: Update the script database.\n  --script-help=&lt;Lua scripts&gt;: Show help about scripts.\n           &lt;Lua scripts&gt; is a comma-separated list of script-files or\n           script-categories.\nOS DETECTION:\n  -O: Enable OS detection\n  --osscan-limit: Limit OS detection to promising targets\n  --osscan-guess: Guess OS more aggressively\nTIMING AND PERFORMANCE:\n  Options which take &lt;time&gt; are in seconds, or append 'ms' (milliseconds),\n  's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).\n  -T&lt;0-5&gt;: Set timing template (higher is faster)\n  --min-hostgroup\/max-hostgroup &lt;size&gt;: Parallel host scan group sizes\n  --min-parallelism\/max-parallelism &lt;numprobes&gt;: Probe parallelization\n  --min-rtt-timeout\/max-rtt-timeout\/initial-rtt-timeout &lt;time&gt;: Specifies\n      probe round trip time.\n  --max-retries &lt;tries&gt;: Caps number of port scan probe retransmissions.\n  --host-timeout &lt;time&gt;: Give up on target after this long\n  --scan-delay\/--max-scan-delay &lt;time&gt;: Adjust delay between probes\n  --min-rate &lt;number&gt;: Send packets no slower than &lt;number&gt; per second\n  --max-rate &lt;number&gt;: Send packets no faster than &lt;number&gt; per second\nFIREWALL\/IDS EVASION AND SPOOFING:\n  -f; --mtu &lt;val&gt;: fragment packets (optionally w\/given MTU)\n  -D &lt;decoy1,decoy2&#91;,ME],...&gt;: Cloak a scan with decoys\n  -S &lt;IP_Address&gt;: Spoof source address\n  -e &lt;iface&gt;: Use specified interface\n  -g\/--source-port &lt;portnum&gt;: Use given port number\n  --proxies &lt;url1,&#91;url2],...&gt;: Relay connections through HTTP\/SOCKS4 proxies\n  --data &lt;hex string&gt;: Append a custom payload to sent packets\n  --data-string &lt;string&gt;: Append a custom ASCII string to sent packets\n  --data-length &lt;num&gt;: Append random data to sent packets\n  --ip-options &lt;options&gt;: Send packets with specified ip options\n  --ttl &lt;val&gt;: Set IP time-to-live field\n  --spoof-mac &lt;mac address\/prefix\/vendor name&gt;: Spoof your MAC address\n  --badsum: Send packets with a bogus TCP\/UDP\/SCTP checksum\nOUTPUT:\n  -oN\/-oX\/-oS\/-oG &lt;file&gt;: Output scan in normal, XML, s|&lt;rIpt kIddi3,\n     and Grepable format, respectively, to the given filename.\n  -oA &lt;basename&gt;: Output in the three major formats at once\n  -v: Increase verbosity level (use -vv or more for greater effect)\n  -d: Increase debugging level (use -dd or more for greater effect)\n  --reason: Display the reason a port is in a particular state\n  --open: Only show open (or possibly open) ports\n  --packet-trace: Show all packets sent and received\n  --iflist: Print host interfaces and routes (for debugging)\n  --append-output: Append to rather than clobber specified output files\n  --resume &lt;filename&gt;: Resume an aborted scan\n  --stylesheet &lt;path\/URL&gt;: XSL stylesheet to transform XML output to HTML\n  --webxml: Reference stylesheet from Nmap.Org for more portable XML\n  --no-stylesheet: Prevent associating of XSL stylesheet w\/XML output\nMISC:\n  -6: Enable IPv6 scanning\n  -A: Enable OS detection, version detection, script scanning, and traceroute\n  --datadir &lt;dirname&gt;: Specify custom Nmap data file location\n  --send-eth\/--send-ip: Send using raw ethernet frames or IP packets\n  --privileged: Assume that the user is fully privileged\n  --unprivileged: Assume the user lacks raw socket privileges\n  -V: Print version number\n  -h: Print this help summary page.\nEXAMPLES:\n  nmap -v -A scanme.nmap.org\n  nmap -v -sn 192.168.0.0\/16 10.0.0.0\/8\n  nmap -v -iR 10000 -Pn -p 80\nSEE THE MAN PAGE (&lt;https:\/\/nmap.org\/book\/man.html&gt;) FOR MORE OPTIONS AND EXAMPLES\n<\/code><\/pre>\n\n\n\n<p>Much more information is available in the Man page. Below you can see an animation of this recorded on asciinema<\/p>\n\n\n\n<script id=\"asciicast-ovCYzPkMsMStTx0gsLxSXzUmi\" src=\"https:\/\/asciinema.org\/a\/ovCYzPkMsMStTx0gsLxSXzUmi.js\" async=\"\"><\/script>\n\n\n\n<p>It would be a good practice to get used to using the Man pages in any Linux\/Unix based applications you are using, they often answer more questions than the help screen alone and can reduce hours of pointless internet searches to a few minutes of reading. <\/p>\n\n\n\n<p>If you vaguely know what you are looking for and want to try and focus the output from either the man pages or the help file you can of course use things like <code>grep<\/code> to help you.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nmap | grep -i \"host discovery\"<\/code><\/pre>\n\n\n\n<p>This will pipe the help pages to grep and look for the term &#8220;host discovery&#8221;. The <code>-i<\/code> makes the search case-insensitive.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"868\" height=\"122\" src=\"https:\/\/vroamam.com\/wordpress\/wp-content\/uploads\/2022\/12\/grep-help.png\" alt=\"\" class=\"wp-image-1241\" srcset=\"https:\/\/vroamam.com\/wordpress\/wp-content\/uploads\/2022\/12\/grep-help.png 868w, https:\/\/vroamam.com\/wordpress\/wp-content\/uploads\/2022\/12\/grep-help-768x108.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><figcaption class=\"wp-element-caption\">Screen capture showing default Nmap output passed to grep with a case incentive search for there term &#8220;host discovery&#8221; and the associated results<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Getting Help<\/p>\n<p>The first thing that I must urge you to do is become self sufficient. There is an online manual at https:\/\/nmap.org\/book\/man.html but don&#8217;t rely on that being available. One day you may find yourself onsite somewhere that internet access is very restricted, what would you do then? <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[87,2,32,120,108,3],"tags":[65,7,105,106,100,107],"class_list":["post-656","post","type-post","status-publish","format-standard","hentry","category-ctf","category-cybersec","category-networking","category-nmap-training","category-nmap","category-training","tag-cyber","tag-cyber-security","tag-help","tag-man-page","tag-nmap","tag-scanning","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pahuGk-aA","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/posts\/656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/comments?post=656"}],"version-history":[{"count":7,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/posts\/656\/revisions"}],"predecessor-version":[{"id":1242,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/posts\/656\/revisions\/1242"}],"wp:attachment":[{"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/media?parent=656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/categories?post=656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vroamam.com\/wordpress\/wp-json\/wp\/v2\/tags?post=656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}