Login Register






IPfinder Bash Script. filter_list
Author
Message
IPfinder Bash Script. #1
Hello HackCommunity, I have a little bash script here that I am using long time now. I thought is worth sharing this. Its a script that will find and nicely print out your local && global ip address.Again this is mainly for terminal users. Ofc you can find them manually on terminal && on browser, but this for sure save you time and I guess you will find it more handy too.

Requirements : Linux OS

Here is the code:
Code:
#!/bin/bash ## Setting up the variables for check up eth_info=`ifconfig eth0 | grep "inet addr" | awk -F: ' { print $2 } ' | awk ' { print $1 } '` wlan_info=`ifconfig wlan0 | grep "inet addr" | awk -F: ' { print $2 } ' | awk ' { print $1 } '` ## Prints your local ip address echo -e "\nYour Local Ip Is : \c" if [ -z $eth_info ]; then echo $wlan_info else echo $eth_info fi echo ## Prints your local Ip address echo -e "Your Global Ip Is : \c" wget http://ipecho.net/plain -O - -q ; echo echo

Running this script will conclude on this results normally:
Quote:Your Local Ip Is : <local ip address>

Your Global Ip Is : <global ip address>


I wish this script will help Linux Buddies in any way!
Thanks a lot for reading this.
Sincerely,
L0aD1nG


EDIT : Thanks to @Singularity for his important note!
(This post was last modified: 08-26-2014, 04:32 PM by krozz.)
MASTERING OTHERS IS STRENGTH, MASTERING YOURSELF IS TRUE POWER.

[Image: qJweLN6.jpg]

Reply





Messages In This Thread
IPfinder Bash Script. - by L0aD1nG - 08-26-2014, 02:53 PM