Wednesday, 22 September 2010

Signing Android apk or zip Files

Signing Android apps: Easy!
Bit of a memory jogger for me this post, but possibly handy for others too.

Yes I realise that this information is almost everywhere on the net, but I can never seem to find it when I need it or when I do, I seem to find a Windows method when running Linux or find a Linux method when running Windows...

Firstly: why sign Android files?  Simple.  All Android apps must be signed.  Android will not install apk apps (or zip files in recovery mode) without them being signed. 

OK, so if you want to install it, you have to sign it.  But digitally signing files is a bit of a faff isn't it?  No not really.

With a little help for the Android SDK (Software Development Kit) and the Android coder Amon_RA, you can be signing Android files quickly and easily.

Word of warning: This method is not appropriate for signing apps for release on the Android Market as it uses test signatures.  See this Android Developers document for details on how to sign apps destined for the Android Market.  For all other uses outside of the Android Market, this method works just fine.

On with the method.  The beauty of this is that:

  1. It can be used on both Linux and Windows
  2. It's so easy, even I can follow it!
OK, here's what you need:

Install Java Runtime Environment and extract the Android SDK to, say, C:\AndroidSDK. Remember to extract the zip maintaining folder structure.

Create a folder under C:\AndroidSDK called sign, and download testsign.jar to C:\AndroidSDK\sign

Copy the file to be signed to C:\AndroidSDK\sign folder.  Drop to a command prompt and run the following command.  (In the example, I'm using Windows and my file is called "app.apk"):

java -classpath C:\AndroidSDK\sign\testsign.jar testsign C:\AndroidSDK\sign\app.apk C:\AndroidSDK\sign\app-signed.apk
Job done. 

The C:\AndroidSDK\sign folder should now contain an additional file called 'app-signed.apk'.  This is the signed file that can now be installed and tested on your Android device or in the Android Emulator.

I said it was easy ;o)

- Chris

Friday, 10 September 2010

Windows: Lost User & Password?

Windows users: Lost both Administrator user account name and password?  Perhaps you need access without changing any existing administrative accounts?  KON-Boot not doing it for you?

 *** NOTE***  This post relates to bypassing Windows Operating System security. 
The method discussed here is for HOME USE ONLY!  It is NOT be used on systems that do not belong to you.  Any problems arising from following this method are YOUR responsibility.

The beauty of this method is that it uses built in commands run from within the O/S you are gaining access to.  This means that the likelihood of corrupt security databases / registries / etc are diminished to practically zero (there is always a chance of corruption: nothing is without risk!).

A similar exercise to this used to exist back in the NT4 days, but instead of targeting sticky keys executable, you targeted the NT4 default screeensaver.

This method works any version of Windows that ships with the Sticky Keys application.  So that's Windows 95 and up.

How To (Short Version)

If you know what your doing and don't need a step by step, here's what to do in a nutshell:

  1. Boot from an alternative O/S and replace sethc.exe with cmd.exe
  2. Reboot target O/S and lauch stickykeys (press shift five times) to launch sethc.exe/cmd.exe
  3. Either:
  • Use net localgroup Administrators to list existing local administrators and then net user USERNAME NEWPASSWORD  to change the password of an existing administrative account
  • Create new administrative account using: net user /add NEWUSER NEWPASSWORD and net localgroup Administrators /add NEWUSER to add new-user to the local administrators group
4. Close cmd prompt and login.

How To (Long Version with Screen Shots)
For the example process shown here, I'm going to access a Windows 7 installation.  For my alternative operating system, I'm going to use Ubuntu Desktop 10.04.

OK  Here's how.
  1. Grab yourself a copy of Ubuntu, Windows PE or Knoppix Doesn't matter which.  The object here is to have an alternative method of booting the target system and gaining access to the drive containing the target Windows operating system.
  2. Create the alternative O/S boot CD/DVD or USB (for creation of an bootable Ubuntu USB, see my Unetbootin post here)
  3. Boot the alternative O/S.  
  4. Open Places Menu.  Select Local Disk:
  5. Navigate to Windows\System32:
  6. Find the file sethc.exe, right click and rename to sethc.old:
  7. Find the file cmd.exe, right click and select Copy:
  8. Right Click again and select Paste:
  9. Find the file called cmd (copy).exe and rename this file to sethc.exe:
  10. Shutdown, remove Ubuntu CD/USB and reboot back into Windows
  11. At Windows logon prompt press shift key five times to launch stickykeys application sethc.exe (which we have replaced with cmd.exe):
  12. Once command prompt opens (dont worry about any message text error messages), create new administrative account using: net user /add NEWUSER NEWPASSWORD
  13. Enter net localgroup Administrators /add NEWUSER to add new-user to the local administrators group:
  14. If needs be, (to get the new user to appear on the login screen) restart windows:
  15. Login as the new user:
  16. CLEAN UP.  Open C:\Windows\System32 and find sethc.exe:
  17. Delete sethc.exe:
  18.  Find sethc.old, right click and select Copy.  Right click again and Select Paste:
  19.  Rename the file sethc - Copy.old to sethc.exe:
  20. Press shift five times to ensure that sticky keys launches OK:
All done. Are we amazed that this kind of simple file rename hack still exists? Quite frankly yes... a bit. Ah well.

- Chris

Wednesday, 8 September 2010

Lotus Sametime for Android

Lotus Sametime for Android
The holy grail of Android and Lotus users is one step closer!  A Lotus Sametime client that runs on Android! 

Almost.  Let me clarify this a little.  This is not a native Android Lotus Sametime client, rather it is a Lotus Sametime MIDlet running on a Java 2 Micro Environment (J2ME) running on Android.

A MIDlet is an application that uses the Mobile Information Device Profile (MIDP) of the Connected Limited Device Configuration (CLDC) for the Java ME environment. Typical applications include games running on mobile devices and cell phones which have small graphical displays, simple numeric keypad interfaces and limited network access over HTTP. [Wikipedia]

Right oh... Sounds complicated.  Trust me. It really isn't complicated at all.  

Unknown to many, IBM/Lotus already produce a Sametime MIDlet, and they ship it with their Lotus Sametime Server software.  These MIDlets are primarilly aimed at Nokia 'E' series (Symbian based) handsets.

All we need to do is package that Lotus created MIDlet into a format that Android understands (i.e. an Android .apk package file), and install it along with a free J2ME environment to launch the MIDlet in.
Lotus Sametime Running on Android!

Roll Your Own Client
Here is how you can quickly and very easily make your own Android Lotus Sametime client.

Files Required:
  • sametime.jad [Java Description file]
  • sametime.jar [The J2ME Java applet itself]
The first step is to talk nicely to your Sametime server administrator and try to obtain these using this route.  These two files are shipped with the Lotus Sametime server software.

Alternatively, you could download the Sametime v8.5.1 files from jad here and jar here
From the Sametime v8.0.1 zip posted here
but that wouldn't sit well with your Lotus Licence agreement now would it...

The next step is to convert these files into an Android application .apk file. 

Luckily for us, there is an online converter on the Netmite website here.  Just upload the jad and jar files and click Get Apk.  What could be simpler?

Install and Run
Once downloaded, install the apk onto your Android.  I suggest you use the application installs using Astro method if you don't know how to manually install an apk file.

Upon launching the Sametime app for the first time you may be challenged with this dialogue:

Download J2mE

Remember at the top of this post I mentioned that the Sametime app ran in a Java 2 Micro Environment?  This is the prompt to download and install that environment.  Select Get from Android Market and install.  

Once the the J2ME environment is installed and the Sametime app launches OK, configure the client as you would any other Sametime client.  Perhaps a good time to pop back to see the Samtime administrator again?

Then start enjoying some mobile Sametime chat.  

J2ME Screen Size Tweak
One thing to bear in mind when tweaking:
  • Menus options with equals signs at each end make changes to the J2ME environment
  • Menus options without equals signs at each end make changes to the Sametime app itself
These are suggested settings based on running Sametime in a J2ME on the Android emulator and on my T-Mobile Pulse / U8220.  Your mileage may vary depending onthe screen size and resolution of your Android device.

Launch Sametime app / MIDlet
Menu ---> =System Menu= ---> =Settings= --->
  • Untick "Auto detect Game Canvas"
  • My Display Width = 320
  • My Display Height = 450
  • Orientation = Portrait

This is by no means an exhaustive list, but these are the most major bugs picked up so far:
  • Some buttons (most noticeably the send button) need tapping twice to do anything. This is also true for menu drop downs etc
  • Annoyingly changes to the sametime display settings (built into the ST app rather than the J2ME) won't / don't apply
  • Run as a service - it doesn't. Looks to run OK in background, but some android task killers may kill it, or it may silently die for whatever reason [remember that this isn't a native android app, so I don't think we can do anything about this]
  • Chat Screen - the chat screen is too small. I think this might be fixed if we can get the ST settings to apply (bullet 2 above)

Yes I know that this is a "kludge" and I whole heartedly agree that there are issues with running Sametime this way (see the BUGS section for details), but the fact of the matter is that a client created using this method connects, runs and is quite usable.  In fact, given the alternatives (oh yea IBM where the hell is the native Andriod client you promised over eight moths ago?) this works, and works quite well all things considered.

- Chris

Newer Posts Older Posts Home