mirror of
https://github.com/trailofbits/algo.git
synced 2025-04-25 10:43:48 +02:00
fix: get public IP from default interface (#1396)
This commit is contained in:
parent
1c7e1dc331
commit
8f10647ec1
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ getAlgo() {
|
|||
publicIpFromInterface() {
|
||||
echo "Couldn't find a valid ipv4 address, using the first IP found on the interfaces as the endpoint."
|
||||
DEFAULT_INTERFACE="$(ip -4 route list match default | grep -Eo "dev .*" | awk '{print $2}')"
|
||||
ENDPOINT=$(ip -4 addr sh dev eth0 | grep -w inet | head -n1 | awk '{print $2}' | grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b')
|
||||
ENDPOINT=$(ip -4 addr sh dev $DEFAULT_INTERFACE | grep -w inet | head -n1 | awk '{print $2}' | grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b')
|
||||
export ENDPOINT=$ENDPOINT
|
||||
echo "Using ${ENDPOINT} as the endpoint"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue