From owner-freebsd-questions@FreeBSD.ORG Mon Apr 5 15:20:54 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C979F106564A for ; Mon, 5 Apr 2010 15:20:54 +0000 (UTC) (envelope-from pit@joseph-a-nagy-jr.us) Received: from outbound-mail-313.bluehost.com (outbound-mail-313.bluehost.com [67.222.54.6]) by mx1.freebsd.org (Postfix) with SMTP id 97D798FC15 for ; Mon, 5 Apr 2010 15:20:54 +0000 (UTC) Received: (qmail 7420 invoked by uid 0); 5 Apr 2010 15:20:54 -0000 Received: from unknown (HELO box264.bluehost.com) (69.89.31.64) by cpoproxy3.bluehost.com with SMTP; 5 Apr 2010 15:20:54 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=joseph-a-nagy-jr.us; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type:X-Identified-User; b=JvJ5vKZkXXRK1uUEbnhSS57LtUQojRd0r5NIDSPs6VLR/bCjUm0schN8uaPrWxlynnohAWM79ez03rAQ3tUW4PtRfPuQZxjGpoSD7K0QbXOBKIie9Npxgej2dYDibbxr; Received: from [206.74.86.236] (helo=[192.168.1.101]) by box264.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Nyo6f-00022F-J9; Mon, 05 Apr 2010 09:20:54 -0600 Message-ID: <4BB9FFB9.2080503@joseph-a-nagy-jr.us> Date: Mon, 05 Apr 2010 10:20:25 -0500 From: Programmer In Training User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.8) Gecko/20100324 Thunderbird/3.0.3 MIME-Version: 1.0 To: Walter References: <4BB9FCFB.40103@earthlink.net> In-Reply-To: <4BB9FCFB.40103@earthlink.net> X-Enigmail-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig166BD931DFA1720D9156CE2E" X-Identified-User: {2250:box264.bluehost.com:ameliora:joseph-a-nagy-jr.us} {sentby:smtp auth 206.74.86.236 authed with pit@joseph-a-nagy-jr.us} Cc: Questions Subject: Re: ftp giving url but i want the IP address X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2010 15:20:55 -0000 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--