Skip to content

Instantly share code, notes, and snippets.

@ChatchaiJ
Created July 19, 2017 10:11
Show Gist options
  • Save ChatchaiJ/4c4a5e8d80888f9b48905b87f744e004 to your computer and use it in GitHub Desktop.
Save ChatchaiJ/4c4a5e8d80888f9b48905b87f744e004 to your computer and use it in GitHub Desktop.
Send WiFi scan result as picture via Telegram message
#!/bin/sh
BINDIR="${HOME}/bin"
WORKDIR="/tmp/wifi"
WIFISCAN="$BINDIR/wifi-scan"
SENDPHOTO="$BINDIR/botSendPhoto"
TEXT2PNG="$BINDIR/text2png"
[ ! -d $WORKDIR ] && mkdir -p $WORKDIR
cd $WORKDIR || exit
CAPTION="`hostname` wifi scan `date +%Y%m%d_%H%M%S`"
(
printf "=== iwconfig wlan0 ===\n";
/sbin/iwconfig wlan0;
printf "\n=== ip addr show wlan0 ===\n";
/sbin/ip addr show wlan0;
printf "\n\n=== wifi scan ===\n";
$WIFISCAN
) > ascii.txt
$TEXT2PNG # convert 'ascii.txt' to 'image.png'
# Caption ImageFile To
$SENDPHOTO "$CAPTION" image.png $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment