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

sadmindscan.c

sadmindscan.c
Posted Dec 14, 1999
Authored by Bernard Junk

Sadmind Solaris RPC tiny Scanner. Scans a specific host or a class C network.

tags | tool, scanner
systems | unix, solaris
SHA-256 | 01a80ba07a7acbb574bdf002310c1e6a3ff2cd8f30947f31ed1e76c33da1e2a7

sadmindscan.c

Change Mirror Download
/*
* Sadmind Solaris RPC tiny Scanner by Bjunk <bjunk@diinf.usach.cl>
*
* Run on mode <iphost> for a specific iphost
* or <net> for Class C networkz.
*
* Compiled: gcc -o sadmindscan sadmindscan.c
*
* Examples: ./sadmindscan 192.168.20.5 (for a specific hostip)
* ./sadmindscan ppp-342.internik.net (for a specific hostname)
* ./sadmindscan 127.0.1.- (for a specific Class C networkz)
* ./sadmindscan 224.0.2.- > logfile (hehe!)
*
* This scanner obviously can be enhanced, thatz yourz w0rkz kidz
*
* ripped from amdscan.c by me >=)
* calculate_sleep ripped from nmap by Fyodor =)
*
*/

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <rpc/rpc.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>

#define SADMIN_PROGRAM ((u_long)100232)
#define SADMIN_VERSION ((u_long)10)

int net_mode=0;
void finderz(char *host);
unsigned long calculate_sleep(char *host);

int main(int argc,char *argv[])
{
char host[1000];
char net[1000];
int i;
int sleep=0;

if(argc < 2)
{
printf("Solaris RPC sadmind tiny scanner by Bjunk\n");
printf("Usage: %s <host> or <net>\n",argv[0]);
exit(0);
}

strncpy(host,argv[1],999);
if(host[strlen(host)-1] == '-')
{
net_mode=1;
host[strlen(host)-1]=0x0;
}

if(net_mode==0)
{
sleep=calculate_sleep(host);
if(sleep < 500000 )
finderz(host);
}
else
for(i=1;i<256;i++)
{
sprintf(net,"%s%d",host,i);
sleep=calculate_sleep(net);
if(sleep < 500000)
finderz(net);
else
printf("Skipping (%s) appear to be down..\n",net);
}
}

void finderz(char *host)
{
struct sockaddr_in saddr;
struct hostent *h0zt;
struct timeval tv;
CLIENT *cl;
int flag=0;
int sd, portz=0;

h0zt = gethostbyname(host);
saddr.sin_family = AF_INET;
if(!h0zt)
{
if((saddr.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE)
{
printf ( "hozt not foundz!\n");
exit(0);
}
}

bcopy(h0zt->h_addr,(struct in_addr *)&saddr.sin_addr,h0zt->h_length);
saddr.sin_port = htons(portz);
sd = RPC_ANYSOCK;
tv.tv_sec = 0;
tv.tv_usec = 100;

if((cl = clnttcp_create(&saddr,SADMIN_PROGRAM,SADMIN_VERSION,&sd, 0, 0)) == NULL)
printf("Sadmind not founded at (%s) on TCP MODE shit!!@#!\n",host);
else
flag=1;
if(flag==0)
if((cl = clntudp_create(&saddr, SADMIN_PROGRAM, SADMIN_VERSION, tv, &sd)) == NULL)
printf("Sadmind not founded at (%s) on UDP MODE shit!#@$\n",host);
else
flag=1;

if(flag==1)
{
printf ("Sadmind Running found at (%s) on %d portz, YEAH#@$!@!\n",host,ntohs(saddr.sin_port));
clnt_destroy(cl);
}
}


unsigned long calculate_sleep(char *host) {
struct timeval begin, end;
int sd;
struct sockaddr_in sock;
int res;

if ((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
{perror("Socket troubles"); exit(1);}

sock.sin_family = AF_INET;
sock.sin_addr.s_addr = inet_addr(host);
sock.sin_port = htons((random()%65535));

gettimeofday(&begin, NULL);
if ((res = connect(sd, (struct sockaddr *) &sock,
sizeof(struct sockaddr_in))) != -1)
fprintf(stderr, "WARNING: You might want to use a different value of -g (or change o.magic_port in the include file), as it seems to be listening on the target host!\n");
close(sd);
gettimeofday(&end, NULL);
if (end.tv_sec - begin.tv_sec > 5 ) /*uh-oh!*/
return 0;
return (end.tv_sec - begin.tv_sec) * 1000000 + (end.tv_usec - begin.tv_usec);
}

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    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