Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-17-2010, 05:15 AM   #1
vdp
Enthusiast
vdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watch
 
Posts: 45
Karma: 10842
Join Date: Aug 2010
Device: Kindle DXG
KindleTERM - a SSH client kindlet

Hi,

I wrote a quick and dirty hack based on the MidpSSH J2ME SSH/telnet client, to make it run on Kindle. Well, I am somewhat hesitant on the 'quick' part, since it took me a good amount of time during the last 3 weeks, but it is certainly dirty . You can find the git repo on GitHub.

Thanks to Andrew de Quincey for making possible writing kindlets without the highly restricted Amazon development kit.

I've only had the opportunity to test it on my Kindle DXG, so I don't know how well it performs on other models.

I will describe the installation process in case someone is willing to try it.

The usual disclaimer applies: You should not take the steps described below unless you are comfortable about messing with your device and potentially bricking it. DO IT ON YOUR OWN RISK - if something goes wrong I will probably not be able to help you.

1) Copy the developer.keystore in /var/local/java/keystore directory. I wanted to use the AdQ's keystore used for KIF but unfortunatelly Ant's signjar task fails with message:

Code:
[signjar] jarsigner: Certificate chain not found for: dkadq.  dkadq must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
I am not all that familiar with the Java keystores so I am not sure yet what the problem is.
If someone have an idea how to fix it you are wellcome.

2) The Kindle framework's sandbox should be relaxed somewhat to allow SSH connections.
In /opt/amazon/ebook/security/external.policy after "grant signedBy "Kindlet" {" add the lines
Code:
permission java.net.SocketPermission "localhost:1024-", "accept, connect, listen";
permission java.net.SocketPermission "192.168.2.1", "connect, accept";
permission java.net.SocketPermission "localhost", "connect, accept";
These changes permit connections to the kindlet, and from the kindlet to the localhost and usbnet host ip. Perhaps here is the place to say (as already mentioned by others on this forum) that the Amazon 3G access should be considered privilege rather than right, so I will not support any attempts to exploit the free 3G.

3) Copy the KindleTERM.azw2 to the 'documents' directory.

Known bugs and limitations:

- I am not sure if this is the case if you only make connections to the kindle (localhost), but I discovered that the connections from Kindle to other hosts are automatically disconnected after 2 or so minutes. If you want to prevent this you should stop netwatchd daemon.
Code:
/etc/init.d/netwatchd stop
- MidpSSH tries to emulate a DEC vt320 terminal. It seems that it is not that common type of terminal so neither my Ubuntu 9.04 nor the Kindle have a terminfo description. I tried different terminfo files (e.g. the one from http://www.sunmanagers.org/archives/1995/1561.html) none of them work as it should for example in VIM. Don't know if the reason is the imperfect emulation in terminal.VT320 class, the way I use it in kindle.KindleTerminal or terminfo entries needs tweaking. Every help on this issue is very wellcome.

- Key events handling is far from perfect. For example there is still no way to emulate "TAB" on the device's keyboard. It should be trivial to fix though. I implemented also a "remote keyboard" feature - the kindlet listens to port 3333 for key events. On the host machine you can start:
Code:
java -cp KindleTERM.azw2 kindle.RemoteKeyboard
and the keys you press when it's window is on focus are relayed to the kindlet.
It needs a java property file, named remote_keyboard.properties in the current working directory:
Code:
host 192.168.2.2
port 3333
This feature is a potential security hole if you use it on a WiFi-enabled Kindle, so you should change your firewall accordingly.

- If you choose to save session info it is saved in plain text in the kindlet's 'work' directory so it is a security risk also.

Last edited by ixtab; 10-09-2013 at 05:02 AM.
vdp is offline   Reply With Quote
Old 11-17-2010, 01:17 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Nice!

Here's a bunch of vt320 terminfo files (from the latest ncurses release), maybe one of them will help... .

Last edited by HarryT; 10-08-2013 at 11:51 AM.
NiLuJe is offline   Reply With Quote
Old 11-17-2010, 04:35 PM   #3
vladm
Junior Member
vladm began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2010
Device: K3g
so just to confirm I understand this right - it runs as app on your kindle and allows you to connect via ssh either to the kindle itself or to a remote host - basically use kindle as ssh terminal / client?
vladm is offline   Reply With Quote
Old 11-18-2010, 04:41 AM   #4
Polvo
Enthusiast
Polvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshesPolvo can read faster than his screen refreshes
 
Posts: 45
Karma: 14412
Join Date: Oct 2010
Location: Spain
Device: Kindle 3 - 3G
Well done! I managed to install on my Kindle 3 (3G) and connect to localhost.
Polvo is offline   Reply With Quote
Old 11-21-2010, 04:05 PM   #5
Elleo
Junior Member
Elleo began at the beginning.
 
Posts: 5
Karma: 12
Join Date: Nov 2010
Location: Aberystwyth, UK
Device: Kindle 3 (3G)
You can find vt320 terminfo in the ncurses-term package on Debian and Ubuntu, however I found that most ncurses based applications (irssi, mutt, etc.) still don't behave correctly with it.

The simplest solution I've come up with is to set the TERM environment variable to "ansi" instead of "vt320". i.e. run "export TERM=ansi" after logging in.
Elleo is offline   Reply With Quote
Old 11-22-2010, 01:53 PM   #6
stormont
Junior Member
stormont began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2010
Device: Kindle 3 Wifi
Thank you

Last edited by stormont; 11-25-2010 at 06:53 PM.
stormont is offline   Reply With Quote
Old 12-05-2010, 02:24 PM   #7
stasenko
Junior Member
stasenko began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2010
Device: Amazon Kindle
I try to connect to kindle with this params:
Code:
host: localhost
port:22
username: root
password: (what value do I need enter to this field?)
connection log is
Code:
Connecting to localhost:22 ...OK
...
...
...
Requesting authentication
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
What is wrong?
stasenko is offline   Reply With Quote
Old 12-05-2010, 05:16 PM   #8
stormont
Junior Member
stormont began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2010
Device: Kindle 3 Wifi
Quote:
Originally Posted by stasenko View Post
I try to connect to kindle with this params:
Code:
host: localhost
port:22
username: root
password: (what value do I need enter to this field?)
connection log is
Code:
Connecting to localhost:22 ...OK
...
...
...
Requesting authentication
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
Sent password
What is wrong?
telnet/ssh w/USB ethernet, then at root shell give your kindle a password - type 'passwd'
stormont is offline   Reply With Quote
Old 12-06-2010, 01:19 AM   #9
stasenko
Junior Member
stasenko began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2010
Device: Amazon Kindle
Quote:
Originally Posted by stormont View Post
telnet/ssh w/USB ethernet, then at root shell give your kindle a password - type 'passwd'
Thank you
stasenko is offline   Reply With Quote
Old 12-12-2010, 04:09 AM   #10
ennerr
Junior Member
ennerr began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Dec 2010
Device: Kindle 3 Wifi
Is there mapping for Ctrl key?

Thanks
ennerr is offline   Reply With Quote
Old 12-12-2010, 06:47 PM   #11
JDShaffer
Hobbit
JDShaffer began at the beginning.
 
JDShaffer's Avatar
 
Posts: 20
Karma: 10
Join Date: Jan 2007
Location: Shizuoka, Japan
Device: k2i
Noob Question...

OK. I'm not computer-illiterate, but I am Kindle-hacking illiterate.

How do I get to the point where I can see /var/local/java/keystore on my Kindle 2?

Currently I have the latest "jailbreak" and "screensaver hack" and "font hack" as described by NiLuJe in the Fonts & ScreenSavers hacks for Kindles thread. And I'm running the latest Kindle 2 firmware, 2.5.4.

Not sure how to get root from this point. Sorry if this has been answered somewhere, but I can't seem to locate the answer myself.

Thank you, and cheers.

Jeffrey
JDShaffer is offline   Reply With Quote
Old 12-12-2010, 10:38 PM   #12
JDShaffer
Hobbit
JDShaffer began at the beginning.
 
JDShaffer's Avatar
 
Posts: 20
Karma: 10
Join Date: Jan 2007
Location: Shizuoka, Japan
Device: k2i
(Deleted older comment)

OK. I got it all figured out. I read your blog and found the info I needed. I ended up using scp to get your developer key on there... (and later saw you made a .bin file that will do the same. Got your ktest, term, and kif (tested the first two so far).

Great stuff! Thanks for all the hard work!
Now, if I could figure out how to port Abiword or at least Pico (sorry, I'm not used to vi -- my bad).

Cheers,
Jeffrey

Last edited by JDShaffer; 12-13-2010 at 08:11 AM.
JDShaffer is offline   Reply With Quote
Old 12-13-2010, 08:16 AM   #13
JDShaffer
Hobbit
JDShaffer began at the beginning.
 
JDShaffer's Avatar
 
Posts: 20
Karma: 10
Join Date: Jan 2007
Location: Shizuoka, Japan
Device: k2i
-----

Last edited by JDShaffer; 12-13-2010 at 09:38 AM. Reason: Removed dumb question
JDShaffer is offline   Reply With Quote
Old 12-13-2010, 08:19 AM   #14
JDShaffer
Hobbit
JDShaffer began at the beginning.
 
JDShaffer's Avatar
 
Posts: 20
Karma: 10
Join Date: Jan 2007
Location: Shizuoka, Japan
Device: k2i
Nevermind. Got it. Had to have usbNetworking running, even if I'm not using the laptop to connect in...
JDShaffer is offline   Reply With Quote
Old 12-13-2010, 09:37 AM   #15
JDShaffer
Hobbit
JDShaffer began at the beginning.
 
JDShaffer's Avatar
 
Posts: 20
Karma: 10
Join Date: Jan 2007
Location: Shizuoka, Japan
Device: k2i
@vdp -- VI looks nice full screen, but is there an ESC key built in to the KindleTERM app?
JDShaffer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Kindle 3G as an ssh client - possible? how? chrisisbd Kindle Developer's Corner 6 01-02-2012 05:33 AM
Hacks Is there an ssh client for the Kindle ? ninsei Amazon Kindle 3 11-18-2011 08:55 PM
Android SSH Terminal (client) kenjennings enTourage Archive 1 03-04-2011 10:30 PM
iLiad SSH client for terminal access IvarC iRex Developer's Corner 2 02-06-2009 01:21 PM
iLiad how to use the iLiad as an ssh client? nagyv iRex Developer's Corner 1 05-30-2008 12:54 AM


All times are GMT -4. The time now is 05:28 PM.


MobileRead.com is a privately owned, operated and funded community.