Use the program to vote for the prize

Source: Internet
Author: User

A year ago, the website of Canon held a star baby selection activity, and determined the final star Baby Award through online voting and judges.

A colleague took part in this activity and started everyone to vote for her. Unfortunately, the speed of voting through the web page is very slow, and canon has a limit on the number of votes, A single IP Address can only cast 10 votes within 24 hours, and each vote, you must enter a verification code that is not available. After one vote, I found that these verification codes are pure numbers and are not dry. They should be automatically recognized by the program to achieve automatic voting without human intervention.

Without thinking about the step of automatic identification, the program found that the website had a backdoor, and quickly captured network data packets with Wireshark for analysis. It was originally a null value for the verification code to be sent, you can bypass the digital verification code.

Although there is a backdoor, it can only accelerate the voting speed, but it does not help the baby ranking. To maximize the number of votes, we must use a variety of proxy servers on the Internet. After careful analysis, I finally designed a comprehensive solution for the FreeBSD system architecture, this solution was able to run 24 hours a day. At that time, there was such an idle machine at hand, and the entire system was deployed on this idle machine.

Voting is mainly implemented in four ways:

I. use scripts to automatically switch IP addresses. My colleague borrowed 30 idle IP addresses, so I used shell scripts to control the machine to automatically switch its IP addresses to the 30 idle IP addresses at midnight every day, each time you switch to an IP address, you will receive 10 votes. Therefore, this method can cast a maximum of 310 tickets per day. For implementation details, see batch change the IP address of the FreeBSD host using shell scripts.


2. Configure Privoxy and Privoxy on the machine
Is an open-source anonymous proxy server network software. Each machine in the network is essentially a proxy server. After configuring Privoxy, my program only needs to regard the local machine as a proxy server and vote for the IP address of the local machine. This method is very simple, but after a period of trial, it is found that on average, only less than 1000 tickets can be cast per day.

III. This method uses shell scripts to help agents
And China proxy server network
Collect Proxy Server Information and start a process to send voting information to the collected server. If the voting information is successful, add the address to a list file. In this way, although hundreds of proxy server addresses are collected every day, less than 10% of the addresses are valid, so the number of votes per day exceeds 1000. Below is the part of the runtime:

It is very convenient to use shell scripts to extract information and format it. For example, I used to view the five major league scoring tables.
And download the YouTube video script
.

After the voting information is sent, the return information of the website adopts the UTF-8 encoding, in the terminal is unable to normally display these returned Chinese characters, the solution in UNIX is to use the iconv library to write a conversion function from UTF-8 to gb2312.
.

4: because the third method finds some available proxy server addresses every day and saves the valid addresses to a list file, the fourth method is to vote for the addresses in the list file.

Each proxy server can only cast 10 votes, and the performance between proxy servers is also different. Some can cast 10 votes, while others can only cast 1. Therefore, when added to the list, based on the number of votes successfully cast in the third method, I set an initial weight for each address. If the vote fails once in the future, the weight is reduced by 1, and the vote succeeds once. The weight is increased by 1, if the weight is 0, the address is automatically deleted from the list. Prior to each vote, the proxy servers in this list are sorted by weight, starting from the address of the proxy server with a high weight.

In fact, almost all of the final 0.35 million tickets are delivered using this method. As the list file grows, the number of votes reported per day has stabilized at more than 10000 in the last period.

This part runs:


The entire solution is to use these four methods for voting. All the voting code is completed using C/C ++, and the rest is completed using shell scripts.

However, the website quickly blocked the backdoor and changed the verification code from a pure number to a Chinese character. Therefore, there were only over 0.35 million votes, and online voting was only a reference, the final result was decided by the judges. Finally, my colleague's baby won only the third prize. Is the award certificate received by a colleague:

 

 

 

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.