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

sockcheck.c

sockcheck.c
Posted Aug 17, 1999
Authored by BigDawg

Socks proxy scanner that checks for remote insecure Socks proxy servers.

tags | tool, remote, scanner
systems | unix
SHA-256 | 8ce197d5a738ffc65c131e01f2932c4c17aae8ef88984387bb0911cc7b3ded60

sockcheck.c

Change Mirror Download
/* Sockcheck.c By BigDawg dawg@nuthin.nu - [ http://www.rootshell.com/ ]
* Use: put a list of ips (one per line) in ips.in then run sockcheck.
* The list of unsecure socks servers will be saved to ips.out
* Compile: gcc sockcheck.c -o sockcheck
*
* [20:01] <Skeeter> put my name in the source ;)
*
* I'd like to say thanks to all who have helped me throughout the past years.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <ctype.h>
#include <arpa/inet.h>
extern int hexstr;
static int sockfd2;
int toscan = 0;
int gatenum = 0;
#define DEF_FILE "ips.in"
#define OUT_FILE "ips.out"
#define socktimeout 10
#define longtime 3000

int sigalrm_handler3(int sig)
{
close(sockfd2);
return;
}

int main()
{

FILE *in;
FILE *server_file;
int i;
time_t ct;
char *sockfile;
char sockip[1024];
sockfile = DEF_FILE;
printf("========================\n");
printf("sockcheck 0.3 by BigDawg\n");
printf("========================\n");
in = fopen(sockfile,"r");
while(fgets(sockip,80,in))
{
if(sockip[0] == '\0')
{
fclose(in);
exit(1);
}
sockip[strlen(sockip) -1] = '\0';
toscan++;
}

fclose(in);
printf("Loaded %i ips to scan\n",toscan);
printf("\n");
in = fopen(sockfile,"r");
while(fgets(sockip,80,in))
{
if(sockip[0] == '\0')
{
fclose(in);
exit(1);
}
sockip[strlen(sockip) -1] = '\0';
signal(SIGALRM, sigalrm_handler3);
alarm(socktimeout);
toscan--;
printf("Scanning %s (%i more to go)\r",sockip,toscan);
fflush(stdout);
printf(" \r");
sockcheck(sockip);
signal(SIGALRM, sigalrm_handler3);
alarm(longtime);
}
printf("Done checking!\n");
printf("%i unsecure socks servers found\n",gatenum);
fclose(in);
exit(1);
}

int sockcheck(char *host)
{
FILE *ips;
int s = 1000;
int d;
int r;
int e;
int f;
int i = 0;
int c;
char keystring[] = {0x04, 0x01, 0x1A, 0x0B, 0xC7,
0x02, 0xD2, 0xF1, 0x62, 0x6C,
0x61, 0x68, 0x74, 0x65, 0x73, 0x74, 0x00};
char hexstr[20];
char tmpstr2[20] = "\0\0\0\0\0\0";
char buf[20];
fd_set gateset;
struct timeval tv;
struct in_addr MyHostAddr;
struct hostent *he;
struct sockaddr_in sin;
sockfd2 = socket(AF_INET, SOCK_STREAM, 0);
sin.sin_family = AF_INET;
sin.sin_port = htons(1080);
sin.sin_addr.s_addr = inet_addr(host);
if(sin.sin_addr.s_addr == INADDR_NONE)
{
he = gethostbyname(host);
if(!he)
{
close(sockfd2);
return;
}
memcpy(&sin.sin_addr, he->h_addr, he->h_length);
}
signal(SIGALRM, sigalrm_handler3);
alarm(socktimeout);
e = connect(sockfd2, (struct sockaddr *)&sin, sizeof(sin));
if (e < 0)
{
close(sockfd2);
return;
}
signal(SIGALRM, sigalrm_handler3);
alarm(longtime);
FD_ZERO(&gateset);
FD_SET(sockfd2, &gateset);
tv.tv_sec = 10;
tv.tv_usec = 0;
d = select(sockfd2+1, NULL, &gateset, NULL, &tv);
if(d == 0)
{
close(sockfd2);
return;
}
send(sockfd2, keystring, 17, 0);
tv.tv_sec = 10;
tv.tv_usec = 0;
f = select(sockfd2+2, &gateset, NULL, NULL, &tv);
if (f)
{
read(sockfd2, tmpstr2, 10);
strcpy(hexstr, "HEX:");
sprintf(buf, "%d ", tmpstr2[i]);
strcat(hexstr, buf);
if((tmpstr2[0] == 0x00)&&(tmpstr2[1] == 0x5a)&&(tmpstr2[2] == 0x00))
{
close(sockfd2);
gatenum++;
printf("Unsecure socks server found on %s (server #%i) (%i left to scan)\n",host,gatenum,toscan);
ips = fopen(OUT_FILE,"a");
fputs(host, ips);
fputs("\n", ips);
fclose(ips);
return;
}
close(sockfd2);
return;
}
}
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
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 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