Created
March 8, 2017 14:09
-
-
Save alex-pat/cb59e8ce97044d28920abc546f8c55ac to your computer and use it in GitHub Desktop.
Raspberry Pi
This file contains 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/bash | |
# sends ip to all devices in local network | |
PORT=3001 | |
C_IP=$(ifconfig wlan0 | grep -oe 'addr:192.168.[[:digit:]]*' | cut -d. -f 3 ) | |
COMPS=$(nmap 192.168.$C_IP.1/24 | grep "scan report" | grep -v raspberrypi | grep -oe '(192.168.[[:digit:]]*.[[:digit:]]*' | cut -d. -f4 ) | |
for i in ${COMPS[@]} | |
do | |
echo "ip of pi is $(hostname -I)" | netcat "192.168.$C_IP.$i" "$PORT" | |
done |
This file contains 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/bash | |
# Run it first | |
PORT=3001 | |
MY_IP=$(ifconfig -a | grep -oe '192.168.[[:digit:]]*.[[:digit:]]*' | head -n 1 ) | |
ncat -l "$MY_IP" "$PORT" | |
ncat -l "$MY_IP" "$PORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment