#!/bin/sh

set -e

[ -z "${IFACE}" ] && IFACE=wlan0
[ -z "${LOCALNET}" ] && LOCALNET=192.168.64.0/24

NOW=$(date +%Y%m%d-%H%M)
[ -z "${LOGFILE}" ] && LOGFILE=/tmp/datalogger-${NOW}.txt

echo "DEBUG: IFACE=${IFACE}"
echo "DEBUG: LOCALNET=${LOCALNET}"
echo "DEBUG: LOGFILE=${LOGFILE}"

echo "---------------------------------------------------------------" >>${LOGFILE}
NOW=$(date +%Y%m%d-%H%M)
echo "DEBUG: NOW=${NOW}" >>${LOGFILE}
iwlist $IFACE scan >>${LOGFILE}
nmap ${LOCALNET}

# EOF

#!/bin/sh

set -e

[ -z "${IFACE}" ] && IFACE=wlan0
[ -z "${LOCALNET}" ] && LOCALNET=192.168.64.0/24

NOW=$(date +%Y%m%d-%H%M)
[ -z "${LOGFILE}" ] && LOGFILE=/tmp/datalogger-${NOW}.txt

echo "DEBUG: IFACE=${IFACE}"
echo "DEBUG: LOCALNET=${LOCALNET}"
echo "DEBUG: LOGFILE=${LOGFILE}"

echo "---------------------------------------------------------------" >>${LOGFILE}
echo "DEBUG: date: $(date)" >>${LOGFILE}
echo "" >>${LOGFILE}
iwlist $IFACE scan >>${LOGFILE}
nmap ${LOCALNET} >>${LOGFILE}

echo "DEBUG: Logfile saved to ${LOGFILE}"

# EOF

Write nmap output to LOGFILE
Write nmap output to LOGFILE

Signed-off-by: Gianpaolo Macario <f8885408b8c3d931b330bae3c3a28a3af912c463@gmail.com>
