Patched command block place bypass

This commit is contained in:
obvWolf
2024-02-21 01:27:01 -06:00
parent 2b57dbedbb
commit d779bc4de0
10 changed files with 16 additions and 20 deletions

0
build.sh Normal file → Executable file
View File

0
gradlew vendored Normal file → Executable file
View File

0
obf.sh Normal file → Executable file
View File

View File

@@ -92,7 +92,6 @@ public final class Sentinel extends JavaPlugin {
log.info("WTFFFF ARE YOU DOING MAN??????");
manager.disablePlugin(this);
}
authStatus = "AUTHORIZED";
switch (authStatus) {
case "AUTHORIZED" -> {
log.info("\n]======----- Auth Success! -----======[");

View File

@@ -82,22 +82,12 @@ public class SentinelCommand implements CustomCommand {
debugMode = !debugMode;
p.sendMessage(Text.prefix((debugMode ? "Enabled" : "Disabled") + " debug mode."));
}
/*case "encrypt" -> {
final String enc = CipherUtils.encrypt(args.getAll(2).toString());
final String check = CipherUtils.decrypt(enc);
final String main = Text.prefix("Successfully encrypted \"&e" + check + "&7\" using AES.\n &7> &b" + enc);
Sentinel.log.info(args.getAll(2).toString() + "\n" + enc + "\n" + check);
TextComponent message = new TextComponent();
message.setText(main);
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new net.md_5.bungee.api.chat.hover.content.Text("&bClick to copy!")));
message.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, enc));
p.spigot().sendMessage(message);
}*/
case "chat" -> {
AsyncPlayerChatEvent message = new AsyncPlayerChatEvent(true,p,args.getAll(1).toString(), Set.of(p));
AsyncPlayerChatEvent message = new AsyncPlayerChatEvent(true,p,args.getAll(2).toString(), Set.of(p));
AdvancedBlockers.handleAdvanced(message);
AntiSpam.handleAntiSpam(message);
ProfanityFilter.handleProfanityFilter(message);
if (!message.isCancelled()) p.sendMessage(Text.prefix("Message did not get flagged."));
}
}
}

View File

@@ -59,5 +59,5 @@ public class AdvancedConfig implements JsonSerializable<AdvancedConfig> {
public String falsePosRegex = "";
public String swearRegex = "";
public String strictRegex = "";
public String urlRegex = "(?:https?://)?(?:www.)?(?:(?<subdomain>[a-z0-9-]+).)?(?<domain>[a-z0-9-]+).(?:(?<tld>[a-z]{1,63}))?(?::(?<port>[0-9]{1,5}))?(?:[/#](?<path>[A-Za-z0-9_/.~:/?#\\[\\]@!$&'()*+,;=.]*)?)?";
public String urlRegex = "\\b(?:(?:https?|ftp):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:com|org|net|int|edu|gov|mil|arpa|biz|info|mobi|app|name|aero|jobs|museum|travel|a[c-gil-oq-uwxz]|b[abd-jmnoq-tvwyz]|c[acdf-ik-orsu-z]|d[dejkmoz]|e[ceghr-u]|f[ijkmor]|g[abd-ilmnp-uwy]|h[kmnrtu]|i[delmnoq-t]|j[emop]|k[eghimnprwyz]|l[abcikr-vy]|m[acdeghk-z]|n[acefgilopruz]|om|p[ae-hk-nrstwy]|qa|r[eosuw]|s[a-eg-or-vxyz]|t[cdfghj-prtvwz]|u[agksyz]|v[aceginu]|w[fs]|y[etu]|z[amrw])))(?::\\d{2,5})?(?:\\/\\S*)?\\b";
}

View File

@@ -45,7 +45,7 @@ public class LanguageFile implements JsonSerializable<LanguageFile> {
put("spam-mute-notification", "§b§n%1$s§7 has been auto-muted by the anti spam! §8(§c%2$s§7/§4%3$s§8)");
put("url-warn", "§cDo not send urls in chat!");
put("url-notification", "§b§n%1$s§7 has triggered the anti-URL.");
put("url-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bDetected: %1$s");
put("url-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bDetected: §f%1$s");
put("unicode-warn", "§cDo not send non-standard unicode in chat!");
put("unicode-notification", "§b§n%1$s§7 has triggered the anti-unicode.");
put("unicode-notification-hover", "§8]==-- §d§lSentinel §8--==[\n§bMessage: §f%1$s");

View File

@@ -48,6 +48,7 @@ public class MainConfig implements JsonSerializable<MainConfig> {
add("setblock");
add("data");
add("whitelist");
add("lp")
}};
public boolean logDangerous = true;
public boolean logCmdBlocks = true;

View File

@@ -20,7 +20,9 @@ public class CMDBlockPlace implements CustomListener {
if (Sentinel.mainConfig.plugin.cmdBlockOpCheck && !e.getPlayer().isOp()) return;
ServerUtils.sendDebugMessage("CommandBlockPlace: Player is operator");
Block b = e.getBlockPlaced();
if ((b.getType() == Material.COMMAND_BLOCK || b.getType() == Material.CHAIN_COMMAND_BLOCK || b.getType() == Material.REPEATING_COMMAND_BLOCK)) return;
if (!(b.getType().equals(Material.COMMAND_BLOCK) ||
b.getType().equals(Material.REPEATING_COMMAND_BLOCK) ||
b.getType().equals(Material.CHAIN_COMMAND_BLOCK))) return;
ServerUtils.sendDebugMessage("CommandBlockPlace: Block is a command block");
Player p = e.getPlayer();
if (Sentinel.isTrusted(p)) return;

View File

@@ -25,7 +25,7 @@ import static io.github.thetrouper.sentinel.server.functions.ProfanityFilter.*;
public class FilterAction {
public static void filterPunish(AsyncPlayerChatEvent e, FAT type, Double similarity, FilterSeverity severity) {
String report = ReportFalsePositives.generateReport(e);
String report = "This action is not reportable.";
TextComponent staffNotif = Component.text("");
TextComponent playerWarning = Component.text("");
Player offender = e.getPlayer();
@@ -33,7 +33,7 @@ public class FilterAction {
case BLOCK_UNICODE -> {
staffNotif = Component
.text(Text.prefix(Sentinel.language.get("unicode-notification")
.formatted(offender)))
.formatted(offender.getName())))
.hoverEvent(Component.text(Sentinel.language.get("unicode-notification-hover")
.formatted(e.getMessage())));
playerWarning = Component
@@ -42,9 +42,9 @@ public class FilterAction {
case BLOCK_URL -> {
staffNotif = Component
.text(Text.prefix(Sentinel.language.get("url-notification")
.formatted(offender)))
.formatted(offender.getName())))
.hoverEvent(Component.text(Sentinel.language.get("url-notification-hover")
.formatted(Text.color(Text.regexHighlighter(e.getMessage(),Sentinel.advConfig.urlRegex," &e> &n"," &r&e<&f ")))));
.formatted(Text.color(Text.regexHighlighter(e.getMessage(),Sentinel.advConfig.urlRegex," &e> &n","&r &e<&f ")))));
playerWarning = Component
.text(Text.prefix(Sentinel.language.get("url-warn")));
}
@@ -83,6 +83,7 @@ public class FilterAction {
if (Sentinel.mainConfig.chat.antiSpam.logSpam) sendDiscordLog(offender,e,type);
}
case BLOCK_SWEAR -> {
report = ReportFalsePositives.generateReport(e);
staffNotif = Component.text(Text.prefix(String.format(Sentinel.language.get("profanity-block-notification"),
offender.getName(),
scoreMap.get(offender),
@@ -99,6 +100,7 @@ public class FilterAction {
.clickEvent(ClickEvent.runCommand("sentinelcallback fpreport " + report));
}
case SWEAR_PUNISH -> {
report = ReportFalsePositives.generateReport(e);
staffNotif = Component.text(Text.prefix(String.format(Sentinel.language.get("profanity-mute-notification"),
offender.getName(),
scoreMap.get(offender),
@@ -116,6 +118,7 @@ public class FilterAction {
if (Sentinel.mainConfig.chat.antiSwear.logSwears) sendDiscordLog(offender,e,type);
}
case SLUR_PUNISH -> {
report = ReportFalsePositives.generateReport(e);
staffNotif = Component.text(Text.prefix(String.format(Sentinel.language.get("slur-mute-notification"),
offender.getName(),
scoreMap.get(offender),
@@ -137,6 +140,7 @@ public class FilterAction {
ServerUtils.sendCommand(type.getExecutedCommand().replace("%player%", offender.getName()));
}
staffNotif = staffNotif.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/sentinelcallback fpreport " + report));
playerWarning = playerWarning.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, "/sentinelcallback fpreport " + report));
for (Player staff : ServerUtils.getStaff()) {
staff.sendMessage(staffNotif);