Created
March 22, 2022 10:50
-
-
Save mohclips/285afa4839254af73aebda6a0ab37568 to your computer and use it in GitHub Desktop.
default route in bash
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
# try to use the least complex commands available in bash to get the default route | |
# used when ip r, ifconfig are not available | |
# like when in a compromised container :) | |
printf '%d.%d.%d.%d\n' $(echo $(cat /proc/net/route | grep "00000000.*00000000" | cut -b15-22 | grep -o .. | tac | paste -sd '' -) | sed 's/../0x& /g') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment