0% found this document useful (0 votes)
13 views

Codigo Arduino

The document describes code for an ATTINY85-based BadUSB that opens the command prompt, lists files, displays warning messages, and locks the computer. It uses DigiKeyboard functions to simulate keystrokes and send text. The code configures an LED, runs commands like cls, tree, exit, and sends Windows key combinations like Win+D and Win+L.

Uploaded by

cleitonjr03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Codigo Arduino

The document describes code for an ATTINY85-based BadUSB that opens the command prompt, lists files, displays warning messages, and locks the computer. It uses DigiKeyboard functions to simulate keystrokes and send text. The code configures an LED, runs commands like cls, tree, exit, and sends Windows key combinations like Win+D and Win+L.

Uploaded by

cleitonjr03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

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
/*---------------------------------------------------------
Programa : EXEMPLO DE BADUSB COM ATTINY85
Autor : Fellipe Couto [ http://www.efeitonerd.com.br ]
Data : 22/04/2020
---------------------------------------------------------*/
#include <DigiKeyboard.h>
const int delayKey = 300;
const int delayLong = 3000;

void setup() {
//Configura a porta 1 do LED da placa
pinMode(1, OUTPUT);

//Win + D
DigiKeyboard.sendKeyStroke(KEY_D, MOD_GUI_LEFT);
delay(delayKey);
//Win + R
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
delay(delayKey);

//Prompt de comando
DigiKeyboard.println("cmd");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Desativa o echo de comando


DigiKeyboard.println("@echo off");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Limpa tela
DigiKeyboard.println("cls");
DigiKeyboard.sendKeyStroke(KEY_ENTER);

//Tela cheia
DigiKeyboard.sendKeyStroke(KEY_F11);

DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Mensagem de texto
Writing(" ACESSO AO COMPUTADOR REALIZADO!");
delay(delayLong);
Writing(" VISUALIZANDO ARQUIVOS...");
delay(delayLong);
DigiKeyboard.sendKeyStroke(KEY_ENTER);

//Limpa tela
DigiKeyboard.println("cls");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Lista arquivos
DigiKeyboard.println("tree");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayLong);

//Ctrl + c (finaliza o comando em execução tree)


DigiKeyboard.sendKeyStroke(KEY_C, MOD_CONTROL_LEFT);
delay(delayKey);

//Limpa tela
DigiKeyboard.println("cls");
DigiKeyboard.sendKeyStroke(KEY_ENTER);

DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Mensagem de texto
Writing(" CUIDADO COM DISPOSITIVOS DESCONHECIDOS NA USB!");
delay(delayLong);
Writing(" ACESSO FINALIZADO.");
delay(delayLong);
DigiKeyboard.sendKeyStroke(KEY_ENTER);

//Fecha o prompt de comando


DigiKeyboard.println("exit");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(delayKey);

//Win + L (Bloqueia o computador)


DigiKeyboard.sendKeyStroke(KEY_L, MOD_GUI_LEFT);

//Liga o LED para indicar que o script foi finalizado


digitalWrite(1, HIGH);
}

void loop() {
}

void Writing(String txt) {


int len = txt.length();
for (int i = 0; i < len; i++) {
DigiKeyboard.print(txt.substring(i, i + 1));
delay(35);
}
}

You might also like