mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-07 00:38:28 +00:00
[BUGFIX] Generating random UUID
Also reformatted the code
This commit is contained in:
@@ -12,10 +12,9 @@ import org.parabot.environment.randoms.RandomType;
|
|||||||
*/
|
*/
|
||||||
public class AntiDetector implements Random, Runnable {
|
public class AntiDetector implements Random, Runnable {
|
||||||
|
|
||||||
private boolean activated;
|
|
||||||
|
|
||||||
private final String[] toBeNull = { "P", "Q", "N" };
|
private final String[] toBeNull = { "P", "Q", "N" };
|
||||||
private final String className = "cb";
|
private final String className = "cb";
|
||||||
|
private boolean activated;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package org.parabot.randoms.locopk;
|
|||||||
|
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.core.asm.ASMClassLoader;
|
import org.parabot.core.asm.ASMClassLoader;
|
||||||
|
import org.parabot.environment.OperatingSystem;
|
||||||
import org.parabot.environment.randoms.Random;
|
import org.parabot.environment.randoms.Random;
|
||||||
import org.parabot.environment.randoms.RandomType;
|
import org.parabot.environment.randoms.RandomType;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author EmmaStone
|
* @author EmmaStone
|
||||||
@@ -26,13 +28,15 @@ public class MacAddressFix implements Random {
|
|||||||
|
|
||||||
Class<?> createUID = classLoader.loadClass("com.locopk.client.rs.CreateUID");
|
Class<?> createUID = classLoader.loadClass("com.locopk.client.rs.CreateUID");
|
||||||
|
|
||||||
Field mac = createUID.getDeclaredField("mac");
|
if (OperatingSystem.getOS().equals(OperatingSystem.MAC)) {
|
||||||
|
|
||||||
String randomMac = randomMacAddress();
|
Field mac = createUID.getDeclaredField("mac");
|
||||||
|
mac.set(null, randomMacAddress());
|
||||||
|
} else {
|
||||||
|
Field firstID = createUID.getDeclaredField("firstId");
|
||||||
|
|
||||||
System.out.println(randomMac);
|
firstID.set(null, UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
mac.set(null, randomMac);
|
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -55,23 +59,23 @@ public class MacAddressFix implements Random {
|
|||||||
return RandomType.ON_SERVER_START;
|
return RandomType.ON_SERVER_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String randomMacAddress(){
|
private String randomMacAddress() {
|
||||||
java.util.Random rand = new java.util.Random();
|
java.util.Random rand = new java.util.Random();
|
||||||
byte[] macAddr = new byte[6];
|
byte[] macAddr = new byte[6];
|
||||||
rand.nextBytes(macAddr);
|
rand.nextBytes(macAddr);
|
||||||
|
|
||||||
macAddr[0] = (byte)(macAddr[0] & (byte)254); //zeroing last 2 bytes to make it unicast and locally adminstrated
|
macAddr[0] = (byte) (macAddr[0] & (byte) 254); //zeroing last 2 bytes to make it unicast and locally adminstrated
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(18);
|
StringBuilder sb = new StringBuilder(18);
|
||||||
for(byte b : macAddr){
|
for (byte b : macAddr) {
|
||||||
|
|
||||||
if(sb.length() > 0)
|
if (sb.length() > 0) {
|
||||||
sb.append("");
|
sb.append("");
|
||||||
|
}
|
||||||
|
|
||||||
sb.append(String.format("%02x", b));
|
sb.append(String.format("%02x", b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return sb.toString().toUpperCase();
|
return sb.toString().toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
|||||||
*/
|
*/
|
||||||
public class CombatStone implements Random {
|
public class CombatStone implements Random {
|
||||||
|
|
||||||
private Npc combat;
|
|
||||||
private final int id = 17025;
|
private final int id = 17025;
|
||||||
|
private Npc combat;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ import org.rev317.min.api.wrappers.SceneObject;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Jail implements Random {
|
public class Jail implements Random {
|
||||||
|
private final int[] rocks = { 7456, 7455, 7488 };
|
||||||
|
private final int[] pickAxes = { 1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608 };
|
||||||
private Npc jailer;
|
private Npc jailer;
|
||||||
|
|
||||||
private final int[] rocks = {7456, 7455, 7488};
|
|
||||||
private final int[] pickAxes = {1266, 1268, 1270, 1272, 1274, 1276, 14605, 14608};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
|||||||
*/
|
*/
|
||||||
public class MysteriousOldMan implements Random {
|
public class MysteriousOldMan implements Random {
|
||||||
|
|
||||||
private Npc man;
|
|
||||||
private final int id = 513;
|
private final int id = 513;
|
||||||
|
private Npc man;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import org.rev317.min.api.wrappers.Npc;
|
|||||||
*/
|
*/
|
||||||
public class SandwichLady implements Random {
|
public class SandwichLady implements Random {
|
||||||
|
|
||||||
private Npc lady;
|
|
||||||
private final int id = 5510;
|
private final int id = 5510;
|
||||||
|
private Npc lady;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import org.rev317.min.api.wrappers.Item;
|
|||||||
*/
|
*/
|
||||||
public class TriangleSandwich implements Random {
|
public class TriangleSandwich implements Random {
|
||||||
|
|
||||||
private Item item;
|
|
||||||
private final int id = 6963;
|
private final int id = 6963;
|
||||||
|
private Item item;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user