Intimate contact with Yahoo China

xiaoxiao2021-03-06  43

Bqyahoo

What are you doing for us?

In essence, Bqyahoo just replaced some things you have made in other ways. For example, instead of logging in the mailbox, instead of downloading attachments. Then let's take a look, there is no help of bqyahoo, how should we do these things.

Step 1: Let's first come to the mail to log in to the web, enter your own username and password, and finally click Login.

Step 2: Enter the mailbox, but did not enter the inbox. At this time, you can't see the email, you can't download the attachment, you have to click the link to the inbox.

Step 3: Enter the inbox, this time you see the email, if you want to download the attachment, then you need to enter a specific message, then click the related link download attachment. However, for Bqyahoo, everything is over. Now this eate, even the procedure should pay attention to intelligence, in fact, the source code of the inbox page has already told you more information. Bqyahoo analyzes this information and eventually calculates the download address of the attachment.

Next, explain how to explain how to log in and download attachments in Bqyahoo.

Choose a handful sword

When writing Bqyahoo, I always have exhaust a machine at the choice of class library. Sometimes there will be contradictory situations, if you use the A class library, then you can use the B library at the same time. In general, you should choose the class library provided by a company as much as possible, such as Microsoft.

In the process of logging in to email and download attachments, you have to use the HTTP library, because the interaction of Yahoo China Server is built on the HTTP protocol. Of course, you can also use Windows Sockets to encapsulate your own http library, don't think I am joking, I am doing this, I will do this (later in the article will mention why I do this).

There are currently a variety of HTTP libraries to choose from, and only the function libraries provided by Microsoft have the following four:

l MFC HTTP

l ATL Server HTTP

l Windows HTTP

l Windows Internet

The last type is used in Bqyahoo: Windows Internet. It is the lowest package in these function libraries, but I feel that the extra information is mostly used, and the additional information you need is very small. About the details of the Windows Internet Library, please read the MSDN, here only introduce the functions used in the source code and their related knowledge.

In order to use the Windows Internet Library, you must use the header file wininet.h and library file Wininet.LIB in the program.

In fact, in bqyahoo, a total of three functions in this library:

l Internetopen

l Internetopenurl

l InternetReadFile

how about it? Do you feel very refreshing?

/// This can be briefly introduced to the usage of the above three functions, depending on the situation. /

Alibaba, open the door

If I tell you, don't enter the username and password in IE, just calculate a URL according to the username, password, and other information on the login page, then enter the address bar of IE, you can log in to Yahoo Mail normally, you Do you feel possible?

In fact, you can try it, first enter the username and password (deliberately enter the wrong message), then click Login, Finally, you will see a string of very long URLs on the address bar. If you enter the correct username and password, you can't see this URL because IE will automatically jump to the mailbox, then you see is the URL of the mailbox. The source code of the web page can be obtained by the following source code.

Bool WebClient :: BeForelogin () // Enter the landing page

{

HSession = :: Internetopen ("BIQIONG", Internet_Open_Type_Preconfig, NULL, NULL, NULL;

Hconnect = :: Internetopenurl (hsession, beforloginurl.c_str (), null, null, connect_flag, null;

GetResponse ();

GetHead ();

Xlog.log ("Enter Land"); // Record Day Information

Xlog.log (HEAD);

Xlog.log (response);

IF (TestResponse () == false) Return False;

IF (strs, "showfolder? rb = inbox")! = null) Maybein = true; // Currently login success

Return True;

}

How is the key to the problem now how to calculate this URL? How does it generate? What information do you need?

At the time of login, Yahoo China will use the MD5 encrypted username and password. Ciphertext will verify on the server side and finalize your identity. The following Yahoo China's web source code may give you some revelations (... ... indicated to delete).