Skip to content

Commit 3544014

Browse files
committed
Fix problem when nmap file has .txt extension (3.0)
This addresses a bug filed in #1935 in 3.1dev when the supplied file has a .txt extension. In this scenario the input file was nulled as from the input file in nmap format an internal input file was generated which has a .txt extension, in the same directory. The idea was to persist the file for the user. Now, this internal input file is ephemeral and only written to $TEMPDIR.
1 parent ca558a9 commit 3544014

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

testssl.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19003,17 +19003,12 @@ nmap_to_plain_file() {
1900319003
else
1900419004
fatal "Nmap file $FNAME is not in grep(p)able format (-oG filename.g(n)map)" $ERR_FNAMEPARSE
1900519005
fi
19006-
# strip extension and create output file *.txt in same folder
19006+
# create ${FNAME%.*}.txt in $TEMPDIR
1900719007
target_fname="${FNAME%.*}.txt"
19008-
> "${target_fname}"
19009-
if [[ $? -ne 0 ]]; then
19010-
# try to just create ${FNAME%.*}.txt in the same dir as the gnmap file failed.
19011-
# backup is using one in $TEMPDIR
19012-
target_fname="${target_fname##*\/}" # strip path (Unix)
19013-
target_fname="${target_fname##*\\}" # strip path (Dos)
19014-
target_fname="$TEMPDIR/$target_fname"
19015-
> "${target_fname}" || fatal "Cannot create \"${target_fname}\"" $ERR_FCREATE
19016-
fi
19008+
target_fname="${target_fname##*\/}" # strip path (Unix)
19009+
target_fname="${target_fname##*\\}" # strip path (Dos)
19010+
target_fname="$TEMPDIR/$target_fname"
19011+
> "${target_fname}" || fatal "Cannot create \"${target_fname}\"" $ERR_FCREATE
1901719012

1901819013
# Line x: "Host: AAA.BBB.CCC.DDD (<FQDN>) Status: Up"
1901919014
# Line x+1: "Host: AAA.BBB.CCC.DDD (<FQDN>) Ports: 443/open/tcp//https///"

0 commit comments

Comments
 (0)