No one good way to do this, depends on variables. Some commands may help
sh ip arp (only works if you have l3 interfaces in each vlan)
sh ip dhcp snooping binding (needs dhcp snooping)
sh ip device tracking interface gigabitEthernet
No one good way to do this, depends on variables. Some commands may help
sh ip arp (only works if you have l3 interfaces in each vlan)
sh ip dhcp snooping binding (needs dhcp snooping)
sh ip device tracking interface gigabitEthernet
https://www.youtube.com/watch?v=Jx5NEOI_TPw&t=9s
Although some of it is specific to the company platform the explanation of the HSTS and why its an issue is good.
HSTS
HTTP Strict transport security
Any site that redirects from HTTP to HTTPS is vulnerable
Its medium severity usually but low hanging fruit for attackers, if they see the basics are not done they may probe further but if they see HSTS setup they may move on
HSTS is a protocol sets regulations for how user agents (web browsers) should handle their connection for a site running https
Its possible for attackers can downgrade https to http connections and read data
needed to open a 5GB log file
tried a few different options but landed on notepad++ with bigfiles plugin
Check for NTP settings on both firewalls
default: 1234.5678.90AB
IEEE 802/IETF: 12-34-56-78-90-AB
Unformatted: 1234567890AB
One byte 12:34:56:78:90:AB
Two byte 1234:5678:90AB
IP addresses were using dots
One byte 12.34.56.78.90.AB
two byte 1234.5678.90AB
Xerox made it and got 00-00-00
Cisco 00-00-0C
Next (later apple) 00-00-0F
Samsung 00-00-F0
MAC addresses are the address at L2
MAC addresses are possible to spoof so MAB sec not great
Some devices can't do MFA or 802.1x so MAC rules will be needed until devices get smarter.
CN | Common Name | This is the fully qualified domain name (FQDN) that specifies the server’s exact location in the Domain Name System (DNS). For example, a component with hostname webBridge1 and parent domain example.com has the fully qualified domain name webBridge1.example.com. The FQDN uniquely distinguishes the component from any other components called webBridge1 in other domains. | Required, see notes below |
O | Organization or Business name | Usually the legal incorporated name of a company. It should include any suffixes such as Ltd., Inc., or Corp. Use “” around the attribute if more than one word, e.g. “Example Inc.” | Optional |
OU | Organizational unit or Department name | For example, Support, IT, Engineering, Finance. Use “” around the attribute if more than one word, e.g. “Human Resources” | Optional |
L | Location | City or town. For example, London, Boston, Milan, Berlin. | Optional |
ST | Province, Region, County or State | For example, Buckinghamshire, California. | Optional |
C | Country | The two-letter ISO code for the country where your organization is located. For example, US, GB, FR. | Optional |
An email address | An email address to contact the organization. Usually the email address of the certificate administrator or IT department. | Optional | |
SAN | Subject Alternative Name | From X509 Version 3 (RFC 2459), SSL certificates are allowed to specify multiple names that the certificate should match. This field enables the generated certificate to cover multiple domains. It can contain IP addresses, domain names, email addresses, regular DNS host names, etc, separated by commas. If you specify this list you must also include the CN in this list. Although this is an optional field, the SAN field must be completed in order for XMPP clients to accept a certificate, otherwise the XMPP clients will display a certificate error. | Required for XMPP server certificates or if a single certificate is to be used across multiple components. See note below. Note: XMPP server is not supported from version 3.0 |
https://ztd.dds.microsoft.com/
https://cs.dds.microsoft.com/
https://login.live.com/
lgmsapeweu.blob.core.windows.net/
time.windows.com/
*.msftconnecttest.com/
*.microsoftaik.azure.net/
https://ekop.intel.com/ekcertservice/
https://ekcert.spserv.microsoft.com/EKCertificate/GetEKCertificate/v1
https://ftpm.amd.com/pki/aia
https://go.microsoft.com/
http://go.microsoft.com/
https://login.live.com/
https://activation.sls.microsoft.com/
http://crl.microsoft.com/pki/crl/products/MicProSecSerCA_2007-12-04.crl
https://validation.sls.microsoft.com/
https://activation-v2.sls.microsoft.com/
https://validation-v2.sls.microsoft.com/
https://displaycatalog.mp.microsoft.com/
https://licensing.mp.microsoft.com/
https://purchase.mp.microsoft.com/
https://displaycatalog.md.mp.microsoft.com/
https://licensing.md.mp.microsoft.com/
https://purchase.md.mp.microsoft.com/
*.download.windowsupdate.com/
*.dl.delivery.mp.microsoft.com/
*.delivery.mp.microsoft.com/
*.prod.do.dsp.mp.microsoft.com/
emdl.ws.microsoft.com/
*.dl.delivery.mp.microsoft.com/
*.windowsupdate.com/
*.delivery.mp.microsoft.com/
*.update.microsoft.com/
tsfe.trafficshaping.dsp.mp.microsoft.com/
*.manage.microsoft.com/
manage.microsoft.com/
*.prod.do.dsp.mp.microsoft.com/
*.windowsupdate.com/
*.dl.delivery.mp.microsoft.com/
*.update.microsofthttps://ztd.dds.microsoft.com/
https://cs.dds.microsoft.com/
https://login.live.com/
lgmsapeweu.blob.core.windows.net/
time.windows.com/
*.msftconnecttest.com/
*.microsoftaik.azure.net/
https://ekop.intel.com/ekcertservice/
https://ekcert.spserv.microsoft.com/EKCertificate/GetEKCertificate/v1
https://ftpm.amd.com/pki/aia
https://go.microsoft.com/
http://go.microsoft.com/
https://login.live.com/
https://activation.sls.microsoft.com/
http://crl.microsoft.com/pki/crl/products/MicProSecSerCA_2007-12-04.crl
https://validation.sls.microsoft.com/
https://activation-v2.sls.microsoft.com/
https://validation-v2.sls.microsoft.com/
https://displaycatalog.mp.microsoft.com/
https://licensing.mp.microsoft.com/
https://purchase.mp.microsoft.com/
https://displaycatalog.md.mp.microsoft.com/
https://licensing.md.mp.microsoft.com/
https://purchase.md.mp.microsoft.com/
*.download.windowsupdate.com/
*.dl.delivery.mp.microsoft.com/
*.delivery.mp.microsoft.com/
*.prod.do.dsp.mp.microsoft.com/
emdl.ws.microsoft.com/
*.dl.delivery.mp.microsoft.com/
*.windowsupdate.com/
*.delivery.mp.microsoft.com/
*.update.microsoft.com/
tsfe.trafficshaping.dsp.mp.microsoft.com/
*.manage.microsoft.com/
manage.microsoft.com/
*.prod.do.dsp.mp.microsoft.com/
*.windowsupdate.com/
*.dl.delivery.mp.microsoft.com/
*.update.microsoft.com
*.delivery.mp.microsoft.com
tsfe.trafficshaping.dsp.mp.microsoft.com
emdl.ws.microsoft.com
*.do.dsp.mp.microsoft.com
*.emdl.ws.microsoft.com
*.notify.windows.com
*.wns.windows.com
devicelistenerprod.microsoft.com
devicelistenerprod.eudb.microsoft.com
login.windows.net/
payloadprod*.blob.core.windows.net/
time.windows.com
www.msftconnecttest.com
www.msftncsi.com
*.s-microsoft.com
clientconfig.passport.net/
windowsphone.com
approdimedatahotfix.azureedge.net/
approdimedatapri.azureedge.net/
approdimedatasec.azureedge.net/
euprodimedatahotfix.azureedge.net/
euprodimedatapri.azureedge.net/
euprodimedatasec.azureedge.net/
naprodimedatahotfix.azureedge.net/
naprodimedatapri.azureedge.net/
swda01-mscdn.azureedge.net/
swda02-mscdn.azureedge.net/
swdb01-mscdn.azureedge.net/
swdb02-mscdn.azureedge.net/
swdc01-mscdn.azureedge.net/
swdc02-mscdn.azureedge.net/
swdd01-mscdn.azureedge.net/
swdd02-mscdn.azureedge.net/
swdin01-mscdn.azureedge.net/
swdin02-mscdn.azureedge.net/
ekcert.spserv.microsoft.com
ekop.intel.com
ftpm.amd.com
*.itunes.apple.com
*.mzstatic.com
*.phobos.apple.com
5-courier.push.apple.com
ax.itunes.apple.com.edgesuite.net/
itunes.apple.com
ocsp.apple.com
phobos.apple.com
phobos.itunes-apple.com.akadns.net/
intunecdnpeasd.azureedge.net/
*.channelservices.microsoft.com
*.go-mpulse.net/
*.infra.lync.com
*.resources.lync.com
*.support.services.microsoft.com
*.trouter.skype.com
*.vortex.data.microsoft.com
edge.skype.com
remoteassistanceprodacs.communication.azure.com
lgmsapeweu.blob.core.windows.net/
fd.api.orgmsg.microsoft.com
ris.prod.api.personalization.ideas.microsoft.com
contentauthassetscdn-prod.azureedge.net/
contentauthassetscdn-prodeur.azureedge.net/
contentauthrafcontentcdn-prod.azureedge.net/
contentauthrafcontentcdn-prodeur.azureedge.net/
login.microsoftonline.com
*.officeconfig.msocdn.com
config.office.com
graph.windows.net/
enterpriseregistration.windows.net/
*.manage.microsoft.com
manage.microsoft.com.com/
*.delivery.mp.microsoft.com/
tsfe.trafficshaping.dsp.mp.microsoft.com/
emdl.ws.microsoft.com/
*.do.dsp.mp.microsoft.com/
*.emdl.ws.microsoft.com/
*.notify.windows.com/
*.wns.windows.com/
devicelistenerprod.microsoft.com/
devicelistenerprod.eudb.microsoft.com/
login.windows.net/
payloadprod*.blob.core.windows.net/
time.windows.com/
www.msftconnecttest.com/
www.msftncsi.com/
*.s-microsoft.com/
clientconfig.passport.net/
windowsphone.com/
approdimedatahotfix.azureedge.net/
approdimedatapri.azureedge.net/
approdimedatasec.azureedge.net/
euprodimedatahotfix.azureedge.net/
euprodimedatapri.azureedge.net/
euprodimedatasec.azureedge.net/
naprodimedatahotfix.azureedge.net/
naprodimedatapri.azureedge.net/
swda01-mscdn.azureedge.net/
swda02-mscdn.azureedge.net/
swdb01-mscdn.azureedge.net/
swdb02-mscdn.azureedge.net/
swdc01-mscdn.azureedge.net/
swdc02-mscdn.azureedge.net/
swdd01-mscdn.azureedge.net/
swdd02-mscdn.azureedge.net/
swdin01-mscdn.azureedge.net/
swdin02-mscdn.azureedge.net/
ekcert.spserv.microsoft.com/
ekop.intel.com/
ftpm.amd.com/
*.itunes.apple.com/
*.mzstatic.com/
*.phobos.apple.com/
5-courier.push.apple.com/
ax.itunes.apple.com.edgesuite.net/
itunes.apple.com/
ocsp.apple.com/
phobos.apple.com/
phobos.itunes-apple.com.akadns.net/
intunecdnpeasd.azureedge.net/
*.channelservices.microsoft.com/
*.go-mpulse.net/
*.infra.lync.com/
*.resources.lync.com/
*.support.services.microsoft.com/
*.trouter.skype.com/
*.vortex.data.microsoft.com/
edge.skype.com/
remoteassistanceprodacs.communication.azure.com/
lgmsapeweu.blob.core.windows.net/
fd.api.orgmsg.microsoft.com/
ris.prod.api.personalization.ideas.microsoft.com/
contentauthassetscdn-prod.azureedge.net/
contentauthassetscdn-prodeur.azureedge.net/
contentauthrafcontentcdn-prod.azureedge.net/
contentauthrafcontentcdn-prodeur.azureedge.net/
login.microsoftonline.com/
*.officeconfig.msocdn.com/
config.office.com/
graph.windows.net/
enterpriseregistration.windows.net/
*.manage.microsoft.com/
manage.microsoft.com/
Needs DNS name site.domain.com
Get your cert into PFX bundle format with password on the file
Import into IIS
Then edit the site bindings add 443 fill in domain and select cert
https://comodosslstore.com/resources/how-to-install-a-wildcard-ssl-certificate-on-iis-7-or-8/
You need a domain like vpn.domian.com
You need a cert for that domain installed and working on ASA
You need to setup SSO first
You will need to put in the email domain eg domain.com
It will ask you to create a TXT record in DNS
You will need to get DNS provider to set that up.
Once confirmed you will be able to download the IDP cert from the duo portal.
Now you can continue with doc
You will need to add mail attribute "UserPrincipalName"
https://duo.com/docs/sso-ciscoasa
ISE
Test lab is quite involved
When trying to import a cert with the private key bundled you get an error:
Import of certificate and private-key CERT-NAME failed. private key doesn't exist for csr.
Importing the signed cert with the same name as the CSR doesn't work. Panorama adds cert_ to the front of the name
You need to port cert_ in front for example if cert is called CERT-NAME you put cert_CERT-NAME
CSR import
Import the CA bundle if not done already
If you make duplicates will have to delete on CLI
https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u000000kHyVCAU&lang=en_US%E2%80%A9
tick your pending CSR
click import
give the same name as your csr request
select the pem file
PEM file format
ok
commit
create linked
create your firewall rule
Choose create linked NAT rule
In translated source SNAT click the drop down and choose MASQ (apply, save save)
Manual way is to connect to each switch "sh arp" "sh mac address table"
If you have all cisco kit
"traceroute mac" or "traceroute mac ip"
Using an NSM will often poll and have this data available (libreNMS)
You also have the option to create some scripts with python/pexpect/paramiko/netmiko etc
Saw some strange traffic going to 152.199.21.175
After getting a capture saw it was looking up cdn.devolutions.net
Both IP and URL had good rep but was trying to tie it to a corp app
Used sysmon on the server to log DNS requests
Found it was coming from a manageengine process
C:\Program Files (x86)\ManageEngine\UEMS_DistributionServer\bin\dcreplication.exe
Make/model
SW version
output of one or more commands
conclusion
customer and contact email
If you have FQDN then you can just add FQDN object in the rule
If you want to add a wildcard or multiple URLs in a group then you can create a custom URL category
Objects -> Custom objects -> URL categories - > Add
Add your URLs
*.mail.protection.outlook.com/
smtp.office365.com/
Always end with a / ending token
Blurb from the palo:
For domain entries, we recommend you use an ending token. Acceptable tokens are: . / ? & = ; +. If you choose not to use an ending token, you may block or allow more URLs than anticipated. For example, if you want to allow xyz.com and enter the domain as 'xyz.com,' you will allow xyz.com and URLs such as xyz.com.random.com. However, if you enter the domain as 'xyz.com/,' you will only allow xyz.com.
More info here:
https://docs.paloaltonetworks.com/advanced-url-filtering/administration/configuring-url-filtering/url-category-exceptions
CLI
set profiles custom-url-category URL-CC-OSCP-CRL description "Custom URL category for OSCP"
set profiles custom-url-category URL-CC-OSCP-CRL type "URL List"
set profiles custom-url-category URL-CC-OSCP-CRL list [ crl.globalsign.net www.d-trust.net cdp1.public-trust.com crl.cnnic.cn crl.entrust.net crl.globalsign.com crl.globalsign.net crl.identrust.com crl.thawte.com crl3.digicert.com crl4.digicert.com s1.symcb.com www.d-trust.net isrg.trustid.ocsp.identrust.com ocsp.digicert.com ocsp.entrust.net ocsp.globalsign.com ocsp.omniroot.com ocsp.startssl.com ocsp.thawte.com ocsp2.globalsign.com ocspcnnicroot.cnnic.cn root-c3-ca2-2009.ocsp.d-trust.net root-c3-ca2-ev-2009.ocsp.d-trust.net s2.symcb.com aia.startssl.com apps.identrust.com cacert.omniroot.com ]
Information gathering
Collecting info about what we are targeting (company, website/URL/IP, app, servers, people etc)
The scope can be wide or narrow.
People info gathering
Names and email format is what we usually want for a phishing attack
We can also look at social media, linkedin, facebook, instagram etc
Passive info gathering aka OSINT (open source intelligence)
We don't need permission because its publicly available information
Get as much as we can without actively engaging opensource intel
Publicly available information.
Visit public websites
examples:
Passive info gatherin (OSINT, DNS IP recon, social media, google)
Active info gathering (network/app/port scanning, calling up asking for info)
Enumeration (service/user/share enumeration)
Vulnerability scanning
Exploitation (use existing, modify or develop exploit)
Post exploitation
Reporting (writing of report / recommendation on remediation)
Active info gathering
We need permission
Scanning IP ranges
Scanning IP's for open ports (nmap/nessus)
Ports can tell us about services and we can look for vulns
Discovering open ports
examples:
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-sS | nmap 192.168.1.1 -sS | TCP SYN port scan (Default) |
-sT | nmap 192.168.1.1 -sT | TCP connect port scan (Default without root privilege) |
-sU | nmap 192.168.1.1 -sU | UDP port scan |
-sA | nmap 192.168.1.1 -sA | TCP ACK port scan |
-sW | nmap 192.168.1.1 -sW | TCP Window port scan |
-sM | nmap 192.168.1.1 -sM | TCP Maimon port scan |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-sL | nmap 192.168.1.1-3 -sL | No Scan. List targets only |
-sn | nmap 192.168.1.1/24 -sn | Disable port scanning. Host discovery only. |
-Pn | nmap 192.168.1.1-5 -Pn | Disable host discovery. Port scan only. |
-PS | nmap 192.168.1.1-5 -PS22-25,80 | TCP SYN discovery on port x. Port 80 by default |
-PA | nmap 192.168.1.1-5 -PA22-25,80 | TCP ACK discovery on port x. Port 80 by default |
-PU | nmap 192.168.1.1-5 -PU53 | UDP discovery on port x. Port 40125 by default |
-PR | nmap 192.168.1.1-1/24 -PR | ARP discovery on local network |
-n | nmap 192.168.1.1 -n | Never do DNS resolution |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-p | nmap 192.168.1.1 -p 21 | Port scan for port x |
-p | nmap 192.168.1.1 -p 21-100 | Port range |
-p | nmap 192.168.1.1 -p U:53,T:21-25,80 | Port scan multiple TCP and UDP ports |
-p | nmap 192.168.1.1 -p- | Port scan all ports |
-p | nmap 192.168.1.1 -p http,https | Port scan from service name |
-F | nmap 192.168.1.1 -F | Fast port scan (100 ports) |
-top-ports | nmap 192.168.1.1 -top-ports 2000 | Port scan the top x ports |
-p-65535 | nmap 192.168.1.1 -p-65535 | Leaving off initial port in range makes the scan start at port 1 |
-p0- | nmap 192.168.1.1 -p0- | Leaving off end port in range makes the scan go through to port 65535 |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-sV | nmap 192.168.1.1 -sV | Attempts to determine the version of the service running on port |
-sV -version-intensity | nmap 192.168.1.1 -sV -version-intensity 8 | Intensity level 0 to 9. Higher number increases possibility of correctness |
-sV -version-light | nmap 192.168.1.1 -sV -version-light | Enable light mode. Lower possibility of correctness. Faster |
-sV -version-all | nmap 192.168.1.1 -sV -version-all | Enable intensity level 9. Higher possibility of correctness. Slower |
-A | nmap 192.168.1.1 -A | Enables OS detection, version detection, script scanning, and traceroute |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-O | nmap 192.168.1.1 -O | Remote OS detection using TCP/IP stack fingerprinting |
-O -osscan-limit | nmap 192.168.1.1 -O -osscan-limit | If at least one open and one closed TCP port are not found it will not try OS detection against host |
-O -osscan-guess | nmap 192.168.1.1 -O -osscan-guess | Makes Nmap guess more aggressively |
-O -max-os-tries | nmap 192.168.1.1 -O -max-os-tries 1 | Set the maximum number x of OS detection tries against a target |
-A | nmap 192.168.1.1 -A | Enables OS detection, version detection, script scanning, and traceroute |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-T0 | nmap 192.168.1.1 -T0 | Paranoid (0) Intrusion Detection System evasion |
-T1 | nmap 192.168.1.1 -T1 | Sneaky (1) Intrusion Detection System evasion |
-T2 | nmap 192.168.1.1 -T2 | Polite (2) slows down the scan to use less bandwidth and use less target machine resources |
-T3 | nmap 192.168.1.1 -T3 | Normal (3) which is default speed |
-T4 | nmap 192.168.1.1 -T4 | Aggressive (4) speeds scans; assumes you are on a reasonably fast and reliable network |
-T5 | nmap 192.168.1.1 -T5 | Insane (5) speeds scan; assumes you are on an extraordinarily fast network |
SWITCH | EXAMPLE INPUT | DESCRIPTION |
---|---|---|
-host-timeout <time> | 1s; 4m; 2h | Give up on target after this long |
-min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time> | 1s; 4m; 2h | Specifies probe round trip time |
-min-hostgroup/max-hostgroup <size<size> | 50; 1024 | Parallel host scan group sizes |
-min-parallelism/max-parallelism <numprobes> | 10; 1 | Probe parallelization |
-max-retries <tries> | 3 | Specify the maximum number of port scan probe retransmissions |
-min-rate <number> | 100 | Send packets no slower than <number> per second |
-max-rate <number> | 100 | Send packets no faster than <number> per second |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-sC | nmap 192.168.1.1 -sC | Scan with default NSE scripts. Considered useful for discovery and safe |
-script default | nmap 192.168.1.1 -script default | Scan with default NSE scripts. Considered useful for discovery and safe |
-script | nmap 192.168.1.1 -script=banner | Scan with a single script. Example banner |
-script | nmap 192.168.1.1 -script=http* | Scan with a wildcard. Example http |
-script | nmap 192.168.1.1 -script=http,banner | Scan with two scripts. Example http and banner |
-script | nmap 192.168.1.1 -script "not intrusive" | Scan default, but remove intrusive scripts |
-script-args | nmap -script snmp-sysdescr -script-args snmpcommunity=admin 192.168.1.1 | NSE script with arguments |
COMMAND | DESCRIPTION |
---|---|
nmap -Pn -script=http-sitemap-generator scanme.nmap.org | http site map generator |
nmap -n -Pn -p 80 -open -sV -vvv -script banner,http-title -iR 1000 | Fast search for random web servers |
nmap -Pn -script=dns-brute domain.com | Brute forces DNS hostnames guessing subdomains |
nmap -n -Pn -vv -O -sV -script smb-enum*,smb-ls,smb-mbenum,smb-os-discovery,smb-s*,smb-vuln*,smbv2* -vv 192.168.1.1 | Safe SMB scripts to run |
nmap -script whois* domain.com | Whois query |
nmap -p80 -script http-unsafe-output-escaping scanme.nmap.org | Detect cross site scripting vulnerabilities |
nmap -p80 -script http-sql-injection scanme.nmap.org | Check for SQL injections |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-f | nmap 192.168.1.1 -f | Requested scan (including ping scans) use tiny fragmented IP packets. Harder for packet filters |
-mtu | nmap 192.168.1.1 -mtu 32 | Set your own offset size |
-D | nmap -D 192.168.1.101,192.168.1.102,192.168.1.103,192.168.1.23 192.168.1.1 | Send scans from spoofed IPs |
-D | nmap -D decoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ip | Above example explained |
-S | nmap -S www.microsoft.com www.facebook.com | Scan Facebook from Microsoft (-e eth0 -Pn may be required) |
-g | nmap -g 53 192.168.1.1 | Use given source port number |
-proxies | nmap -proxies http://192.168.1.1:8080, http://192.168.1.2:8080 192.168.1.1 | Relay connections through HTTP/SOCKS4 proxies |
-data-length | nmap -data-length 200 192.168.1.1 | Appends random data to sent packets |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-oN | nmap 192.168.1.1 -oN normal.file | Normal output to the file normal.file |
-oX | nmap 192.168.1.1 -oX xml.file | XML output to the file xml.file |
-oG | nmap 192.168.1.1 -oG grep.file | Grepable output to the file grep.file |
-oA | nmap 192.168.1.1 -oA results | Output in the three major formats at once |
-oG - | nmap 192.168.1.1 -oG - | Grepable output to screen. -oN -, -oX - also usable |
-append-output | nmap 192.168.1.1 -oN file.file -append-output | Append a scan to a previous scan file |
-v | nmap 192.168.1.1 -v | Increase the verbosity level (use -vv or more for greater effect) |
-d | nmap 192.168.1.1 -d | Increase debugging level (use -dd or more for greater effect) |
-reason | nmap 192.168.1.1 -reason | Display the reason a port is in a particular state, same output as -vv |
-open | nmap 192.168.1.1 -open | Only show open (or possibly open) ports |
-packet-trace | nmap 192.168.1.1 -T4 -packet-trace | Show all packets sent and received |
-iflist | nmap -iflist | Shows the host interfaces and routes |
-resume | nmap -resume results.file | Resume a scan |
COMMAND | DESCRIPTION |
---|---|
nmap -p80 -sV -oG - -open 192.168.1.1/24 | grep open | Scan for web servers and grep to show which IPs are running web servers |
nmap -iR 10 -n -oX out.xml | grep "Nmap" | cut -d " " -f5 > live-hosts.txt | Generate a list of the IPs of live hosts |
nmap -iR 10 -n -oX out2.xml | grep "Nmap" | cut -d " " -f5 >> live-hosts.txt | Append IP to the list of live hosts |
ndiff scanl.xml scan2.xml | Compare output from nmap using the ndif |
xsltproc nmap.xml -o nmap.html | Convert nmap xml files to html files |
grep " open " results.nmap | sed -r ‘s/ +/ /g’ | sort | uniq -c | sort -rn | less | Reverse sorted list of how often ports turn up |
SWITCH | EXAMPLE | DESCRIPTION |
---|---|---|
-6 | nmap -6 2607:f0d0:1002:51::4 | Enable IPv6 scanning |
-h | nmap -h | nmap help screen |
COMMAND | DESCRIPTION |
---|---|
nmap -iR 10 -PS22-25,80,113,1050,35000 -v -sn | Discovery only on ports x, no port scan |
nmap 192.168.1.1-1/24 -PR -sn -vv | Arp discovery only on local network, no port scan |
nmap -iR 10 -sn -traceroute | Traceroute to random targets, no port scan |
nmap 192.168.1.1-50 -sL -dns-server 192.168.1.1 | Query the Internal DNS for hosts, list targets only |
nmap 192.168.1.1 --packet-trace | Show the details of the packets that are sent and received during a scan and capture the traffic. |
Enumeration (learn more)