Thursday, July 30, 2009

T-Mobile API

I currently have a mobile account with T-Mobile, who give me a generous £200 worth of credit each month for £20. It is actually quite difficult to take advantage of all the credit, I usually only utilise about £100 a month of it. So I decided to take advantage of it by writing a Java API for accessing and using certain features of my T-Mobile account. I have been using my T-Mobile API in my software, such as the HSBC bot to deliver updates to myself. Using my T-Mobile API is extremely easy, here is a taster.....

TMobile tmobile = new TMobile("username", "password");
tmobile.sendSMS("01234567890", "Hello World!");


In order to use this API you must have an account with T-Mobile (http://www.t-mobile.co.uk) and the ability to send web texts from your account. This API is reliable and stable. It is ideal for utilising it for desktop and web applications. If you would like access to this codebase please contact me via email.

Sunday, July 12, 2009

Windows Storage Server 2008

Yesterday I replaced my FreeNAS with Windows Storage Server 2008. While FreeNAS is a great piece of software I finally realised it just wasn't for me, mainly because I am more comfortable within a Windows environment but there were some fairly big issues such as:

1. No JVM (You would have to install Diablo on FreeNAS if you wanted one and I like to stick with Sun's JVM). I do alot of Java development and really want to customise my Storage server with custom tools.

2. Bit Torrent client - Transmission is the default client and it seemed to prove a headache for many if wanting to update it. Most people just waited for the FreeNAS update which usually ships with the latest version. I wanted uTorrent back as it is by far the most lightweight, feature packed and fastest BT client I have ever used. Tranmission would only give me download speeds of around 3.5MBps but uTorrent is able to max my line at 6MBps.

Oh, and one more thing, I was quite surprised when I first booted Windows Storage Server 2008 to see that if was prompting me for credentials when I have never supplied any. The default password is "wSS2008!"

Tuesday, June 30, 2009

Adam Boulton's Java HSBC API - No, not the payment gateway!

So, I have finally got round to setting up the HSBC Java API (some of you may remember my posts from months back mentioning my personal project I was working on HSBC Bank account aggregation). Writing this API has been a personal project of mine which has been on and off for a while now due to other committments. The idea behind this API is that it easily allows you to access your UK HSBC accounts and transaction history. I have so far found it useful for tracking my expenditure (by grouping transactions) and using it for notifications about the most recent transaction to be processed on my account. I am sure many developers will find this project interesting and will find many interesting ways to incorporate it into their applications.

I have finally started a Google code project......



Java PDF Library

I have been playing around with extracting data from PDF files. Apache PDF Box looked pretty promising but unfortunately it is far behind some of the others that are available. iText is a mature library but lacks the ability to extract information (it is actually a PDF creator). I was very impressed by the work done by LAB Asprise!. It took minutes to understand their impressive API and start coding. The parsing is fast, and so far appears accurate. The library is also extremely small for the abilities it provides (just over 3MB). If you are looking for a powerful Java API for processing PDFs then I strongly recommend it. Here is a code sample for extracting text (taken from their site). The code clearly demonstrates how much of an awesome job these guys have done....

PDFReader reader = new PDFReader(new File("my.pdf"));
reader.open(); // open the file.
int pages = reader.getNumberOfPages();

for(int i=0; i < pages; i++)
{
String text = reader.extractTextFromPage(i);
System.out.println("Page " + i + ": " + text);
}

Thursday, April 9, 2009

Security Assessing Java RMI Slides

There has been alot of interest lately in RMI security and people trying to hunt down my slides from the presentation I did at OWASP. The slides can be found here.

The original presentation can be found:
http://video.google.com/videoplay?docid=1673714450539106400#

Wednesday, March 25, 2009

Editing webpages with JavaScript snippet

So, most of you will no doubt know that you can execute JavaScript from the URL bar and how useful it can be. For example, you could view the text is password fields which has proved to be useful on several occassions (alert document.form1.passwordField.text) . An interesting JS snippet I came across was:

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

Just type that into the URL, then you can start editing the webpage you are viewing straight from the browser.

Tuesday, March 10, 2009

Disable HtmlUnit logging

HtmlUnit is a pretty decent scriptable browser. I use it for developing alot of website scrapers and various bots. By default, the logging to the standard output stream is pretty verbose. A quick way to disable it programmatically is to add the following static initializer to your code:

   static {
        LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
    }

Strings are immutable in Java. Really, Mr. Anderson?

Take a look at the following code, the output is not what you may expect ;)

//MindWarp.java
public class MindWarp 
{
  public static void main(String[] args)
  {
    System.out.println(MR_ANDERSON);
  }
  private static final String MR_ANDERSON = "Adam, RIM Security Researcher";
  private static final Warper warper = new Warper();
//The hackers class ;)
}


//Warper.java - Hacks the String object which is on the heap....
import java.lang.reflect.*;

public class Warper 
{
  private static Field stringValue;
  
static 
{
    try
    {
      stringValue = String.class.getDeclaredField("value");    
//String has a private char [] called "value"
    }
    catch(NoSuchFieldException ex)
    {
//Should deploy a safety net here i.e enumerate a char[] incase the variable inside the String class is not called "value"
        ex.printStackTrace(); 
    }
    if (stringValue != null) {
      stringValue.setAccessible(true); // make field public ;)
    }
  }
  public Warper() {
    try {
//String must be same length, otherwise IndexOutOfBoundsException
      stringValue.set("Adam, RIM Security Researcher", "You have been hacked! ! ! ! !".toCharArray()); 
    } catch(IllegalAccessException ex) {} // shhh
  }
}