Skip to content

Instantly share code, notes, and snippets.

@jwerle
Created August 22, 2014 23:50
Show Gist options
  • Save jwerle/8c33c2ec6551d87d5dbe to your computer and use it in GitHub Desktop.
Save jwerle/8c33c2ec6551d87d5dbe to your computer and use it in GitHub Desktop.
#!/bin/bash
HOST="$1"
PORT="$2"
umq recv ${PORT} &
while read -r buf; do
nmap "${HOST}" -p "${PORT}" --open 2>/dev/null | \
awk '/scan report for/ {$1=$2=$3=$4=""; print $0}' | \
tr -d ' ' | {
while read -r host; do
echo "me => $host";
echo "${buf}" | umq push $host ${PORT};
{
umq recv $host ${PORT} | while read -r reply; do
if [[ -z "$reply" ]]; then continue; fi
echo "$host <= me"
echo $reply
done
} &
done
}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment