Fix for #66 - Process the last port in nmap’s XML mode
This commit is contained in:
parent
2b92095822
commit
c00b72665a
1 changed files with 28 additions and 19 deletions
47
searchsploit
47
searchsploit
|
@ -273,7 +273,7 @@ function searchsploitout()
|
||||||
function nmapxml()
|
function nmapxml()
|
||||||
{
|
{
|
||||||
## Remove any old traces
|
## Remove any old traces
|
||||||
rm -f /tmp/searchsploitout
|
rm -f /tmp/searchsploit.{tmp,out}
|
||||||
|
|
||||||
## Feedback to the end user
|
## Feedback to the end user
|
||||||
echo -e "[i] Reading: '${FILE}'\n"
|
echo -e "[i] Reading: '${FILE}'\n"
|
||||||
|
@ -286,28 +286,37 @@ function nmapxml()
|
||||||
type=$( echo "${line}" | cut -d" " -f 1 )
|
type=$( echo "${line}" | cut -d" " -f 1 )
|
||||||
input=$( echo "${line}" | cut -d" " -f 2- )
|
input=$( echo "${line}" | cut -d" " -f 2- )
|
||||||
|
|
||||||
case "${type}" in
|
case "${type}" in
|
||||||
"[IP]")
|
"[IP]")
|
||||||
#[[ "${VERBOSE}" -eq 1 ]] && echo -e "\n\n\e[32m[*] IP: ${input}\e[39m" 1>&2
|
#[[ "${VERBOSE}" -eq 1 ]] && echo -e "\n\n\e[32m[*] IP: ${input}\e[39m" 1>&2
|
||||||
;;
|
;;
|
||||||
"[NAME]")
|
"[NAME]")
|
||||||
#searchsploitout
|
## If we have already looped around and got something, save it before moving onto the current value
|
||||||
echo "${software}" >> /tmp/searchsploitout
|
if [[ "${software}" ]]; then
|
||||||
software="${input}"
|
#searchsploitout
|
||||||
;;
|
echo "${software}" >> /tmp/searchsploit.out
|
||||||
"[PRODUCT]")
|
fi
|
||||||
software="${input}"
|
## Something is better than nothing. Will just go on the default service that matches the port. e.g. domain
|
||||||
;;
|
software="${input}"
|
||||||
"[VERSION]")
|
## Might not get any more than this, if -sV failed
|
||||||
software="${software} ${input}"
|
echo "${software}" > /tmp/searchsploit.tmp
|
||||||
;;
|
;;
|
||||||
|
"[PRODUCT]")
|
||||||
|
## We have a name, but no version (yet?) e.g. dnsmasq
|
||||||
|
software="${input}"
|
||||||
|
echo "${software}" > /tmp/searchsploit.tmp
|
||||||
|
;;
|
||||||
|
"[VERSION]")
|
||||||
|
software="${software} ${input}"
|
||||||
|
## Name & version. There isn't any more information to get, game over. e.g. dnsmasq 2.72
|
||||||
|
echo "${software}" >> /tmp/searchsploit.out
|
||||||
|
echo "" > /tmp/searchsploit.tmp
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
#searchsploitout
|
|
||||||
echo "${software}" >> /tmp/searchsploitout
|
|
||||||
|
|
||||||
## Read in from file (so there are no duplicates - ...but unable to print out IPs)
|
## Read in from file (so there are no duplicates - ...but unable to print out IPs)
|
||||||
cat /tmp/searchsploitout | tr '[:upper:]' '[:lower:]' | awk '!x[$0]++' | while read software; do
|
cat /tmp/searchsploit.tmp /tmp/searchsploit.out 2>/dev/null | tr '[:upper:]' '[:lower:]' | awk '!x[$0]++' | while read software; do
|
||||||
searchsploitout
|
searchsploitout
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue