Skip to content

Commit ee5379a

Browse files
committed
add note to services.txt stating the file is auto-generated
1 parent 739ab44 commit ee5379a

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ fn build_services_phf() {
4141
for line_res in input.lines() {
4242
// we want to panic if one of the lines is err...
4343
let line = line_res.unwrap();
44+
// skip comment or blank lines
45+
if line.trim().is_empty() || line.trim().starts_with('#') {
46+
continue;
47+
}
4448
let mut parts = line.split('\t');
4549
// we want to panic if one of the service names is invalid
4650
let val = Cow::Owned(get_valid_service_fmt_const(parts.next().unwrap()));

resources/scripts/services.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
OUT=./services.txt
88

9+
echo -e "# This file is automatically generated from the port-to-service mappings provided by nmap\n# Available at: https://raw.githubusercontent.com/nmap/nmap/master/nmap-services\n# Don't edit this file manually\n" > $OUT
10+
911
curl https://raw.githubusercontent.com/nmap/nmap/master/nmap-services \
1012
| grep -E '/tcp|/udp' \
1113
| grep -E -v '^#|^unknown\t' \
12-
| cut -d$'\t' -f 1,2 > $OUT
14+
| cut -d$'\t' -f 1,2 >> $OUT

services.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# This file is automatically generated from the port-to-service mappings provided by nmap
2+
# Available at: https://raw.githubusercontent.com/nmap/nmap/master/nmap-services
3+
# Don't edit this file manually
4+
15
tcpmux 1/tcp
26
tcpmux 1/udp
37
compressnet 2/tcp

0 commit comments

Comments
 (0)