Mineplex2018-withcommit/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java

66 lines
2.4 KiB
Java
Raw Normal View History

package mineplex.ddos;
2014-07-08 01:25:49 +02:00
import java.util.ArrayList;
import java.util.List;
import com.google.gson.reflect.TypeToken;
import mineplex.ddos.api.ApiGetCall;
import mineplex.ddos.api.ApiPostCall;
import mineplex.ddos.api.token.ARecord;
import mineplex.ddos.api.token.DnsRecord;
import mineplex.ddos.api.token.DomainRecords;
public class DDoSProtectionSwitcher
{
public static void main (String args[])
{
2014-07-08 01:25:49 +02:00
/*
List<ARecord> records = new ArrayList<ARecord>();
records.add(new ARecord("us2", "108.178.20.166", 300));
records.add(new ARecord("us2", "108.163.217.110", 300));
records.add(new ARecord("us2", "108.178.34.142", 300));
records.add(new ARecord("us2", "108.163.254.134", 300));
records.add(new ARecord("us2", "108.163.216.250", 300));
records.add(new ARecord("us2", "108.163.216.106", 300));
records.add(new ARecord("us2", "184.154.215.170", 300));
records.add(new ARecord("us2", "96.127.174.206", 300));
records.add(new ARecord("us2", "184.154.127.10", 300));
records.add(new ARecord("us2", "96.127.174.146", 300));
records.add(new ARecord("us2", "108.178.7.206", 300));
records.add(new ARecord("us2", "184.154.39.146", 300));
records.add(new ARecord("us2", "108.163.217.250", 300));
records.add(new ARecord("us2", "69.175.15.242", 300));
records.add(new ARecord("us2", "107.6.129.126", 300));
records.add(new ARecord("us2", "108.163.222.174", 300));
records.add(new ARecord("us2", "108.178.34.118", 300));
records.add(new ARecord("us2", "69.175.4.38", 300));
records.add(new ARecord("us2", "107.6.158.78", 300));
records.add(new ARecord("us2", "184.154.13.118", 300));
2014-07-08 01:25:49 +02:00
new ApiPostCall("http://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, "/records/", "createMulti").Execute(records);
*/
DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, "/records", "").Execute(DomainRecords.class);
List<DnsRecord> recordsToDelete = new ArrayList<DnsRecord>();
// Switch off ddos protection
for (DnsRecord record : records.data)
{
2014-07-08 01:25:49 +02:00
if (record.type.equalsIgnoreCase("CNAME"))
{
2014-07-08 01:25:49 +02:00
if (record.name.equalsIgnoreCase("eu"))
recordsToDelete.add(record);
}
}
2014-07-08 01:25:49 +02:00
// Remove CNAME record for eu to us
// Loop through and update us to neustar, us2 to us, eu2 to us.
// Loop through and update us to us2, eu to eu2 and neustar to us.
// Add CNAME record for eu to us
return;
}
}