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

gateprobe.c

gateprobe.c
Posted Aug 17, 1999
Authored by Bong

Gateprobe.c is a fast Wingate scanner that can quickly run through an entire class B or C subnet. Includes command line options for connection timeouts, and number of child processes spawned.

tags | tool, scanner
SHA-256 | 88eb8e6782d5e5e409dd2c8fb921ffa3ffe2d59163ed250e12bb20d8bea9ce8b

gateprobe.c

Change Mirror Download
/*
Gateprobe.c by Bong bong26@hotmail.com
This is a wingate scanner that scan on class B and C.
You can specify the number of children and
the timeout of connection.
The code is inspired by Soup Scanner of aempirei.
The probe is my first code. I made it because I found
that the old Wingate seeker sux. Have fun...
PS: do not put to many children for class B scan,
if you don't work crash ;)
*/

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <netdb.h>
#include <errno.h> /* forgot a header, eh? -- jkw */

#define SA struct sockaddr
#define SIN_LEN sizeof(struct sockaddr_in)
#define IPV4_ADDRLEN 16

void ShowHelp(char *, char *);

int ConnectCheck(struct sockaddr_in, int, int);
const char *ipv4_ntop(int, const void *, char *, size_t);
const char *ipv4_showname(int , const void *, char *, size_t);

int main(int argc, char *argv[]) {
int i,j=0,status,Children=128,Timeout=7,Resolve=0,class=0;
char DestIP[15],*NetworkID,c,*num3;
struct sockaddr_in DestAddress;
if(argc < 3) ShowHelp(argv[0], "");
NetworkID = argv[1];
num3=argv[2];
class=atoi(num3);
opterr = 0;
while((c = getopt(argc, argv, "Rp:C:t:")) != -1) {
switch(c) {
case 'R': Resolve = -1; break;
case 'C': Children = atoi(optarg); break;
case 't': Timeout = atoi(optarg); break;
case '?': ShowHelp(argv[0], "ERROR: unrecognized option"); break;
}
}
if(Children < 1) ShowHelp(argv[0], "ERROR: invalid number of children");
if(Timeout < 1) ShowHelp(argv[0], "ERROR: invalid timeout");
if (class==1)
fprintf(stderr, "Scanning %s.*.*:23 children:%i, timeout:%i\n\n",
NetworkID,Children, Timeout);
if (class==2)
fprintf(stderr, "Scanning %s.*:23 children:%i, timeout:%i\n\n",NetworkID, Children, Timeout);
DestAddress.sin_family = AF_INET;
DestAddress.sin_port = htons(23);
if (class==1){
for(j = 0; j < 256; j++) {
for(i = 0; i < Children; i++) {
sprintf(DestIP, "%s.%d.%d", NetworkID,j, i);
inet_aton(DestIP, &DestAddress.sin_addr);
if(!fork()) ConnectCheck(DestAddress, Timeout, Resolve);
}
for(i = Children + 1; i < 256; i++) {
wait(&status); /* wait till a child dies to make another */
sprintf(DestIP, "%s.%d.%d", NetworkID,j, i);
inet_aton(DestIP, &DestAddress.sin_addr);
if(!fork()) ConnectCheck(DestAddress, Timeout, Resolve);
}
}
}
if (class==2){
for(i = 0; i < Children; i++) {
sprintf(DestIP, "%s.%d", NetworkID, i);
inet_aton(DestIP, &DestAddress.sin_addr);
if(!fork()) ConnectCheck(DestAddress, Timeout, Resolve);
}
for(i = Children + 1; i < 256; i++) {
wait(&status); /* wait till a child dies to make another */
sprintf(DestIP, "%s.%d", NetworkID, i);
inet_aton(DestIP, &DestAddress.sin_addr);
if(!fork()) ConnectCheck(DestAddress, Timeout, Resolve);
}
for(;;) {
if((waitpid(-1, &status, WNOHANG) == -1) && (errno == ECHILD))
exit(EXIT_SUCCESS);
}
}
}

int ConnectCheck(struct sockaddr_in DestAddr, int Timeout, int Resolve)
{
int result,ret,SocketFD;
char Hostname[60],buffer1[64];
if((SocketFD = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit (EXIT_FAILURE);
alarm(Timeout);
result = connect(SocketFD, (SA *)&DestAddr, SIN_LEN);
if (!result) {
alarm(Timeout);
memset(buffer1, '\0', 64);
if ((ret = read(SocketFD, buffer1, 64)) > 0)
{
ret = read(SocketFD, buffer1, 64);
if(!(memcmp(buffer1, "WinGate>", 8)) ||
!(memcmp(buffer1, "Too man", 7)))
{
printf("Wingate found: %s\n\a",ipv4_ntop(AF_INET,&DestAddr.sin_addr.s_addr,Hostname,59));
}}
close(SocketFD);
}

exit(EXIT_SUCCESS);
}

const char *
ipv4_ntop(int family, const void *addrptr, char *strptr, size_t len) {
const u_char *p = (const u_char *)addrptr;
if(family == AF_INET) {
char temp[IPV4_ADDRLEN];
snprintf(temp, sizeof(temp), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
if(strlen(temp) >= len) {
errno = ENOSPC;
return(NULL);
}
strcpy(strptr, temp);
return(strptr);
}
errno = EAFNOSUPPORT;
return(NULL);
}

const char *
ipv4_showname(int family, const void *addrptr, char *strptr, size_t len) {
struct hostent *hentry;
size_t aflen;
if(family == AF_INET) aflen = 4;
else {
errno = EAFNOSUPPORT;
return(NULL);
}
if((hentry = gethostbyaddr(addrptr, aflen, family)) != NULL) {
if(strlen(hentry->h_name) < len) {
strcpy(strptr, hentry->h_name);
return(strptr);
}
}

return(ipv4_ntop(family, addrptr, strptr, len));
}

void ShowHelp(char *argv0, char *ErrMsg) {
printf("\nBong Wingate scanner 2.0\n");
printf("Usage: %s <network> <class> [option]\n",argv0);
printf(" class: 1 \tclass b network ID <X.X> \n");
printf(" 2 \tclass c network ID <X.X.X> \n");
printf(" [-C <children>]\tmaximum simultaneous children\n");
printf(" [-t <timeout>] \tseconds before connection timeout\n\n");
exit (EXIT_FAILURE);
}
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
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 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