Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Apr 2010 10:20:25 -0500
From:      Programmer In Training <pit@joseph-a-nagy-jr.us>
To:        Walter <walterk1@earthlink.net>
Cc:        Questions <freebsd-questions@FreeBSD.org>
Subject:   Re: ftp giving url but i want the IP address
Message-ID:  <4BB9FFB9.2080503@joseph-a-nagy-jr.us>
In-Reply-To: <4BB9FCFB.40103@earthlink.net>
References:  <4BB9FCFB.40103@earthlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig166BD931DFA1720D9156CE2E
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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?
>=20
> Thanks.  I'm off-list so please reply directly.
>=20
> 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=3D0 ttl=3D53 time=3D111.391 ms

--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev =3D 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.

--=20
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 subscrib=
ed.


--------------enig166BD931DFA1720D9156CE2E
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iQEcBAEBAgAGBQJLuf/PAAoJEENZQ8DH7rW06RIH/iD33arbQmsYPgE8cw0DFI6A
bYamKU0aLsyBQKW+gRnO6oJThMRz77eXlklFxy2Tiu8VIl47psOl9f7Tr7j3moJ6
XuO2zE/vOB5++anpVQJrmedWdTUUUOo/ItEjv2qEhliXgDzNl9eNMk4JXu4XLHm3
Q8OEdaz+nbk9XhjQfYo0yKKqj15fL2DpFRT2+4enDCvbusQlCvEZiLXGbSJx2YNl
jikWULmPG8hqedM92xnyFH6ePyY3b7wj8lagBF/kv+e1QR7YRMjgGg3FtaHbldHJ
uWQLXuJIUWHAgayxW9y61f3DuKhGr1anZCH5QuWNsuEwQzHV+6z32HN28kiGlt0=
=sJIP
-----END PGP SIGNATURE-----

--------------enig166BD931DFA1720D9156CE2E--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BB9FFB9.2080503>