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

httpscan.c

httpscan.c
Posted Oct 12, 1999
Authored by Skemet

Httpscan scans web servers for version and server type. Takes input from a file.

tags | web, cgi
systems | unix
SHA-256 | 5fdfcdbd60b9eea2e183242dbd37f82e4922ef1bd99752f303299b7190154df3

httpscan.c

Change Mirror Download
/*
This is just a little proggie to scan the www server for their
server type and version.

I cannot and will not be held responsible nor legally bound for the
malicious activities of individuals who come into possession of this

[03.10.99] - v1.02 some lame segmentation faults fixed :\
[20.09.99] - v1.01 added the option for mass scan

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>

#define ERROR -1
#define MAXDATASIZE 300
#define MESSAGE "HEAD / HTTP/1.0\n\n"
#define DATE "[03.10.99]"

/* Function prototypes */
char *GetHTTP(int s,char *,int port);

/* Global Vars */

char buf[MAXDATASIZE];
char message[] = MESSAGE;


void main(int argc,char *argv[])
{
/*** SOCKET VARIABLES ***/
int s;
/*** TARGET VARIABLES ***/
FILE *in;
char buffer[50],result[50];
int i=0,port=80;



if ((argc >=5) || (argc<=1))
{
printf("\nHttpScan v1.02\n");
printf("\nCoded By SkeMet");
printf("\n%s",DATE);
printf("\n\nusage: %s ip\n %s -f ipfile\n\n",argv[0],argv[0]);
exit(0);
};


port=atoi(argv[2]);

if (argc==4)
{
if ((in=fopen(argv[2], "r+"))==NULL)
{
printf("Error: Unable to open IP file\n");
exit(1);
};

while (!feof(in))
{
fscanf(in,"%s",buffer);

if ((s=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
printf("ERROR: socket() failed\n");
exit(0);
};
printf("\nServer: %s\n",buffer);
printf("%s",GetHTTP(s,buffer,port));

};
}
else
{
if ((s=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
printf("ERROR: socket() failed\n");
exit(0);
};

printf("SERVER: %s\n",argv[1]);
printf("%s",GetHTTP(s,argv[1]));
}

printf("\nCoded by Skemet, U might fool many people but U can't fool your self!\n\n");
};

char *GetHTTP(int s,char *host)
{
char *p;
int i;
int numbytes;
struct sockaddr_in sock;
struct hostent *he;


if ((he=gethostbyname(host)) == NULL)
{
perror("gethostbyname()");
exit(1);
}

sock.sin_family = AF_INET;
sock.sin_port = htons(port);
sock.sin_addr = *((struct in_addr *)he->h_addr);
bzero(&(sock.sin_zero), 8);

if (connect(s, (struct sockaddr *)&sock, sizeof(struct sockaddr)) == ERROR)
{
perror("connect()");
}
else
if ((send(s, message, strlen(message), 0)) == ERROR)
{
perror("send()");
}
else
if ((numbytes=recv(s, buf, MAXDATASIZE, 0)) == ERROR)
{
perror("recv()");
}

close(s);
return buf;
}

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