exploit the possibilities

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:

May 2022

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