🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #12547

Re: resolucion inversa desde script

#12547
From: J.A. Gutierrez
Date: Thu, 21 Jun 2001 10:43
64 lines
2288 bytes
Oscar Lopez <yo@yo.es> wrote:

: Como se podria hacer esto desde bash? hay algun parametro para netstat que
: permita la ejecucion de comandos en desatendido? o alguna solucion similar
: vaya!

	netstat???

	nslookup

	nslookup 169.69.169.69 | sed -e '/^Name:/!d' -e 's/^Name:[ ]*//'

	o bien:

- ghost.c -----------------------------------------------------------------
#include <stdio.h>

#include <sys/types.h>  
#include <sys/socket.h> 
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>  

#include <errno.h>  

#ifndef INADDR_NONE
#	define INADDR_NONE (in_addr_t)-1
#endif

int main(int argc, char *argv[])
{

	struct  hostent			*hp;
	u_long					add;

	if ( (argc!=2) ||
		(INADDR_NONE  == (add = inet_addr(argv[1]))))
	{
		fprintf( stderr,"uso: %s ip\n", argv[0] );
		exit(1);
	}

	if ( NULL == ( hp = gethostbyaddr((void *)&add, sizeof(add),AF_INET)))
	{
		perror("gethostbyaddr: can't get host");
		exit(2);
	}
	else
	{
		puts(hp->h_name);
	}

	exit (0);
}

---------------------------------------------------------------------------



-- 
PGP and other useless info at      \
http://www.cps.unizar.es/~spd/      \
finger://daphne.cps.unizar.es/spd    \       Timeo Danaos et dona ferentes
ftp://ivo.cps.unizar.es/pub/          \                         (Virgilio)   
Technical Details
Message-ID: <9gsj3s$8ka$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!jussieu.fr!news.rediris.es!news.unizar.es!not-for-mail
References: <rtkX6.40915$fP.1240518@telenews.teleline.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f86c8,af4ca9d98c17ad71
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-06-21 03:27:45 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!jussieu.fr!news.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: resolucion inversa desde script
Date: 21 Jun 2001 10:43:08 GMT
Organization: Rank
Lines: 64
Message-ID: <9gsj3s$8ka$1@news.unizar.es>
References: <rtkX6.40915$fP.1240518@telenews.teleline.es>
NNTP-Posting-Host: daphne.cps.unizar.es
X-Trace: news.unizar.es 993120188 8842 155.210.152.20 (21 Jun 2001 10:43:08 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 21 Jun 2001 10:43:08 GMT
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (IRIX/6.2 (IP22))