[Multi-thread data collection] java captures data + cracking shields ip Access

Source: Internet
Author: User

Java captures data + crack and shield ip Access
Today, I will explain how to crack the server's request to shield ip addresses.
Currently, most websites block the ip address function when ip addresses are accessed for a certain number of times.
The server shield should be cracked. Only the ip address or proxy ip address is changed.
If a proxy is used, where can I find so many ip addresses. Isn't it easy to get Dynamic IP addresses using adsl.
Now we can paste the adsl solution to obtain the dynamic IP address source code.

1. When a catch exception occurs while capturing webpage data, the dialing program is used.
[Java]
// Url parameters for ticket viewing
Public static DataBean getWebData1 (String url ){
DataBean data = null;
Try {
Document docdata = Jsoup. connect (url). timeout (20000). get ();

} Catch (Exception e ){
E. printStackTrace ();
// Dial
ConnectAdslNet. reconnectAdsl ("Broadband", Main. adslname, Main. adslpass );
}
Return data;
}


2. Tools for getting Dynamic IP addresses by dialing
[Java]
Import java. io. BufferedReader;
Import java. io. InputStreamReader;
 
Import org. apache. log4j. Logger;
 
/**
*
* ADSL dial-up Internet access
* The Windwos operating system must be GBK encoded.
* @ Author yijianfeng
*
*/
 
Public class ConnectAdslNet {
Static Logger logger = Logger. getLogger (ConnectAdslNet. class );

/**
* Run the CMD command and return the String.
*/
Public static String executeCmd (String strCmd) throws Exception {
Process p = runtime.getruntime(cmd.exe c ("cmd/c" + strCmd );
StringBuilder sbCmd = new StringBuilder ();

// Pay attention to GBK Encoding
BufferedReader br = new BufferedReader (new InputStreamReader (p
. GetInputStream (), "GBK "));
String line;
While (line = br. readLine ())! = Null ){
SbCmd. append (line + "\ n ");
}
Return sbCmd. toString ();
}

/**
* Connect to ADSL
*/
Public static boolean connectAdsl (String adslTitle, String adslName, String adslPass) throws Exception {
System. out. println ("establishing connection .");
String adslCmd = "rasdial" + adslTitle + "" + adslName + ""
+ AdslPass;
String tempCmd = executeCmd (adslCmd );

// Determine whether the connection is successful
If (tempCmd. indexOf ("connected")> 0 ){
System. out. println ("Connection established successfully .");
Return true;
} Else {
System. out. println (tempCmd );
System. out. println ("failed to establish a connection ");
Return false;
}
}

/**
* Disconnect ADSL
*/
Public static boolean disconnectAdsl (String adslTitle) throws Exception {
String disconnectAdsl = "rasdial" + adslTitle + "/disconnect ";
String result = executeCmd (disconnectAdsl );

If (result. indexOf ("no connection ")! =-1 ){
System. out. println (adslTitle + "the connection does not exist! ");
Return false;
} Else {
System. out. println ("disconnected ");
Return true;
}
}

/**
* Re-dial adsl. Support for continuous redial failures
* @ Param args
* @ Throws Exception
*/
Public static boolean reconnectAdsl (String adslTitle, String adslName, String adslPass ){
Boolean bAdsl = false;
Try {
DisconnectAdsl (adslTitle );
Thread. sleep (3000 );
BAdsl = connectAdsl (adslTitle, adslName, adslPass );
Thread. sleep (3000 );
Int I = 0;
While (! BAdsl ){
DisconnectAdsl (adslTitle );
Thread. sleep (3000 );
BAdsl = connectAdsl (adslTitle, adslName, adslPass );
Thread. sleep (3000 );
If (I> 5 ){
Break;
}
}
} Catch (Exception e ){
Logger. error ("ADSL dialing exception:", e );
}

Return bAdsl;
}

Public static void main (String [] args) throws Exception {
// ReconnectAdsl ("Broadband", "adsl account", "password ");
}

}


The above method can basically solve the dialing problem.

If the program is added with multiple threads. You must consider multithreading, dial-up synchronization, and data synchronization. Improve efficiency and avoid repeated operations.

At this point, it's enough to crack and shield ip Access!

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.