mame82 / duck2spark Goto Github PK
View Code? Open in Web Editor NEWConverter for raw RubberDucky payloads to Digispark Arduino IDE Sketch source.
Converter for raw RubberDucky payloads to Digispark Arduino IDE Sketch source.
If i run the example.sh, i got this Error:
Traceback (most recent call last): File "duck2spark.py", line 155, in <module> main(sys.argv[1:]) File "duck2spark.py", line 140, in main result = generate_source(payload, init_delay=init_delay, loop_count=loop_count, loop_delay=loop_delay, blink=blink) File "duck2spark.py", line 65, in generate_source declare += str(hex(payload[c])) + ", " TypeError: hex() argument can't be converted to hex
But if I remove the hex() command, the "Rubber Spark" ;) runs any kind of stupid stuff.
Yours,
Moritz
This software works very well, except that when I go to use the hardware on another computer, it is unable to locate a driver and nothing works as it is supposed to.
Is there a specific driver that needs to be installed on the computer for this to work? Is there a different USB identifier that can be used to make this work more universally?
Just FYI really it's much easier if you use .ino for your output file rather than .c then all you have to do is open it with the arduino program and compile/upload it
/home/tugdual/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld:
Keyboard.ino.elf section .text' will not fit in region
text'
/home/tugdual/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld: region `text' overflowed by 6464 bytes
collect2: error: ld returned 1 exit status
exit status 1``
.
I tried you're duck2spark converter (and also the DuckEncoder, Python Version). But i'll get some issues:
I try to convert a duckyscript (for example this one: https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payload---WiFi-password-grabber).
I create a new file called "wlanscript.duck". After that, i use the duckencoder to get the german keboard layout:
cat wlanscript.duck | python duckencoder.py -p -l de > inject.bin
The last step: Create an Arduino Sketch:
duck2spark.py -i inject.bin -l 1 -f 2000 -o sketch.ino
And here are the issues:
The file sketch.ino looks a little bit weird in my Arduino IDE:
/*
* Sketch generated by duck2spark from Marcus Mengs aka MaMe82
*
*/
#include "DigiKeyboard.h"
#define DUCK_LEN 71
const PROGMEM uint8_t duckraw [DUCK_LEN] = {
0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x72, 0x20, 0x69, 0x73, 0x6e, 0x27, 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0xa
};
int i = 1; //how many times the payload should run (-1 for endless loop)
bool blink=true;
void setup()
{
// initialize the digital pin as an output.
pinMode(0, OUTPUT); //LED on Model B
pinMode(1, OUTPUT); //LED on Model A
DigiKeyboard.delay(2000); //wait 2000 milliseconds before first run, to give target time to initialize
}
void loop()
{
//should code be runned in this loop?
if (i != 0) {
DigiKeyboard.sendKeyStroke(0);
//parse raw duckencoder script
for (int i=0; i<DUCK_LEN; i+=2)
{
uint8_t key = pgm_read_word_near(duckraw + i);
uint8_t mod = pgm_read_word_near(duckraw + i+1);
if (key == 0) //delay (a delay>255 is split into a sequence of delays)
{
DigiKeyboard.delay(mod);
}
else DigiKeyboard.sendKeyStroke(key,mod);
}
i--;
DigiKeyboard.delay(5000); //wait 5000 milliseconds before next loop iteration
}
else if (blink)
{
digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, HIGH);
delay(100); // wait for a second
digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
digitalWrite(1, LOW);
delay(100); // wait for a second
}
}
Is this correct? When i try to compile this (and waited the till the 60-second 'plug your digispark now into your usb port' message appears) and to flash my digispark i'll get this message:
Starting the user app ...
Run error -1 has occured ...
Please unplug the device and restart the program.
After that i watched into my inject.in file and get this message
root@kali:~/duck2spark-master# cat inject.bin
Language file /resources/de.properties doesn't exist or isn't readable
In my duck2spark folder is a subdirectory "resources" with the file de.properties.
I don't get where the problem is. :/
Hey ! I've downloaded duck2spark from github, and when I want to run it, an error happen
My command:
python3 duck2spark/duck2spark.py -i ducky.bin -o Payload.bin
Error:
Traceback (most recent call last):
File "duck2spark/duck2spark.py", line 155, in <module>
main(sys.argv[1:])
File "duck2spark/duck2spark.py", line 140, in main
result = generate_source(payload, init_delay=init_delay, loop_count=loop_count, loop_delay=loop_delay, blink=blink)
File "duck2spark/duck2spark.py", line 65, in generate_source
declare += str(hex(ord(payload[c]))) + ", "
TypeError: ord() expected string of length 1, but int found
The following code is line 64, 65 and 66 from the main .py file:
for c in range(l - 1):
declare += str(payload[c]) + ", "
declare += str(payload[l - 1]) + "\n};\nint i = %d; //-snip-\n" % loop_count
I ran this code with python 3.6, and got the following error:
Traceback (most recent call last):
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 155, in <module>
main(sys.argv[1:])
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 140, in main
result = generate_source(payload, init_delay=init_delay, loop_count=loop_count, loop_delay=loop_delay, blink=blink)
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 65, in generate_source
declare += str(hex(ord(payload[c]))) + ", "
TypeError: ord() expected string of length 1, but int found
Since I know some python, I decided to look into the problem and it turns out that simply removing the calls to hex() and ord() makes the script run without problems. I verified that the output still works.
Changed code becomes this:
for c in range(l - 1):
declare += str(payload[c]) + ", "
declare += str(payload[l - 1]) + "\n};\nint i = %d; //-snip-\n" % loop_count
I have not tested with python 2.x.
root@kali:~# python2.7 duck2spark.py
File "duck2spark.py", line 107
except getopt.GetoptError:
Right now duck2spark doesn't seem to support multiple modifiers, and that's a real pity because in some layouts are really needed.
For example, in the Italian Keyboard, the curly bracket character "{" is made up of:
KEY_LEFT_BRACE, MODIFIERKEY_RIGHT_ALT, MODIFIERKEY_SHIFT
or, in hex codes:
0x2f, 0x40, 0x2
So, when the Rubber Ducky encoder encodes the "{" character, it produces the following output:
0x2f, 0x40, 0x2, 0x0
Now, in the Arduino code produced by duck2spark, the main loop goes on in step of two, where the first hex is the key and the second is the modifier.
In this case, the digispark does this:
First it sends the 0x2f + 0x40
character, i.e. KEY_LEFT_BRACE + MODIFIERKEY_RIGHT_ALT
i.e. the square bracket "[" and then it sends 0x2 + 0x0
i.e. MODIFIERKEY_SHIFT
, i.e. the shift key alone.
Clearly, the same applies to the closing curly bracket "}".
When i try to use åäö in a text i get errors like this:
Char not found:ISO_8859_1_C3
Char not found:ISO_8859_1_A5
Char not found:ISO_8859_1_C3
Char not found:ISO_8859_1_C3
Char not found:ISO_8859_1_B6
Edit: I fixed it, had to change to ISO 8859-1 encoding
Hi! This isn't really an issue but i didn't find a way to contact you otherwise! When you said in your case (DE) what do i have to put in there for a Slovenian layout. SLV, SL, SLO doesn't work... Thanks!
Hi mame82, i found an Error under Windows: If i run the duck2spark.py, i got this error:
Traceback (most recent call last): File "duck2spark.py", line 155, in <module> main(sys.argv[1:]) File "duck2spark.py", line 140, in main result = generate_source(payload, init_delay=init_delay, loop_count=loop_count, loop_delay=loop_delay, blink=blink) File "duck2spark.py", line 65, in generate_source declare += str(hex(ord(payload[c]))) + ", " TypeError: ord() expected string of length 1, but int found
I've typed in this:
python duck2spark.py -i ../../example.bin -l 4 -f 2500 -r 3000 -o example.ino
Can you say me how to fix it?7
Thx,
Moritz
EDIT: Looks like this: #10
documentation is terrible
File "C:\Users\HENRIQUES COUTINHO\Documents\Get-Chrome80Dump-main\duck2spark\duck2spark.py", line 65
declare += str(payload[c]) + ", "
TabError: inconsistent use of tabs and spaces in indentation
C:\Users\Lambda\Downloads\duck2spark-master\duck2spark-master>duck2spark.py -i raw.bin -l 1 -f 2000
Traceback (most recent call last):
File "C:\Users\Lambda\Downloads\duck2spark-master\duck2spark-master\duck2spark.py", line 154, in
main(sys.argv[1:])
File "C:\Users\Lambda\Downloads\duck2spark-master\duck2spark-master\duck2spark.py", line 122, in main
with open(ifile,"read") as f:
ValueError: Invalid mode ('read')
C:\Users\Lambda\Downloads\duck2spark-master\duck2spark-master>
i think it should be sketch.ino in step 4 instead of sketch.c
its not an issue but i dont have any option to point it out.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.