Created
July 19, 2017 10:11
-
-
Save ChatchaiJ/4c4a5e8d80888f9b48905b87f744e004 to your computer and use it in GitHub Desktop.
Send WiFi scan result as picture via Telegram message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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