<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CLI tool for USB only]]></title><description><![CDATA[<p dir="auto">By the way, I know it's not that simple, but have you thought about developing a command-line version of IO Ninja for just USB?</p>
<p dir="auto">I'd absolutely love to have a simple command line tool to which I can give parameters or have it read from a file to send USB packets to a device or read from it, pipe its output to other scripts or pipe output into it from other scripts, etc.</p>
<p dir="auto">Basically, again a wrapper around libusb.</p>
<p dir="auto">I don't need a TUI or anything like that. Cli would be enough for me.</p>
<p dir="auto">So something like: usbninja --vid=1532 --pid=007b --transaction-type=control --data=xxxxxxxxxxxxxxxx</p>
]]></description><link>http://64.23.185.212/forum/topic/9/cli-tool-for-usb-only</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 21:11:07 GMT</lastBuildDate><atom:link href="http://64.23.185.212/forum/topic/9.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Jul 2021 15:54:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CLI tool for USB only on Wed, 28 Jul 2021 07:46:59 GMT]]></title><description><![CDATA[<p dir="auto">If you were programming in PHP then try Node JS. A familiar C-family syntax, a reliable and fast scripting engine from Google, established module/package infrastructure, and huge community (you can basically program by copy-pasting from Stack Overflow). There are (of course) libusb bindings (<code>npm install usb</code>), and even a specialized module for HID (<code>npm install node-hid</code>)</p>
<pre><code class="language-js">const usb = require("usb");

const list = usb.getDeviceList();
console.log("attached USB devices:", list);
</code></pre>
<p dir="auto">Also, a good point re TUI. A terminal version of IO Ninja (a TUI via <code>ncurses</code>) is actually something we plan to do at one point, but it's not going to happen in the near future <img src="http://64.23.185.212/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=miq4h6da9ug" class="not-responsive emoji emoji-android emoji--disappointed" title=":(" alt="😞" /></p>
]]></description><link>http://64.23.185.212/forum/post/18</link><guid isPermaLink="true">http://64.23.185.212/forum/post/18</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Wed, 28 Jul 2021 07:46:59 GMT</pubDate></item><item><title><![CDATA[Reply to CLI tool for USB only on Tue, 27 Jul 2021 19:50:06 GMT]]></title><description><![CDATA[<p dir="auto">I would actually use it directly most of the time, not that your points aren't valid. I guess a middle ground can be a TUI. If done well/enough Vim-like it would be even better.</p>
<p dir="auto">As for the scripting languages, while I do plan to utilize them at a further point in time, I have been a PHP developer most of the time and any libusb wrappers there are, don't work with the latest version or fail during compilation. I am currently learning C, but don't know it well enough to use libusb directly. Perl and Python are a bit further down on my list for languages to learn.</p>
<p dir="auto">Also, not that there aren't any other viable (maybe even better) alternatives than CLI for libusb. My reason for requesting a clip USB application in particular is mostly because I just want to do it via the terminal <img src="http://64.23.185.212/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=miq4h6da9ug" class="not-responsive emoji emoji-android emoji--smile" title=":D" alt="😄" /> I requested cli as opposed to TUI as it is more versatile and depending on how the TUI is done, it may not be to everyone's taste. Not that I'd mind having either one or both <img src="http://64.23.185.212/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=miq4h6da9ug" class="not-responsive emoji emoji-android emoji--smile" title=":D" alt="😄" /></p>
]]></description><link>http://64.23.185.212/forum/post/17</link><guid isPermaLink="true">http://64.23.185.212/forum/post/17</guid><dc:creator><![CDATA[ifohancroft]]></dc:creator><pubDate>Tue, 27 Jul 2021 19:50:06 GMT</pubDate></item><item><title><![CDATA[Reply to CLI tool for USB only on Tue, 27 Jul 2021 13:53:35 GMT]]></title><description><![CDATA[<p dir="auto">Right, but you would use such a program from a bash script, correct?</p>
<p dir="auto">Instead, I suggest using a scripting language like Python or JS and talking to a USB device via <code>libusb</code> directly, without calling a dedicated CLI program that provides a CLI-style API to do the same.</p>
<p dir="auto">Reason 1 -- <code>bash</code> is much less expressive than most other general-purpose scripting languages.<br />
Reason 2 -- having a CLI-style API means that in every call we need to open the device, interface, and endpoint, then do the USB transfer, then close everything. Then re-open everything on the next CLI API call, and so on.<br />
Reason 3 -- we would basically be reinventing the wheel by providing a CLI-style API over an already established <code>libusb</code> API<br />
Reason 4 -- CLI API is not very suitable for passing binary blocks back and forth</p>
<p dir="auto">Hope all this makes sense. Is there any reason why not using a general-purpose scripting language for such a task?</p>
]]></description><link>http://64.23.185.212/forum/post/15</link><guid isPermaLink="true">http://64.23.185.212/forum/post/15</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Tue, 27 Jul 2021 13:53:35 GMT</pubDate></item><item><title><![CDATA[Reply to CLI tool for USB only on Tue, 27 Jul 2021 11:47:58 GMT]]></title><description><![CDATA[<p dir="auto">Just to clarify: When I say CLI, I don't mean I want it in Bash or any other Shell script. In-fact I want it in C, but by CLI I just meant command line interface, or in other words, that I don't want a TUI/terminal user interface like an ncurses application/application using ncurses, I want to pass commands to it.</p>
]]></description><link>http://64.23.185.212/forum/post/13</link><guid isPermaLink="true">http://64.23.185.212/forum/post/13</guid><dc:creator><![CDATA[ifohancroft]]></dc:creator><pubDate>Tue, 27 Jul 2021 11:47:58 GMT</pubDate></item><item><title><![CDATA[Reply to CLI tool for USB only on Tue, 27 Jul 2021 04:38:22 GMT]]></title><description><![CDATA[<p dir="auto">Actually, that would be quite simple to implement, but in my opinion, there's not much point in that. You could achieve the same -- and more! -- by using any scripting language of your choice (Python, Perl, JS, Ruby, etc.) All modern scripting languages have bindings to <code>libusb</code>. By having such a script you:</p>
<ol>
<li>Wouldn't need to open/close USB device, interface, and endpoint in every command;</li>
<li>Will have a much richer programming environment to organize the logic, control flow, analysis of incoming data, debug-printing, etc. (as compared to shell scripts).</li>
</ol>
<p dir="auto">And here we come to an interesting point. The next question you might ask would be -- OK, then what is the advantage of IO Ninja as compared to Python/Ruby/JS/... scripts? And this would be exactly the reason behind creating IO Ninja in the first place! Because many years ago we ourselves started with such testing scripts/programs but then quickly realized that we need a convenient UI for:</p>
<ol>
<li>Configuring and managing the <em>connection</em> (e.g. choosing from a list of devices, or connecting on a button click);</li>
<li>Generating a <em>log</em>; then browsing and searching through it (in <em>live mode</em>, as it grows);</li>
<li>Preparing <em>outbound packets</em> with a hex-editor (or transmitting raw files).</li>
</ol>
<p dir="auto">So essentially, when you have a simple testing program and then start adding those features to it, you start developing your own IO Ninja!</p>
]]></description><link>http://64.23.185.212/forum/post/12</link><guid isPermaLink="true">http://64.23.185.212/forum/post/12</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Tue, 27 Jul 2021 04:38:22 GMT</pubDate></item></channel></rss>