Add - 2 new examples using nmap (#61)

add - two examples using nmap
This commit is contained in:
cr0hn
2019-10-23 18:56:01 +02:00
committed by pancho horrillo
parent 52ae3375a4
commit 73308cebeb
2 changed files with 43 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#
# Nmap execution with callback. When processes finishes call the CALLBACK site and
# send a POST with the XML results
#
# Call example:
#
# > curl -v "http://localhost:9001/nmap-callback?callback=127.0.0.1:9999" -d "ip=127.0.0.1&ports=8000,9000"
#
kapow route add -X POST /nmap-callback - <<-'EOF'
{
RESULT_FILE="/tmp/${RANDOM}${RANDOM}${RANDOM}"
nmap -Pn -n -p $(kapow get /request/form/ports) -oX $RESULT_FILE $(kapow get /request/form/ip)
curl --connect-timeout 5 -X POST -F "data=@$RESULT_FILE" $(kapow get /request/params/callback) 2> /dev/null > /dev/null
rm -f $RESULT_FILE
} | kapow set /response/stream
EOF
+22
View File
@@ -0,0 +1,22 @@
#
# Streams nmap execution. When processes finishes print the value ##########"
# as separator and then print the Nmap XML report
#
# Call example:
#
# > curl -v http://localhost:9001/nmap-stream -d "ip=127.0.0.1"
#
kapow route add -X POST /nmap-stream - <<-'EOF'
{
RESULT_FILE="/tmp/${RANDOM}${RANDOM}${RANDOM}"
nmap -Pn -n -p 9000 -oX $RESULT_FILE $(kapow get /request/form/ip)
echo "##########"
cat $RESULT_FILE
rm -f $RESULT_FILE
} | kapow set /response/stream
EOF