added files.
This commit is contained in:
commit
f93cc6b887
1166 files changed
+142532
No files matched your search
@@ -0,0 +1,12 @@
|
||||
package xyz.refinedev.phoenix.antivpn.api;
|
||||
|
||||
import xyz.refinedev.lib.jetbrains.Nullable;
|
||||
import xyz.refinedev.phoenix.profile.antivpn.IAntiVPNData;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface IAntiVPNProvider {
|
||||
|
||||
@Nullable
|
||||
IAntiVPNData check(UUID uUID, String text);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package xyz.refinedev.phoenix.antivpn.api.impl;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import xyz.refinedev.phoenix.CommonPlatform;
|
||||
import xyz.refinedev.phoenix.antivpn.api.IAntiVPNProvider;
|
||||
import xyz.refinedev.phoenix.profile.antivpn.AntiVPNData;
|
||||
import xyz.refinedev.phoenix.profile.antivpn.IAntiVPNData;
|
||||
import xyz.refinedev.phoenix.utils.HttpUtils;
|
||||
import xyz.refinedev.phoenix.utils.JsonParser;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class AntiVPNProvider implements IAntiVPNProvider {
|
||||
|
||||
private final CommonPlatform platform;
|
||||
|
||||
private final String text;
|
||||
|
||||
@Override
|
||||
public IAntiVPNData check(UUID uUID, String text2) {
|
||||
String text3 = this.platform.getHashHandler().hash(text2);
|
||||
String text4;
|
||||
if ((text4 =
|
||||
HttpUtils.get(
|
||||
"https://proxycheck.io/v2/"
|
||||
+ text2
|
||||
+ "?key="
|
||||
+ this.text
|
||||
+ "&vpn=1&asn=1"))
|
||||
== null) {
|
||||
return null;
|
||||
}
|
||||
JsonObject jsonObject;
|
||||
boolean matches =
|
||||
(jsonObject =
|
||||
JsonParser.findJsonElement(text4)
|
||||
.getAsJsonObject()
|
||||
.getAsJsonObject(text2))
|
||||
.get("proxy")
|
||||
.getAsString()
|
||||
.equalsIgnoreCase("yes")
|
||||
|| jsonObject.get("type").getAsString().equalsIgnoreCase("VPN");
|
||||
AntiVPNData antiVPNData;
|
||||
(antiVPNData = new AntiVPNData(uUID, text3)).setCity(jsonObject.get("city").getAsString());
|
||||
antiVPNData.setIsp(jsonObject.get("provider").getAsString());
|
||||
antiVPNData.setCountry(jsonObject.get("country").getAsString());
|
||||
antiVPNData.setRegion(jsonObject.get("continent").getAsString());
|
||||
antiVPNData.setVpn(matches);
|
||||
antiVPNData.setMobile(
|
||||
jsonObject.has("type")
|
||||
&& jsonObject.get("type").getAsString().equalsIgnoreCase("Mobile"));
|
||||
return antiVPNData;
|
||||
}
|
||||
|
||||
public AntiVPNProvider(CommonPlatform commonPlatform, String text) {
|
||||
this.platform = commonPlatform;
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package xyz.refinedev.phoenix.antivpn.provider;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import xyz.refinedev.phoenix.CommonPlatform;
|
||||
import xyz.refinedev.phoenix.antivpn.api.IAntiVPNProvider;
|
||||
import xyz.refinedev.phoenix.profile.antivpn.AntiVPNData;
|
||||
import xyz.refinedev.phoenix.profile.antivpn.IAntiVPNData;
|
||||
import xyz.refinedev.phoenix.utils.HttpUtils;
|
||||
import xyz.refinedev.phoenix.utils.JsonParser;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class IpRiskProvider implements IAntiVPNProvider {
|
||||
|
||||
private final CommonPlatform platform;
|
||||
|
||||
@Override
|
||||
public IAntiVPNData check(UUID uUID, String text) {
|
||||
String text2 = this.platform.getHashHandler().hash(text);
|
||||
String text3;
|
||||
if ((text3 = HttpUtils.get("https://beta.iprisk.info/v1/" + text)) == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JsonObject jsonObject;
|
||||
boolean matches =
|
||||
(jsonObject = JsonParser.findJsonElement(text3).getAsJsonObject())
|
||||
.get("data_center")
|
||||
.getAsBoolean()
|
||||
|| jsonObject.get("public_proxy").getAsBoolean()
|
||||
|| jsonObject.get("tor_exit_relay").getAsBoolean();
|
||||
AntiVPNData antiVPNData;
|
||||
(antiVPNData = new AntiVPNData(uUID, text2))
|
||||
.setCity(
|
||||
jsonObject.get("city_name") != null
|
||||
? jsonObject.get("city_name").getAsString()
|
||||
: "N/A");
|
||||
antiVPNData.setIsp(
|
||||
jsonObject.get("autonomous_system_organization") != null
|
||||
? jsonObject.get("autonomous_system_organization").getAsString()
|
||||
: "N/A");
|
||||
antiVPNData.setCountry(
|
||||
jsonObject.get("country_name") != null
|
||||
? jsonObject.get("country_name").getAsString()
|
||||
: "N/A");
|
||||
antiVPNData.setRegion(
|
||||
jsonObject.get("region_name") != null
|
||||
? jsonObject.get("region_name").getAsString()
|
||||
: "N/A");
|
||||
antiVPNData.setVpn(matches);
|
||||
return antiVPNData;
|
||||
} catch (Exception exception) {
|
||||
this.platform
|
||||
.getLogger()
|
||||
.log(
|
||||
Level.SEVERE,
|
||||
"There was an error while performing the AntiVPN Check: ",
|
||||
exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public IpRiskProvider(CommonPlatform commonPlatform) {
|
||||
this.platform = commonPlatform;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user