Last active
August 7, 2024 13:30
-
-
Save lopes/4436846 to your computer and use it in GitHub Desktop.
An deprecated IPv4 war dialer written in Shell Script. It's more like an example on how to make bitwise operations in Bash. #hack #draft #shell #shellscript #ip
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 | |
str2int(){ | |
local octet int=0 | |
for octet in $(echo $1 | tr "." " "); do | |
int=$((int << 8)) | |
int=$((int + octet)) | |
done | |
echo $int | |
} | |
int2str(){ | |
local octets int=$1 | |
for index in 1 2 3 4; do | |
octets="$((int & 255)) $octets" | |
int=$((int >> 8)) | |
done | |
echo $octets | tr " " "." | |
} | |
ADDR_STR=$1 | |
ADDR_INT=$(str2int "$1") | |
for ((index=$ADDR_INT; index < 4294967295; ++index)); do | |
ADDR_STR=$(int2str $index) | |
echo -n "$ADDR_STR - " | |
pingy=$(ping -c 3 $ADDR_STR 2>1) | |
echo "OK" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment