forked from testssl/testssl.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added "gmap2testssl.sh": utility which converts grepable nmap output …
…to testssl's file input
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#/bin/sh -e | ||
|
||
# utility which converts grepable nmap outout to testssl's file input | ||
|
||
usage() { | ||
cat << EOF | ||
usage: | ||
"$0 filename<.gmap>": looks for filename/filename.gmap and converts into basename \$(filename)-testssl.txt" | ||
"$0 filename<.gmap>" "scan option": same as before, only adds testssl.sh scan option in front of IPs" | ||
EOF | ||
exit 0 | ||
} | ||
|
||
[ -z "$1" ] && usage | ||
FNAME="$1" | ||
OPT2ADD="${2:-}" | ||
|
||
if ! grep -q gmap <<< "$FNAME"; then | ||
FNAME="$FNAME.gmap" | ||
fi | ||
[ ! -e $FNAME ] && echo "$FNAME not readable" && exit 2 | ||
|
||
|
||
TARGET_FNAME=${FNAME%.*}-testssl.txt | ||
|
||
# test whether there's more than one "open" per line | ||
while read -r oneline; do | ||
if [ $(echo "${oneline}" | tr ',' '\n' | grep -wc 'open') -gt 1 ]; then | ||
# not supported currently | ||
echo "$FNAME contains at least on one line more than 1x\"open\"" | ||
exit 3 | ||
fi | ||
done < "$FNAME" | ||
|
||
awk '/\<open\>/ { print "'"${OPT2ADD}"' " $2":"$5 }' "$FNAME" | sed 's/\/open.*$//g' >"$TARGET_FNAME" | ||
exit $? | ||
|
||
# vim:ts=5:sw=5 | ||
|