import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
public class XiaomiLogin {
public static void main(String[] args) throws URISyntaxException,
ClientProtocolException, IOException, NoSuchAlgorithmException,
KeyStoreException, KeyManagementException {
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
CookieStore cookieStore = new BasicCookieStore();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
builder.build());
RequestConfig globalConfig = RequestConfig.custom()
.setCookieSpec(CookieSpecs.DEFAULT).build();
CloseableHttpClient httpclient = HttpClients.custom()
.setSSLSocketFactory(sslsf)
.setDefaultRequestConfig(globalConfig)
.setDefaultCookieStore(cookieStore).build();
URI uri = new URIBuilder()
.setScheme("https")
.setHost("uac.10010.com")
.setPath("/portal/Service/MallLogin")
.setParameter(
"callback",
"jQuery172018417995200171355_"
+ Long.toString(System.currentTimeMillis()))
.setParameter("redirectURL", "http://www.10010.com")
.setParameter("_", Long.toString(System.currentTimeMillis()))
.setParameter("password", "XXXXXX")
.setParameter("productType", "01")
.setParameter("pwdType", "01")
.setParameter("redirectType", "01")
.setParameter("rememberMe", "1")
.setParameter("userName", "186*****56").build();
System.out.println(uri);
HttpGet get = new HttpGet(uri);
get.addHeader("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
get.addHeader("Accept-Language", "en-US,en;q=0.5");
get.addHeader("Accept-Encoding", "gzip, deflate");
get.addHeader(
"User-Agent",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.4) Gecko/20150509 Firefox/31.9 PaleMoon/25.4.1");
get.addHeader("Connection", "Keep-Alive");
CloseableHttpResponse response = httpclient.execute(get);
try {
HttpEntity entity = response.getEntity();
System.out.println(EntityUtils.toString(entity));
// Header[] headers = response.getAllHeaders();
// for (Header header : headers) {
// System.out
// .println(header.getName() + " : " + header.getValue());
// }
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
response.close();
}
System.out
.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
System.out.println();
URI uri2 = new URIBuilder().setScheme("http").setHost("iservice.10010.com")
.setPath("/e3/query/call_dan.html")
.setParameter("menuId", "000100030001").build();
System.out.println(uri2);
HttpGet get1 = new HttpGet(uri2);
get1.addHeader(
"Accept",
"application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*");
get1.addHeader("Accept-Language", "en-US");
get1.addHeader("Accept-Encoding", "gzip, deflate");
get1.addHeader(
"User-Agent",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.4) Gecko/20150509 Firefox/31.9 PaleMoon/25.4.1");
get1.addHeader("Connection", "Keep-Alive");
CloseableHttpResponse response1 = httpclient.execute(get1);
System.out.println(response1.getStatusLine());
HttpEntity entity = response1.getEntity();
System.out.println(EntityUtils.toString(entity));
}
}
import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
public class XiaomiLogin {
public static void main(String[] args) throws URISyntaxException,
ClientProtocolException, IOException, NoSuchAlgorithmException,
KeyStoreException, KeyManagementException {
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
CookieStore cookieStore = new BasicCookieStore();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
builder.build());
RequestConfig globalConfig = RequestConfig.custom()
.setCookieSpec(CookieSpecs.DEFAULT).build();
CloseableHttpClient httpclient = HttpClients.custom()
.setSSLSocketFactory(sslsf)
.setDefaultRequestConfig(globalConfig)
.setDefaultCookieStore(cookieStore).build();
URI uri = new URIBuilder()
.setScheme("https")
.setHost("uac.10010.com")
.setPath("/portal/Service/MallLogin")
.setParameter(
"callback",
"jQuery172018417995200171355_"
+ Long.toString(System.currentTimeMillis()))
.setParameter("redirectURL", "http://www.10010.com")
.setParameter("_", Long.toString(System.currentTimeMillis()))
.setParameter("password", "XXXXXX")
.setParameter("productType", "01")
.setParameter("pwdType", "01")
.setParameter("redirectType", "01")
.setParameter("rememberMe", "1")
.setParameter("userName", "186*****56").build();
System.out.println(uri);
HttpGet get = new HttpGet(uri);
get.addHeader("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
get.addHeader("Accept-Language", "en-US,en;q=0.5");
get.addHeader("Accept-Encoding", "gzip, deflate");
get.addHeader(
"User-Agent",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.4) Gecko/20150509 Firefox/31.9 PaleMoon/25.4.1");
get.addHeader("Connection", "Keep-Alive");
CloseableHttpResponse response = httpclient.execute(get);
try {
HttpEntity entity = response.getEntity();
System.out.println(EntityUtils.toString(entity));
// Header[] headers = response.getAllHeaders();
// for (Header header : headers) {
// System.out
// .println(header.getName() + " : " + header.getValue());
// }
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
response.close();
}
System.out
.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
System.out.println();
URI uri2 = new URIBuilder().setScheme("http").setHost("iservice.10010.com")
.setPath("/e3/query/call_dan.html")
.setParameter("menuId", "000100030001").build();
System.out.println(uri2);
HttpGet get1 = new HttpGet(uri2);
get1.addHeader(
"Accept",
"application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*");
get1.addHeader("Accept-Language", "en-US");
get1.addHeader("Accept-Encoding", "gzip, deflate");
get1.addHeader(
"User-Agent",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.4) Gecko/20150509 Firefox/31.9 PaleMoon/25.4.1");
get1.addHeader("Connection", "Keep-Alive");
CloseableHttpResponse response1 = httpclient.execute(get1);
System.out.println(response1.getStatusLine());
HttpEntity entity = response1.getEntity();
System.out.println(EntityUtils.toString(entity));
}
}