Grabbing IP# automatically

Grabbing IP# automatically

Post by Habibie4 » Fri, 13 Aug 1999 04:00:00



Hi,

I am wondering if anyone has any Perl, C, or C++ script that will
automatically grab an IP number once a PPP connection is established.
Preferrably a C++ script.

TIA.

--

PS. Remove "4m" from e-mail address to enable reply.

 
 
 

Grabbing IP# automatically

Post by dmalcol » Fri, 13 Aug 1999 04:00:00


Try this as a shell script:
------------------------------------------------------------------------------

LOCALIF="ppp0"

# Internal Interface
# This is the interface for your local network

# You shouldn't need to change anything in the rest of this section

LOCALIP=`ifconfig $LOCALIF | grep inet | cut -d : -f 2 | cut -d \  -f 1`
LOCALMASK=`ifconfig $LOCALIF | grep Mask | cut -d : -f 4`
LOCALNET="$LOCALIP/$LOCALMASK"

echo "Internal: $INTERNALNET"
echo "External: $LOCALNET"
-------------------------------------------------------------------------------

Compliment of Ian Hall-Beyer - this is a snippet from his ipchains script

Dan Malcolm


> Hi,

> I am wondering if anyone has any Perl, C, or C++ script that will
> automatically grab an IP number once a PPP connection is established.
> Preferrably a C++ script.

> TIA.

> --

> PS. Remove "4m" from e-mail address to enable reply.

  dmalcolm.vcf
< 1K Download

 
 
 

Grabbing IP# automatically

Post by Chris Mahmoo » Fri, 13 Aug 1999 04:00:00



> Hi,

> I am wondering if anyone has any Perl, C, or C++ script that will
> automatically grab an IP number once a PPP connection is established.
> Preferrably a C++ script.

Sorry, my C++ scripting is a little rusty, but something like
          ifconfig | grep inet.\*P-t-P | awk '{print $2}' | tr -d [a-z,:]
should do the trick.  Yes, you can all of that with one grep but I'm in a
hurry.
-ckm
 
 
 

1. grabbing an IP from HTML

Hi all-

I'm trying to build a shell script to pull an IP address from an HTML
file, and can't quite figure out how to accomplish it. I'm hoping that
someone can help me out...

The file contains multiple IP addresses, and unfortunatly does not
have any line breaks in it. But the HTML surrounding the IP address
does not vary.

Here's a chunk of the HTML (MAC & IP altered for obvious reasons):

<br>WAN: ?</th><td><br>? ?<font face=verdana
size=1>(MAC Address: 00-00-CC-00-55-BB)</td></tr><tr><th
bgcolor=6666cc>?</th><td><table width=90%><tr><td bgcolor=6666cc
width=47%>? ?<font color=white face=verdana size=2>IP
Address:</td><td><font face=verdana
size=2>12.222.111.22</td></tr><tr><td bgcolor=6666cc>?
?<font color=white face=verdana size=2>

All I want to do is have the IP address sent to a file. Any ideas???

Thanks in advance for your help...

-brian

2. SCSI RAID controllers

3. Grabbing HTTP Server IP Address with SSI

4. stubborn error with nismkdir

5. Apache too greedy about grabbing ports on IP addresses

6. Question about ipnat, ipf

7. How can my linux machine obtain an IP from the network automatically?

8. CASH REWARD! Cannot see router from PPP session..

9. Automatically emailing IP address?

10. automatically collect LAN IP addresses

11. How to get telnet IP automatically

12. automatically email external IP