|
|
|
|
#1 |
|
Triple-A Player
Join Date: Feb 2003
Posts: 59
|
Get wide-area IP address for localhost on command-line?
First, a brief explanation of what I'm trying to do. I'm playing with the tcpflow utility and I want to run a single command (which I will later store as an alias) to write all of the tcp traffic to and from my machine.
The utility tcpflow will look at all of the traffic it can see (regardless of whether it's to one's own computer or not). There is a way to exclude one IP address or only show traffic to one IP address. I have everything worked out except for how to get my own IP address from the command line: mkdir -p ~/Desktop/output; cd ~/Desktop/output; sudo tcpflow -i en0 host `get_the_ip_command` Basically, all I need is a UNIX command to output my computer's IP address that is visible to the internet. And no, using "localhost" does not work. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jan 2002
Posts: 10,652
|
It'll require some grepping in your command (or perl, or awk), but I think this is what you're looking for:
Code:
ifconfig en0 inet Code:
hostname
__________________
Chameleon's Consignment Loft] |
|
|
|
|
|
#3 |
|
Triple-A Player
Join Date: Feb 2003
Posts: 59
|
Super! Thanks a lot.
I'll see what I can whip up from the ifconfig stuff. With Rendezvous, hostname gives the rendezvous address (my-computer.local). So, why shouldn't / wouldn't I trust the hostname command? Easy to spoof or something? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|