MCPcopy Create free account
hub / github.com/achuna33/MYExploit / Connect

Method Connect

src/main/java/com/achuna33/Utils/HttpRequest.java:40–77  ·  view source on GitHub ↗
(String Method,Object body,Boolean IsHttps)

Source from the content-addressed store, hash-verified

38 return true;
39 }
40 public Response Connect(String Method,Object body,Boolean IsHttps) {
41
42 try {
43 if (IsHttps) {
44 if (proxy!=null){
45 Httpsconn = (HttpsURLConnection) realUrl.openConnection(proxy);
46
47 }else {
48 Httpsconn = (HttpsURLConnection) realUrl.openConnection();
49
50 }
51 Httpsconn.setRequestMethod(Method);
52 //信任所有ssl证书和主机
53 TrustManager[] trustManagers = {new HttpsTrustManager()};
54 SSLContext context = SSLContext.getInstance("TLS");
55 context.init(null, trustManagers, new SecureRandom());
56 Httpsconn.setSSLSocketFactory(context.getSocketFactory());
57 Httpsconn.setHostnameVerifier(new HostnameVerifier() {
58 @Override
59 public boolean verify(String hostname, SSLSession session) {
60 return true;
61 }
62 });
63 return SendRequest(Httpsconn,body);
64 } else {
65 if (proxy!=null){
66 httpconn = (HttpURLConnection) realUrl.openConnection(proxy);
67 }else {
68 httpconn = (HttpURLConnection) realUrl.openConnection();
69 }
70 // 打开和URL之间的连接
71 httpconn.setRequestMethod(Method);
72 return SendRequest(httpconn,body);
73 }
74 }catch (Exception e){
75 return null;
76 }
77 }
78 public Response SendRequest(HttpURLConnection Conn,Object body) throws IOException {
79 BufferedReader in = null;
80 String result = "";

Callers 3

GetMethod · 0.95
PostMethod · 0.95
vul_SpringGatewaySPELMethod · 0.95

Calls 3

SendRequestMethod · 0.95
openConnectionMethod · 0.80
initMethod · 0.80

Tested by

no test coverage detected