tweaks numero duo

This commit is contained in:
C10udburst
2022-02-19 16:00:52 +01:00
parent 3312d97b9f
commit 16c3db1820
2 changed files with 26 additions and 5 deletions

View File

@@ -53,6 +53,7 @@ public class ServerCommand extends Command {
ports.put(8123, "DynMap");
ports.put(25566, "Minequery");
ports.put(3306, "MySQL");
ports.put(3389, "RDP");
}
@Override
@@ -122,7 +123,7 @@ public class ServerCommand extends Command {
BaseText text = new LiteralText(String.format("- %s%d%s ", Formatting.GREEN, port, Formatting.GRAY));
if (ports.containsKey(port)) {
text.append(ports.get(port));
if (ports.get(port).startsWith("HTTP")) {
if (ports.get(port).startsWith("HTTP") || ports.get(port).startsWith("FTP")) {
text.setStyle(text.getStyle()
.withClickEvent(new ClickEvent(
Action.OPEN_URL,
@@ -133,8 +134,7 @@ public class ServerCommand extends Command {
new LiteralText("Open in browser")
))
);
}
else if (ports.get(port) == "DynMap") {
} else if (ports.get(port) == "DynMap") {
text.setStyle(text.getStyle()
.withClickEvent(new ClickEvent(
ClickEvent.Action.OPEN_URL,
@@ -145,7 +145,29 @@ public class ServerCommand extends Command {
new LiteralText("Open in browser")
))
);
} else {
text.setStyle(text.getStyle()
.withClickEvent(new ClickEvent(
ClickEvent.Action.COPY_TO_CLIPBOARD,
String.format("%s:%d", address.getHostAddress(), port)
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Copy")
))
);
}
} else {
text.setStyle(text.getStyle()
.withClickEvent(new ClickEvent(
ClickEvent.Action.COPY_TO_CLIPBOARD,
String.format("%s:%d", address.getHostAddress(), port)
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Copy")
))
);
}
return text;

View File

@@ -24,7 +24,7 @@ public class PScanRunner {
futures.add(isPortOpen(es, address.getHostAddress(), port, timeoutMS, threadDelay));
});
try {
boolean _1 = es.awaitTermination(200L, TimeUnit.MILLISECONDS);
es.awaitTermination(200L, TimeUnit.MILLISECONDS);
} catch (InterruptedException ignored) {
}
List<PortScannerManager.ScanResult> results = new ArrayList<>();
@@ -52,7 +52,6 @@ public class PScanRunner {
Thread.sleep(delay);
portsScanned++;
try {
//System.out.println(ip + ":" + port);
Socket socket = new Socket();
socket.connect(new InetSocketAddress(ip, port), timeout);
socket.close();