Load Sketch to Arduino Leonardo over Arduino Uno

Hello all,

I am new in the forum. If the topic is not addressed correctly please tell me the correct address.
I tried to search for that topic but have not found a matching result.

I am working on my bachelor thesis about an Rubber Ducky, that is based on an Arduino Leonardo board at the moment.

Rubber Ducky: USB Rubber Duckies with Arduino. What is Rubber Ducky? | by Divyansh Khandelwal | Techloop | Medium

The Rubber Ducky should run scripts like open text windows in a loop or shutdown the PC by connecting the Arduino Leonardo board.

My problem is, that I load the sketches via USB to the Arduino Leonardo at the moment and the sketch gets directly started after that. If I test now a shutdown script I cannot load a new sketch on the Arduino before it shuts my PC down :frowning: .

I am seaching now for a solution where I can program the Arduino Leonardo from one PC and test the scetch on a second PC.

My idea is that I program the Arduino Leonardo via a second Arduino board over f.e. ISP instead of the direct USB connection.
So that I have a program Arduino, connected via USB to my programming PC and a target Arduino (Ardiono Leonardo - Rubber Ducky), that is connected via USB to my Test PC.

Is a setup like this possible? I have read that you can use a Arduino as bootloader but is there also an easy way to load sketches to a target Arduino board over a second Arduino.

If a second Arduin is not necessary for this setup I am also fine. I just have to find a way to load sketches on my Arduino Leonardo, test them on a second PC and load new sketches to my Arduino again (Without starting the sketch that is on the Arduino).

Thanks for your answers.

Rubber duckies are pretty unpopular around here.

I understand that they might be unpopular.

But my bachelor thesis is more about why it works so easy to run such scripts over USB and how to avoid such attacks. I have to explain the problem about trust with USB when the PC is unlocked.

To explain that I also have to test rubber ducky scripts to check how the impact can be avoided.
Trust me - I have no bad motives when I want to set up a rubber ducky.

I also have to write about the benefits of simulation a keyboard or a mouse by implementing a mouse jiggler.

Can anybody assist me with this topic?
As mentioned I have no bad motives in using the Ducky.

A simple work around could be to add a button and only send the commands when the button is pressed. That gives you the chance to upload the code, connect the Leonardo to another PC and press the button to see if your ‘script’ works.

Your idea will work; I think that Arduino as ISP can do it, else buy a programmer.

Thanks for the feedback.
Yes, I decided now to use the workaround for the moment and change between test and programming mode over a switch connected to an Digital input.