const usb = require('usb') const args = process.argv.slice(2).join(' '); const pongoOSDevice = usb.findByIds(0x05ac, 0x4141); function log(message, type) { switch (type) { case 'success': console.log("[+] " + message) break; case 'error': console.error("[-] " + message) break; } } function checkRoot() { return process.getuid && process.getuid() === 0 }; if (!checkRoot()) { log("Please run ass root", "error"); process.exit(1); }; if (!pongoOSDevice) { log("No device with pongoOS Booted has been found.", "error"); process.exit(1); }; if (!args) { log("No argumment has been provided.", "error"); process.exit(1); }; try { pongoOSDevice.open(true) } catch (e) { log("An error as occured while i was opening the device.", "error"); process.exit(1) }; if (args.length > 510) { log("You reached the length of the argumment.", "error"); process.exit(1) }; pongoOSDevice.controlTransfer(0x21, 3, 0, 0, new Buffer.from(`${args} \n`), (error) => { if (error) { log(`An error as occured while sending cmd error: ${error}`, "error") process.exit(1); } log(`Success, command "${args}" has been sent.`, "success") process.exit(0); })