View Single Post
Old 02-26-2012, 08:32 PM   #33
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by knc1 View Post
If using the Netcat (nc) built into Busybox, you will need to adjust the following nc command to match its limitations.

Objective: Send strings via network to /proc/keypad
Kindle: Listen on all interfaces, using some port number of your choosing (12345)
Remote machine: Assume Kindle appears as 192.168.2.1 on that machines network

Using a full copy of Netcat (nc) and assuming you haven't blocked new UDP connections in the Kindle's iptables setup (that is, open your above choice of port for UDP, state:new).

On Kindle:
(Listen, IPv4, re-start a new connection, no DNS lookups, UDP)
nc -l -4 -k -n -u 12345 >/proc/keypad

On remote machine:
echo "send 104" > nc -4 -n -u 192.168.2.1:12345

The Kindle end will auto-restart its listening for the next connection when it finishes receiving the above UDP packet.
I.E: You don't have to repeat the Kindle nc command, it will continue until you kill it.

Embellish as desired.
Such as start the Kindle nc command "on demand" using inetd and inetd.conf (in which case you don't need the "-k" - inetd will take care of start/stop of nc).
I seem to be having trouble, following my own directions.
Some versions don't know about -4/-6 (IPv4 / IPv6 selection).

Note: You can test the two nc ends by "talking" over the local-loopback (127.0.0.1)
No need to trash up your Kindle until you get what you want working locally.
knc1 is offline   Reply With Quote