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

rpcprogs.c

rpcprogs.c
Posted Sep 23, 1999
Authored by s0ftpj

Finds an rpc program by its number scanning a range of ip's. Linux - c source. Courtesy of soft project digital security for y2k

systems | linux
SHA-256 | 347d130d35e513b0e4aaed2fb52cfc2747a8d4a3fa897ab1bb05a794b8c7f5d1

rpcprogs.c

Change Mirror Download
/* RPC PROGRAM SCANNER

This scanner can find an rpc program thx to its program numbers.

If u r looking for a prog number type:

cat /etc/rpc ;)

pIGpEN/S0ftPj'99
*/


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


int check(char *host);
unsigned long int res(char *p);
void woopy(int s);
void usage(char *s);
void scan(char *i, char *o);

int RNUMBER;

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

void main(int argc, char **argv)
{
system("clear");
printf("RPC PROGRAM NUMBER FiNDER\n");
printf("-=-=-=-=-=-=-=-=-=-=-=-=-\n");
printf("Coded by pIGpEN/S0ftPj99\n");
printf("Original scanner coded by BiT'97\n\n\n");

if(argc<4)
usage(argv[0]);
RNUMBER=atoi(argv[3]);
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(check(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 check(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((rpc->r_number)==RNUMBER){
printf("Rpc Number Found At: %s\n",host);
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;
}
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
    0 Files
  • 9
    Sep 9th
    0 Files
  • 10
    Sep 10th
    0 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 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