Skip to content

Commit d7da1ba

Browse files
Post-demo fixes
1 parent 5010ed3 commit d7da1ba

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

bin/common.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,17 @@ function quick_yum_install() {
113113
echo "$package already installed, skipping" >&2
114114
fi
115115
}
116+
117+
function get_local_ipv4_addresses () {
118+
ip addr | \
119+
grep 'inet ' | \
120+
sed 's/ */ /g;s/\/[0-9]* / /g' | \
121+
cut -d\ -f 3
122+
}
123+
124+
function get_local_ipv6_addresses () {
125+
ip addr | \
126+
grep 'inet6' | \
127+
sed 's/ */ /g;s/\/[0-9]* / /g' | \
128+
cut -d\ -f 3
129+
}

gauntlt/nmap-invariant.attack

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@slow
2+
# Adapted from https://github.com/gauntlt/gauntlt/blob/master/examples/nmap/nmap.attack
3+
4+
Feature: nmap attacks for localhost
5+
Background:
6+
Given "nmap" is installed
7+
And the following profile:
8+
| name | value |
9+
| hostname | localhost |
10+
| host | localhost |
11+
| tcp_ping_ports | 22,25 |
12+
13+
Scenario: Verify server is open on expected set of ports using the nmap-fast attack step
14+
When I launch a "nmap-fast" attack
15+
Then the output should match /22.tcp\s+open/
16+
And the output should not match /25.tcp\s+open/
17+
18+
Scenario: Verify server is open on expected set of ports using the nmap fast flag
19+
When I launch an "nmap" attack with:
20+
"""
21+
nmap -F <hostname>
22+
"""
23+
Then the output should match:
24+
"""
25+
22/tcp\s+open
26+
"""
27+
28+
Scenario: Verify server is open on expected set of ports using the nmap fast flag
29+
When I launch an "nmap" attack with:
30+
"""
31+
nmap -F <hostname>
32+
"""
33+
Then the output should not contain:
34+
"""
35+
25/tcp\s+open
36+
"""
37+
38+
Scenario: Output to XML
39+
When I launch an "nmap" attack with:
40+
"""
41+
nmap -p- -oX /app/build/nmap-results.xml <hostname>
42+
"""
43+
And the file "/app/build/nmap-results.xml" should contain XML:
44+
| css |
45+
| ports port[protocol="tcp"][portid="22"] state[state="open"] |
46+
And the file "/app/build/nmap-results.xml" should not contain XML:
47+
| ports port[protocol="tcp"][portid="25"] state[state="open"] |
48+

gauntlt/nmap-running.attack

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@slow
2+
3+
Feature: nmap attacks for localhost and to use this for your tests, change the value in the profile
4+
Background:
5+
Given "nmap" is installed
6+
And the following profile:
7+
| name | value |
8+
| hostname | localhost |
9+
| host | localhost |
10+
| tcp_ping_ports | 22,80 |
11+
12+
Scenario: Verify server is open on expected set of ports using the nmap-fast attack step
13+
When I launch a "nmap-fast" attack
14+
Then the output should match /22.tcp\s+open/
15+
And the output should match /80.tcp\s+open/
16+
And the output should not match /25.tcp\s+open/
17+

gauntlt/nmap-stopped.attack

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@slow
2+
3+
Feature: nmap attacks for localhost and to use this for your tests, change the value in the profile
4+
Background:
5+
Given "nmap" is installed
6+
And the following profile:
7+
| name | value |
8+
| hostname | localhost |
9+
| host | localhost |
10+
| tcp_ping_ports | 22,25,80,443 |
11+
12+
Scenario: Verify server is open on expected set of ports using the nmap-fast attack step
13+
When I launch a "nmap-fast" attack
14+
Then the output should match /22\.tcp\s+open/
15+
Then the output should not contain /(25|80|443)\.tcp\s+open/
16+

0 commit comments

Comments
 (0)