Code Monkey home page Code Monkey logo

ducky2python's Introduction

ducky2python ๐Ÿ

Convert DuckyScript scripts (of the hak5 USB Rubber Ducky) to Python programs that can run on your computer without a rubber ducky.

Why DuckyScript and why Python? It's easy! DuckyScript is simple and easy to learn and has become a standard in the BadUSB and pentesting community, Python also is easy to be written and is arguably one of the most portable programming languages available. Combine the two using ducky2python and you have a really easy to learn and powerfull automation tool in your hands!

โญ UPDATE: Now ducky2python has a website which you can use instead of downloading and running the Python program! See instructions bellow.

Usage Instructions (through website) ๐ŸŒ

  1. Visit https://cedarctic.github.io/ducky2python
  2. Paste & Convert your script
  3. Copy and paste the converted script to a text editor and save the file with a .py extension
  4. If you want to run the script you first have to install Python 3 and then pyautogui: pip install pyautogui

Installation / Usage ๐Ÿ’ป

  1. Install Python 3 if you don't have it.
  2. Download the ducky2python.py file from here.
  3. Run it.
  4. Drag and drop the .txt file of the DuckyScript you want converted and hit enter.
  5. You will find the converted script in the directory of ducky2python.py with the name PythonScript.py
  6. If you want to run the script you first have to install pyautogui: pip install pyautogui

Credits

  • hak5 for the USB Rubber Ducky and DuckyScript
  • The awesome Python community
  • asweigart for pyautogui

License

GNU-AGPLv3.0

Copyright (c) 2018 CedArctic

ducky2python's People

Contributors

cedarctic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ducky2python's Issues

Hate to be a bother

Your tool is awesome and I have not gotten an issue yet. I hate to be a bother, but can you reverse your project as well? Python to Ducky?

I can find almost no scripts for Linux on the web so I have been making them in python. Of course, this is not very practical when a computer may not have python or the modules you need.

Thanks so much,

JAS

error when executing

File "ducky2python.py", line 76, in
for i in int(line[7:0] - 1):
TypeError: unsupported operand type(s) for -: 'str' and 'int'

A little issue with REPEAT command

I noticed some problem with the REPEAT command. The for loop in Line #76 is creating problem. I am just reporting this issue.

I just changed it to
for i in range(int(line[7:]) - 1):

And it is working fine, AFAIK. I think the range was missing and there was an invalid addition of int and str.
Please fix it, as this is present in the ducky2python as well

Win10 issues (2)

I've been playing around with your ducky2python thing and used a very basic Hello World Ducky script from ducktoolkit dot com userscripts.

Your translation of "GUI r" to pyautogui.hotkey("win","R") does not work on Win10. What works is pyautogui.hotkey("win","Run"). I realise the Ducky language specifies "GUI r" to get to the Run menu on Windows systems. Maybe at one time it did work.

The other thing is that since you wrap the output STRING in double quotes it does not escape the " and \ characters of the Ducky STRING command. This causes an syntax error.

This was just an exercise to learn more about Python and I came across your stuff. Figured you may want to know.

Ducky script used and converted online:

DELAY 3000
GUI r
DELAY 500
STRING notepad
DELAY 500
ENTER
DELAY 750
STRING Hello World!!!
ENTER
STRING $userDir = (Get-ChildItem env:\userprofile).value + '\Ducky Report ' + $folderDateTime
ENTER
STRING $Report = "<div id=left><h3>Computer Information</h3></div>"
ENTER

Rather than just raise an issue, I decided to try to solve the escape issue. It's easy to just complain.
Line 72 of the ducky2python.js file
previousStatement = "pyautogui.typewrite(\"" + duckyScript[line].slice(7).replace(/\\/g,"\\\\").replace(/\"/g, "\\\"") + "\", interval=0.02)";

Line 71 of the ducky2python.py file
previousStatement = "pyautogui.typewrite(\"" + (line[7:]).replace("\\","\\\\").replace("\"", "\\\"") + "\", interval=0.02)"

No idea for the "GUI r" issue.

I could never figure out this pull thing of github so I will not even try.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.