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; } } if (process.platform != 'darwin' && process.platform != 'linux') { log(`You can't run this script on (${process.platform}) only works on Darwin/Linux Platform.`, 'error'); process.exit(1); } function checkRoot() { return process.getuid && process.getuid() === 0 }; log(`Running the script on ${process.platform} and arch ${process.arch}`, "success"); if (!checkRoot()) { log(`Please run ass root (Current UID = ${process.getuid()}, Need UID = 0)`, "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); })