Skip to content

Commit b002d48

Browse files
committed
Periodic Update
1 parent 7d0a469 commit b002d48

File tree

8 files changed

+67
-29
lines changed

8 files changed

+67
-29
lines changed

sections/evading_firewalls_and_other_sneakiness.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
1+
# nmap: Evading Firewalls
22
We are going to make assumptions which are very probable for many
33
firewalls, but won't be accurate, because they can vary from
44
firewall to firewall. We can list as anti-scanning technologies:
55

6-
* Firewall
7-
* NAT (Network Address Translation)
8-
* IDS (Intrusion Detection System)
6+
- Firewall
7+
- NAT (Network Address Translation)
8+
- IDS (Intrusion Detection System)
99

1010
We are going to discuss each and how they will affect the result.
1111

@@ -25,9 +25,9 @@ Decisions are primarily made based on the socket which is the
2525
combination "SourceIP,SourcePort and DestIP,DestPort". There are
2626
generally three types of firewall:
2727

28-
* Stateless Packet Filter Firewall
29-
* Stateful Packet Filter Firewall
30-
* Application (aka Proxy) Firewall
28+
- Stateless Packet Filter Firewall
29+
- Stateful Packet Filter Firewall
30+
- Application (aka Proxy) Firewall
3131

3232
We are not interested in the normal scans done with -sS or with
3333
-sT because in these cases we simply receive a response (or the

sections/examples_of_nmap_usage.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# nmap: Usage Examples
12

23
Let's see now a real case example of NMAP usage, the first thing
34
we do is:
@@ -16,9 +17,10 @@ network:
1617

1718
```sh
1819
nmap -sn -n 192.168.25.0/24
19-
# in this case, we disabled port
20-
# scanning with "-sn" and we disabled host name resolution with "
21-
# -n", in this way we get quickly the list of live hosts on the
20+
# in this case, we:
21+
# disabled port scanning with "-sn";
22+
# we disabled host name resolution with "-n",
23+
# in this way we get quickly the list of live hosts on the
2224
# network, we didn't specify any specific option for host
2325
# enumeration, since we are doing this operation in a local
2426
# network, so no matter which options we would have used, it

sections/host_enumeration_and_network_mapping.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# nmap: host enumeration
12

23
Nmap works at the OSI Network layer and Transport layer. We have
34
to remember that each layer has its own:

sections/icmp.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# nmap: ICMP
12

23
ICMP is used to:
34

@@ -27,6 +28,29 @@ There are 3 types of request/response pairs:
2728
The -PP and -PM requests can be used with some machines where ICMP ping requests
2829
have been blocked only.
2930

31+
For example we could perform a ping sweep similar to what the UNIX or Windows
32+
ping tool does to discover hosts on a network by doing:
33+
```sh
34+
nmap -sn -n -PE 172.28.128.0/24
35+
# -sn turns off the port scanning
36+
# -n does not resolve the IP addresses into domain names
37+
# -PE uses ICMP type 8 messages to ping hosts on the subnet
38+
```
39+
40+
Note that if we are on a local segment, we may also only see ARP packets,
41+
and this happens since nmap does as little as possible it can do to discover
42+
hosts. However we can see the ping probes whenever we try to perform this
43+
on a host outside our local network segment.
44+
45+
Whenever we want to force ping probes within our local network segment
46+
we can do:
47+
```sh
48+
sudo nmap -sO -p 1 -n -Pn <target>
49+
# in this case we:
50+
# `-Pn` disable the discovery phase (or "ping phase")
51+
# `-n` do not perform IP address resolution
52+
# `-sO -p 1` perform a raw IP scan where the -p1 indicates ICMP type 8 messages
53+
```
3054

3155
## One Flow Communication in ICMP
3256

sections/nated_systems_and_load_balancers.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# nmap: NATed systems and Load Balancers
12

23
Sometimes the IP address that we are scanning may be a firewall or a network
34
device which is using NAT and behind this device there may be multiple systems.
@@ -10,11 +11,11 @@ with a NATed network.
1011

1112
In this cases we can use TCP timestamps to infer what is the configuration:
1213

13-
* if timestamps are significantly different(> 1s): It is very likely that timestamps
14+
- if timestamps are significantly different(`> 1s`): It is very likely that timestamps
1415
are coming from different systems
15-
* if timestamps are euql (<1s): It is likely that timestamps are coming from
16+
- if timestamps are equal (`<1s`): It is likely that timestamps are coming from
1617
the same system
17-
* If only one port responds without set TCP timestamp options, it is
18+
- If only one port responds without set TCP timestamp options, it is
1819
safe to assume that two different systems are responding. If TSopts
1920
are not included in the answer or TSval = 0 on both ports, then no
2021
knowledge can be gained, because it could be the same system having

sections/nmap.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Another basic example could be:
4646
```sh
4747
nmap -sn 192.168.1.0/24
4848
# in this case nmap just executes an enumeration of the
49-
# hosts on the network address
49+
# hosts on the network address, it actually uses
50+
# different techniques to understand if a host is alive or not
5051
```
5152
Notice that Nmap has plenty of features, and can also integrate
5253
script capabilities.
@@ -80,3 +81,16 @@ divided in this way:
8081
* Script Scanning: execution of the user-mentioned scripts
8182
* Ouput: printing of the output on stdout or in files
8283

84+
85+
In addition, we may say that as a guideline an nmap operation
86+
can be subdivided into two major phases:
87+
- host discovery (or "ping phase"), controlled with the -P option
88+
- port scan, controlled with the -s option
89+
90+
Also remember that the default behavior of nmap also depends on whether
91+
we are executing the command:
92+
- as root vs non-privileged user
93+
- on a local network segment vs to a remote host
94+
95+
That's why sometimes using the same flags could lead to a slightly
96+
different network traffic.

sections/output.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
1+
# nmap Output
12

23
Let's look at some way to obtain better output:
3-
4-
* while in the interactive mode, if we are waiting for results we
4+
- while in the interactive mode, if we are waiting for results we
55
can press "Enter" and get some lines describing what nmap is
66
doing
7-
8-
* if we append the --reason in any case nmap is doing a port scan,
7+
- if we append the --reason in any case nmap is doing a port scan,
98
we'll notice the reason why nmap determined that the examined
109
ports were closed or opened
11-
12-
* if we are only interested in the open ports, and not even the
10+
- if we are only interested in the open ports, and not even the
1311
filtered ones, so we must append --open
14-
* we can output the results in a file with: "-o", we can save
12+
- we can output the results in a file with: "-o", we can save
1513
results into different formats:
14+
- N, normal format
15+
- X, XML format
16+
- G, grepable format
17+
- A, all formats
1618

17-
* N, normal format
18-
* X, XML format
19-
* G, grepable format
20-
* A, all formats
21-
22-
an example of these could be:
19+
An example of these could be:
2320
```sh
2421
nmap -oN fileName.txt
2522
```
2623

2724
What I personally prefer in scanning activities is:
28-
2925
```sh
3026
nmap -oA filename_prefix
3127
```

sections/port_scanning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
# nmap Port Scanning
12

23
There are two technique to "Port Specification" in nmap:
34

45
1. Explicitly using the "-p" flag
5-
66
2. By reference using nmap-services
77

88
## The "-p" flag

0 commit comments

Comments
 (0)