-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshort_code_scanner.java
More file actions
223 lines (186 loc) · 8.63 KB
/
Copy pathshort_code_scanner.java
File metadata and controls
223 lines (186 loc) · 8.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
import javax.swing.*;
import java.awt.*;
import java.net.*;
import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class NeoFastScanner extends JFrame {
private static final String FONT_PATH = "fonts/Perfect_DOS_VGA_437.ttf";
private Font dosFont = new Font("Monospaced", Font.PLAIN, 16);
private final DefaultTableModel table = new DefaultTableModel(
new String[]{"TARGET", "IP", "PORTS", "TITLE", "SERVER", "TECH", "SEC"}, 0);
private final JTextArea log = new JTextArea();
private final ExecutorService pool = Executors.newFixedThreadPool(20);
public NeoFastScanner() {
setTitle("NEO SCANNER v10 - HYPER MODE");
setSize(1400, 900);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
try {
if (Files.exists(Paths.get(FONT_PATH))) {
dosFont = Font.createFont(Font.TRUETYPE_FONT, new File(FONT_PATH)).deriveFont(18f);
GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(dosFont);
}
} catch (Exception ignored) {}
initUI();
log("NEO SCANNER v10 READY", "GREEN");
}
private void initUI() {
setLayout(new BorderLayout());
getContentPane().setBackground(Color.BLACK);
// Header
JTextArea header = new JTextArea(
"╔══════════════════════════════════════════════════════════════╗\n" +
"║ NEO SCANNER v10 - HYPER MODE ║\n" +
"╚══════════════════════════════════════════════════════════════╝");
header.setFont(dosFont);
header.setForeground(Color.GREEN);
header.setBackground(Color.BLACK);
header.setEditable(false);
add(header, BorderLayout.NORTH);
// Table
JTable jt = new JTable(table);
jt.setFont(dosFont);
jt.setForeground(Color.GREEN);
jt.setBackground(Color.BLACK);
jt.setGridColor(new Color(0, 80, 0));
jt.setRowHeight(30);
add(new JScrollPane(jt), BorderLayout.CENTER);
// Bottom panel
JPanel bottom = new JPanel(new BorderLayout());
bottom.setBackground(Color.BLACK);
JTextField input = new JTextField("https://example.com");
input.setFont(dosFont);
input.setForeground(Color.GREEN);
input.setBackground(Color.BLACK);
input.setCaretColor(Color.GREEN);
JButton scan = new JButton(">> EXECUTE <<");
scan.setFont(dosFont);
scan.setForeground(Color.GREEN);
scan.setBackground(new Color(0, 40, 0));
scan.addActionListener(e -> scanTarget(input.getText().trim()));
JPanel ctrl = new JPanel();
ctrl.setBackground(Color.BLACK);
ctrl.add(input);
ctrl.add(scan);
bottom.add(ctrl, BorderLayout.NORTH);
log.setFont(dosFont);
log.setForeground(Color.GREEN);
log.setBackground(Color.BLACK);
log.setEditable(false);
bottom.add(new JScrollPane(log), BorderLayout.CENTER);
add(bottom, BorderLayout.SOUTH);
// CRT effect
Timer flicker = new Timer(100, e -> {
int a = (System.currentTimeMillis() % 300 < 150) ? 30 : 50;
getContentPane().setBackground(new Color(0, a, 0));
});
flicker.start();
}
private void log(String msg, String type) {
String time = new java.text.SimpleDateFormat("HH:mm:ss").format(new Date());
Color c = type.equals("RED") ? Color.RED : type.equals("YELLOW") ? Color.YELLOW : new Color(0,255,100);
SwingUtilities.invokeLater(() -> {
log.append(String.format("[%s] %s\n", time, msg));
log.setForeground(c);
log.setCaretPosition(log.getDocument().getLength());
});
}
private void scanTarget(String target) {
if (target.isEmpty()) {
log("NO TARGET", "RED");
return;
}
pool.submit(() -> {
try {
String url = target.matches("^https?://.*") ? target : "http://" + target;
URL u = new URL(url);
String host = u.getHost();
String ip = InetAddress.getByName(host).getHostAddress();
log("LOCKED: " + host + " [" + ip + "]", "GREEN");
Set<Integer> openPorts = ConcurrentHashMap.newKeySet();
List<Future<?>> tasks = new ArrayList<>();
int[] ports = {80, 443, 21, 22, 25, 53, 110, 143, 993, 995, 8080, 8443, 3389, 3306, 5432};
for (int p : ports) {
tasks.add(pool.submit(() -> {
if (checkPort(ip, p)) {
openPorts.add(p);
log("PORT " + p + "/tcp OPEN", "YELLOW");
if (p == 80 || p == 443 || p == 8080 || p == 8443) {
fetchWebInfo(host, p);
}
}
}));
}
for (Future<?> f : tasks) f.get(); // wait all
String portsStr = openPorts.isEmpty() ? "NONE" : openPorts.stream()
.sorted().map(String::valueOf).collect(java.util.stream.Collectors.joining(","));
SwingUtilities.invokeLater(() -> table.addRow(new Object[]{
host, ip, portsStr, "—", "—", "—", "—"
}));
log("SCAN COMPLETE → " + host, "GREEN");
} catch (Exception ex) {
log("ERROR: " + ex.getMessage(), "RED");
}
});
}
private boolean checkPort(String ip, int port) {
try (Socket s = new Socket()) {
s.connect(new InetSocketAddress(ip, port), 1500);
return true;
} catch (Exception e) {
return false;
}
}
private void fetchWebInfo(String host, int port) {
String proto = (port == 443 || port == 8443) ? "https" : "http";
String url = proto + "://" + host + (port != 80 && port != 443 ? ":" + port : "");
try {
Document doc = Jsoup.connect(url)
.userAgent("Mozilla/5.0")
.timeout(7000)
.followRedirects(true)
.get();
String title = doc.title();
if (title.length() > 40) title = title.substring(0, 37) + "...";
String server = doc.select("meta[name=server],meta[property=server]").attr("content");
if (server.isEmpty()) {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
server = conn.getHeaderField("Server");
conn.disconnect();
}
server = server == null ? "Hidden" : server.split(" ")[0];
StringBuilder tech = new StringBuilder();
String body = doc.body().text().toLowerCase();
if (body.contains("wordpress")) tech.append("WP ");
if (body.contains("react")) tech.append("React ");
if (body.contains("vue")) tech.append("Vue ");
if (body.contains("laravel")) tech.append("Laravel ");
tech.append(server.contains("nginx") ? "nginx" : server.contains("Apache") ? "Apache" : "");
int sec = 0;
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
if (conn.getHeaderField("X-Frame-Options") != null) sec++;
if (conn.getHeaderField("X-Content-Type-Options") != null) sec++;
if (conn.getHeaderField("Strict-Transport-Security") != null) sec++;
conn.disconnect();
String finalTech = tech.toString().trim();
if (finalTech.isEmpty()) finalTech = "Unknown";
int row = table.getRowCount() - 1;
SwingUtilities.invokeLater(() -> {
table.setValueAt(title.isEmpty() ? "No Title" : title, row, 3);
table.setValueAt(server, row, 4);
table.setValueAt(finalTech, row, 5);
table.setValueAt(sec + "/3", row, 6);
});
log("WEB → \"" + title + "\" | " + server + " | " + finalTech, "GREEN");
} catch (Exception ignored) {
log("WEB FAILED ON PORT " + port, "RED");
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> new NeoFastScanner().setVisible(true));
}
}