内容简介:Digispark是一个这样的很小的开发板淘宝上10元左右一个
Digispark是一个这样的很小的开发板
淘宝上10元左右一个
准备
-
Digispark ATtiny 85
-
Arduino IDE 1.8.4 (parrot 中的ide是2.x版本的没有Board Manager)
https://www.arduino.cc/en/Main/Software
-
Digispark驱动程序 (Windows)
https://github.com/digistump/DigistumpArduino/releases
配置Arduino IDE
打开 文件->首选项
把这个网址添加到附加开发板管理网址
https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json
点击确定(好)
然后打开开发板管理器
这时会自动更新一些东西,建议挂上代理,不然很慢
在Arduino中添加Digispark的支持
等待开发板管理器加载完成,搜索digistump并安装第一个Digistump *R Boards
等待安装完成,完成后会有绿色表示
安装Windows下的驱动
打开上面的链接,下载Digistump.Drivers
解压后执行Install Drivers.exe即可
代码
拿一个最简单的键盘功能来演示
badusb现成代码最多的就是给大黄鸭准备的代码
在这里可以看到一些示例代码
比如第一个Hello World的样例代码,把hello world改成Happy Hacking
DELAY 3000 GUI r DELAY 500 STRING notepad DELAY 500 ENTER DELAY 750 STRING Happy Hacking !!! ENTER
然后用这里的在线工具
把大黄鸭代码转换成Digispark的代码(注意Board要选Digispark)
/*
* Generated with <3 by Dckuino.js, an open source project !
*/
#include <avr/pgmspace.h>
#include "DigiKeyboard.h"
const char line1[] PROGMEM = "notepad";
const char line2[] PROGMEM = "Happy Hacking!!!";
char buffer[256];
#define GetPsz(x) (strncpy_P(buffer, (char*)x, 256))
#define KEY_UP_ARROW 0x52
#define KEY_DOWN_ARROW 0x51
#define KEY_LEFT_ARROW 0x50
#define KEY_RIGHT_ARROW 0x4F
#define KEY_LEFT_GUI 0xE3
#define KEY_ESC 0x29
#define KEY_TAB 0x2B
void digiBegin() {
DigiKeyboard.sendKeyStroke(0,0);
DigiKeyboard.delay(50);
}
void digiEnd() {
const int led=1;
pinMode(led, OUTPUT);
while (1) {
digitalWrite(led, !digitalRead(led));
DigiKeyboard.delay(1000);
}
}
void printText(char *txt) {
DigiKeyboard.print(txt);
DigiKeyboard.update();
}
void setup() {
digiBegin();
DigiKeyboard.delay(3000);
DigiKeyboard.sendKeyStroke(KEY_R,MOD_GUI_LEFT);
DigiKeyboard.delay(500);
// notepad
printText(GetPsz(line1));
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(750);
// Happy Hacking!!!
printText(GetPsz(line2));
DigiKeyboard.sendKeyStroke(KEY_ENTER);
digiEnd();
}
/* Unused endless loop */
void loop() {}
上传
Ardunio IDE中选择工具->开发板->Digispark (Default - 16.5mhz)
然后点击项目->上传等待编译完成
然后插入Digispark 开始上传
一旦上传完成,你会看到电脑自动的打开了运行然后打开了notepad,自动写了一句话
图文看不懂没关系
视频版:https://www.bilibili.com/video/av20732981
需要的代码:https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads 生成代码的工具:https://github.com/CYRO4S/Automator Arduino配置:https://www.bilibili.com/video/av18699066/ 驱动https://github.com/digistump/DigistumpArduino/releases
拓展
https://www.bilibili.com/video/av20174979
原文公众号:HACK学习呀
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Learning Vue.js 2
Olga Filipova / Packt Publishing / 2017-1-5 / USD 41.99
About This Book Learn how to propagate DOM changes across the website without writing extensive jQuery callbacks code.Learn how to achieve reactivity and easily compose views with Vue.js and unders......一起来看看 《Learning Vue.js 2》 这本书的介绍吧!