exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

sadmind.scan.c

sadmind.scan.c
Posted Dec 14, 1999

Mass scanner for rpc.sadmind.

tags | tool, scanner
systems | unix
SHA-256 | 4553affbbbc9c859f5f17852168d375c2e99edecc319476f4920add223dcae19

sadmind.scan.c

Change Mirror Download
/* stupid rpc.sadmind scanner                 ja */
/* this is noisy/ripped, use it on your net only */

#include <stdio.h>
#include <netdb.h>
#include <stdlib.h>
#include <signal.h>
#include <rpc/rpc.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>

#define ERROR -1

void woopy(int s);
void usage(char *s);
void scan(char *i, char *o);

int sadmind(char *host);
unsigned long int res(char *p);

void usage(char *s)
{
printf("Usage: %s <inputfile> <outputfile>\n",s);
exit(ERROR);
}

void main(int argc, char **argv)
{
if(argc < 3) usage(argv[0]);
scan(argv[1], argv[2]);
}

void scan(char *i, char *o)
{
FILE *iff, *of;
char buf[512];

if((iff=fopen(i,"r")) == NULL)
return;
while(fgets(buf,512,iff) != NULL)
{
if(buf[strlen(buf)-1]=='\n')
buf[strlen(buf)-1]=0;
if(sadmind(buf) && (of=fopen(o,"a")) != NULL) {
buf[strlen(buf)+1]=0;
buf[strlen(buf)]='\n';

fputs(buf,of);
fclose(of);
}
}
fclose(iff);
}

void woopy(int s)
{
return;
}

int sadmind(char *host)
{
struct sockaddr_in server_addr;
struct pmaplist *head = NULL;
int sockett = RPC_ANYSOCK;
struct timeval minutetimeout;
register CLIENT *client;
struct rpcent *rpc;

server_addr.sin_addr.s_addr=res(host);
server_addr.sin_family=AF_INET;
server_addr.sin_port = htons(PMAPPORT);
minutetimeout.tv_sec = 15;
minutetimeout.tv_usec = 0;

/* cause clnttcp_create uses connect() */
signal(SIGALRM,woopy);
alarm(15);

if ((client = clnttcp_create(&server_addr, PMAPPROG,
PMAPVERS, &sockett, 50, 500)) == NULL) {
alarm(0);
signal(SIGALRM,SIG_DFL);
return 0;
}
alarm(0);
signal(SIGALRM,SIG_DFL);

if (clnt_call(client, PMAPPROC_DUMP, (xdrproc_t)
xdr_void, NULL,
(xdrproc_t) xdr_pmaplist, &head, minutetimeout) !=
RPC_SUCCESS)
return 0;
if (head != NULL)
for (; head != NULL; head = head->pml_next)
if((rpc =
getrpcbynumber(head->pml_map.pm_prog)))
if(strcmp(rpc->r_name,"sadmind") == 0)
return 1;

return 0;
}

unsigned long int res(char *p)
{
struct hostent *h;
unsigned long int rv;

h=gethostbyname(p);
if(h!=NULL)
memcpy(&rv,h->h_addr,h->h_length);
else
rv=inet_addr(p);
return rv;
}

/* end* /

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close