ftp giving url but i want the IP address

Programmer In Training pit at joseph-a-nagy-jr.us
Mon Apr 5 15:20:55 UTC 2010


On 04/05/10 10:08, Walter wrote:
> I want to parse ftp error messages in auth.log and use the
> ip address in inserting a block into ipfw.  It works, except
> when ftpd spits out the host-specific url rather than the ip.
> Adding "-h" to the ftpd command in inet.conf didn't help.
> Can someone tell me how to do this, or point me to code
> (C) to convert it?
> 
> Thanks.  I'm off-list so please reply directly.
> 
> Walter

Would it be possible to wrapper everything in a script that uses a
single ping (ping -c 1) to pull the resulting IP address from the
output? For example:

ping -c 1 google.com
PING google.com (74.125.47.103): 56 data bytes
64 bytes from 74.125.47.103: icmp_seq=0 ttl=53 time=111.391 ms

--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 111.391/111.391/111.391/0.000 ms

seeing how that's the standard output for ping, couldn't you use grep
and a regex to grab the IP either from the parenthesis or that first
line? Of course there might be an easier way and/or better tool than
ping to do this.

CCing the list to get a discussion going as I imagine such a script
could have other uses.

-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.
Original content copyright under the OWL http://owl.apotheon.org
Please do not CC me. If I'm posting to a list it is because I am subscribed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100405/9469ff1b/signature.pgp


More information about the freebsd-questions mailing list