what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

rpc.c

rpc.c
Posted Feb 4, 2000
Authored by Console | Site etc-crew.org

rpc.c is a small rpc scanner to scan for vulnerabilities. Currently it checks for cmsd, ttdbserverd, sadmind, statd, and amd. Tested on Redhat, Solaris 7, and OpenBSD.

tags | tool, scanner, vulnerability
systems | linux, redhat, unix, solaris, openbsd
SHA-256 | 81bbde1e877e7e2dd448c7b709ed8f06ef43e9ef4a90418141a026b050d5e9cb

rpc.c

Change Mirror Download
// rpc scanner by console
// easily add a new service by adding a id and a name to the rpc_targets struct
// should work on most OS's
// tested on redhat, solaris7, and openbsd


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

#define pquit(x) { perror(x); exit(1); }
#define cbuff(x) { strcpy(x,""); }

void usage(char *name) {
fprintf(stderr,"Usage: %s <ipfile> <output>\n",name);
exit(1); }



struct rpc_targets {
int id;
char *name;
};

struct rpc_targets targets[] =
{
{100083, "cmsd" },
{100068, "ttdbserverd" },
{100232, "sadmind" },
{100024, "statd" },
{300019, "amd" },
{0, 0 }
};

int checkrpc(char *host,FILE *log) {
struct sockaddr_in rpcaddr;
struct pmaplist *head;
struct hostent *he;
int i;

if ((he=gethostbyname(host)) == NULL) return -1;


memset(&rpcaddr, 0, sizeof(struct sockaddr_in));
rpcaddr.sin_family = AF_INET;
rpcaddr.sin_port = htons(PMAPPORT);
memcpy(&rpcaddr.sin_addr.s_addr, he->h_addr_list[0], he->h_length);


if ((head = pmap_getmaps(&rpcaddr)) == NULL) return -1;


for ( ;head != NULL; head=head->pml_next) {
for (i=0; targets[i].id; i++) {
if (head->pml_map.pm_prog==targets[i].id) {
fprintf(log,"%s is running %s\n",host,targets[i].name);
fflush(log);
}
}
}
}


int main(int argc, char **argv) {
char hbuf[1024];
FILE *input;
FILE *output;
pid_t pid;
int i;

if (argc < 2) usage(argv[0]);


if ((input=fopen(argv[1],"r")) == NULL) pquit("error opening input file");
if ((output=fopen(argv[2],"a")) == NULL) pquit("error opening output file");

pid = fork();
if (pid < 0) pquit("fork");
if (pid > 0) {
printf("launched in bg with pid %d\n",pid);
exit(0); }

while (fgets(hbuf,sizeof(hbuf)-1,input) != NULL) {
hbuf[strlen(hbuf)-1]=0;
checkrpc(hbuf,output);
cbuff(hbuf);
}
}



Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close