Xmd5 c ++ query code

Source: Internet
Author: User

 

# Include <winsock2.h>

# Include <iostream. h>

# Include <windows. h>

# Include <wininet. h>

# Include <string. h>

# Include <stdio. h>

# Include <stdlib. h>

# Include <process. h>

# Include "string. h"

# Include <iostream. h>

# Pragma comment (lib, "WS2_32.lib ")

 

# Deprecision MAX 50000

Char str [1, 10000] [2, 5000];

Char string [10000] [5000];

Void readfile ();

Int num;

Void main ()

{

Int RET;

SOCKET SC;

WSADATA wsaData;

SOCKADDR_IN scAddr;

HOSTENT * ht;

Char Buffer [MAX] = {0 };

Printf ("******************* xmd5.com website md5 password query ************** * *** \ n ");

 

Readfile ();

 

FILE * fHtmlData;

If (fHtmlData = fopen ("d: \ save-xmd5.txt", "w") = NULL)

{Printf ("can not open file2 \ n"); exit (0 );}

// FHtmlData = fopen ("d: \ readweb.txt", "w ");

// Printf ("% d in total \ n", num );

// Char szPage [500] = "GET/getmd5api. aspx? Q = c75b7ef7915803f9 HTTP/1.1 \ r \ nHost: www.20.5.com \ r \ n ";

Printf ("\ nstart query and save the result to the save-xmd5.txt file in the ddisk root directory... \ n ");

 

For (int c = 0; c <num; c ++)

{Char Buffer [MAX] = {0 };

 

Char szPage [6000] = "\ 0 ";

// "GET/md5/md5check. asp? Md5pass = baf56627478ec76a HTTP/1.1 \ r \ n"

// "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd. ms-powerpoint, application/vnd. ms-excel, application/msword, */* \ r \ n"

// "Referer: http://www.xmd5.org/?r=n"

// "Accept-Language: zh-cn \ r \ n"

// "Accept-Encoding: gzip, deflate \ r \ n"

// "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com) \ r \ n"

// "Host: www.xmd5.org \ r \ n"

// "Connection: Keep-Alive \ r \ n"

// "Cookie: AJSTAT_ OK _times = 1; AJSTAT_ OK _pages = 47; AJSTAT_ OK _times = 1; ASPSESSIONIDQASCTSDD = Hangzhou; ASPSESSIONIDQATCSSDC = jndjigbb1_mdledelclenol \ r \ n"

// "\ R \ n ";

// Char szPage [1000] = "GET/md5/md5check. asp? Md5pass = eff9d7295bfc800a HTTP/1.1 \ r \ n Host: xmd5.org \ r \ n ";

// Char szPage [500] = "GET/showthread. php? T = 44643 HTTP/1.1 \ r \ nHost: bbs.pediy.com \ r \ n ";

 

Memset (string [c], '\ 0', sizeof (string ));

Strcpy (string [c], "GET/md5/md5check. asp? Md5pass = ");

Strcat (string [c], str [c]);

Strcat (string [c], "");

Strcat (string [c], "HTTP/1.1 \ r \ n ");

Strcat (string [c], "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd. ms-powerpoint, application/vnd. ms-excel, application/msword, */* \ r \ n ");

Strcat (string [c], "Referer: http://www.xmd5.org/#r\n ");

Strcat (string [c], "Accept-Language: zh-cn \ r \ n ");

Strcat (string [c], "Accept-Encoding: gzip, deflate \ r \ n ");

Strcat (string [c], "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; windows NT 5.1; SV1; http://bsalsa.com) \ r \ n ");

Strcat (string [c], "Host: www.xmd5.org \ r \ n ");

Strcat (string [c], "Connection: Keep-Alive \ r \ n ");

Strcat (string [c], "Cookie: AJSTAT_ OK _times = 1; AJSTAT_ OK _pages = 47; AJSTAT_ OK _times = 1; ASPSESSIONIDQASCTSDD = Hangzhou; ASPSESSIONIDQATCSSDC = Beijing \ r \ n ");

 

Strcat (string [c], "\ r \ n ");

Printf ("querying % s... \ n", str [c]);

 

Strcpy (szPage, string [c]);

 

WSAStartup (0x0202, & wsaData );

SC = WSASocket (AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0 );

Ht = gethostbyname ("www.xmd5.org ");

 

ScAddr. sin_port = htons (80 );

ScAddr. sin_family = AF_INET;

ScAddr. sin_addr.s_addr = * (unsigned long *) ht-> h_addr_list [0];

 

Connect (SC, (SOCKADDR *) & scAddr, sizeof (scAddr ));

Send (SC, szPage, lstrlen (szPage), 0 );

RET = recv (SC, Buffer, MAX, 0); // Let it return values to check whether the function is successfully called.

 

If (RET <1)

{Printf ("\ n server error, connection failed, press any key to exit \ n ");

Getchar ();

Exit (0 );

}

 

 

Printf ("Returned content % s: \ n", Buffer );

 

***************** ************//

 

// For (int I = 0; I <RET; I ++) // select the password answer and start writing the file;

//{

// Fputc (Buffer [I], fHtmlData );

//}

// Fputc ('\ n', fHtmlData );

// Delay. Wait for the page to appear. If it is too fast, you cannot use commview to re-build the HTML version of the TCP session.

Int m = 0;

While (Buffer [m]! = ')

{M = m + 1;

}

M = m + 1;

 

While (Buffer [m]! = 13)

{

Fputc (Buffer [m], fHtmlData );

M = m + 1;

}

Fputc ('\ n', fHtmlData );

// Fclose (fHtmlData );

Sleep (4000 );

WSACleanup ();

} // Large for loop;

 

 

Printf ("\ n query is complete. Press any key to exit. \ n ");

Getchar ();

Exit (0 );

} // Main () function

 

Void readfile ()

{Int m = 0;

Char ch;

FILE * fp1;

Printf ("Please input the md5 password txt file: \ n ");

Char str007 [500];

Gets (str007 );

 

If (fp1 = fopen (str007, "r") = NULL)

{Printf ("can not open file1 \ n"); exit (0 );}

 

Ch = fgetc (fp1 );

 

While (ch! = EOF)

{Int n = 0;

While (ch! = 10 & ch! = 13 & ch! = EOF)

{

Str [m] [n ++] = ch;

Ch = fgetc (fp1 );

} // Read a row

 

Str [m] [n] = '\ 0'; // read a row

// Printf ("% s \ n", str [m]);

M = m + 1;

Ch = fgetc (fp1); // read the next row

 

}

Num = m; // read the file

Printf ("% d total data: \ n", num );

 

For (int p = 0; p <m; p ++)

{Printf ("% s \ n", str [p]);

}

 

Fclose (fp1); // close the file

}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.