/*C Program Crack URL for educational purposes only*/
#include <windows.h>
#include <Wininet.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char** argv)
{
if (argc > 1)
{
URL_COMPONENTS urlComp;
char* protocol = NULL, *hostname = NULL, *path = NULL, *query = NULL;
memset (&urlComp, 0, sizeof (urlComp));
urlComp.dwStructSize = sizeof (urlComp);
urlComp.dwHostNameLength = -1;
urlComp.dwSchemeLength = -1;
urlComp.dwUrlPathLength = -1;
urlComp.dwExtraInfoLength = -1;
if (InternetCrackUrl (argv[1], strlen (argv[1]), 0, &urlComp))
{
protocol = calloc (1 + urlComp.dwSchemeLength, 1);
hostname = calloc (1 + urlComp.dwHostNameLength, 1);
path = calloc (1 + urlComp.dwUrlPathLength, 1);
query = calloc (1 + urlComp.dwExtraInfoLength, 1);
strncpy (protocol, urlComp.lpszScheme, urlComp.dwSchemeLength);
strncpy (hostname, urlComp.lpszHostName, urlComp.dwHostNameLength);
strncpy (path, urlComp.lpszUrlPath, urlComp.dwUrlPathLength);
strncpy (query, urlComp.lpszExtraInfo, urlComp.dwExtraInfoLength);
printf ("URL : %s\n\n", argv[1]);
printf ("Protocol : %s\n", protocol);
printf ("Hostname : %s\n", hostname);
printf ("Port : %d\n", urlComp.nPort);
printf ("Path : %s\n", path);
printf ("Query : %s\n", query);
}
else
{
printf ("Error: Please enter valid URL, Like: http://www.example.dz/");
exit (0);
}
}
else
{
printf ("Crack URL Tool Using Win32 API, Coded By NULL_Pointer, Home: www.sec4ever.com\n\n");
printf ("Usage: %s URL\nExample: %s http://www.example.com/index.php?foo=bar\n", argv[0], argv[0]);
exit (0);
}
return 0;
}