Archive for November, 2010

Setting up 802.11g Wi-fi on Google’s Nexus One

November 21, 2010

I thought this was going to be a really simple, quick and drama free setup.
This wasn’t to be the case.

Process of events

Added a DHCP lease to my routers ARP table… with the MAC address of the Nexus and giving it an IP of 192.168.0.15.
Had quite a bit of trouble getting my Nexus One to establish connection with my Netgear WG102 AP.

 

 

 

 

 

 

 

The connection using WPA2-PSK with AES encryption most of the time wouldn’t work.
There was allot of posts about this on the net, especially on the Nexus forum.

 

 

I tried most things mentioned in the following posts, including giving Nexus a static IP.

http://www.google.com/support/forum/p/android/thread?tid=670e46135cadce1e&hl=en
http://www.google.fi/support/forum/p/android/thread?tid=0bb4d777a20330c3&hl=en
http://www.google.com/support/forum/p/android/thread?tid=07bbaac95aef0a15&hl=en&start=40

After quite a lot of reading, it seemed that the Nexus One’s support of WPA2 was flaky at best.
It also sounds like quite a few other mobile devices only support WPA1 which uses the older TKIP encryption technology.
In saying that, it’s still considered secure so long as you use a decent sized PSK. 256 bit for example.

Using the following sites, I decided to setup another wireless network on the same AP using a different SSID, using WPA-PSK with TKIP.
This worked fine. I then tried to connect to the previous WPA2 network and it worked flawlessly.
So yes, I was a little confused.
The next day after a shutdown / restart of the Nexus, comms still seems fine.
So at the point of making this post, the confusion remains, but it works :-).
If it stops working again, at least we know we still have the other option of using WPA1 with a decent PSK.

This site does a good job of explaining the differences in the wireless protocols I’ve talked about.
http://compudent.blogspot.com/2006/09/wireless-wep-vs-wpa-vs-wpa2.html
Also has a link to…
https://www.grc.com/passwords.htm

Which generates 256 bit random keys, ideal for AP WPA1 and WPA2 encryption.

If anyone has any trouble in this area, sing out and I’ll do my best to lend a hand.

A bit of an update on this

After a week the N1’s wireless interface apparently stopped trying to connect to my Wifi.
I tried the WPA1 network again, with no joy.

I talked to a friend that also has a N1 bought through Google, rather than Vodafone.
He has had the 2.2.1 ota update for a few months.

http://en.wikipedia.org/wiki/Nexus_One states:
“Although the European, Australian and New Zealand Nexus One phones sold by Vodafone are not locked to the network of the provider, they are locked to a special Vodafone-specific system software, making it impossible to receive updates from Google.”

If you for some reason haven’t received your update yet, and are still running the stock ROM, you can follow the directions here and here to get onto 2.2.1 FRG83D.

Since the update, I haven’t had any Wifi comms issues.

VisualHG works nicely in VS 2010 rtm

November 20, 2010

 

For the uninitiated…
VisualHG is a Mercurial source control plugin for MS Visual Studio

 

 

 

 

I had a bit of a problem with VisualHG a couple of weeks ago.
The overlay icons work in Visual Studio, but the context menu had no VisualHG icons and the VisualHG toolbar was inactive (had all the buttons greyed out).

Tried uninstalling / reinstalling visualhg.
Version: Visual Studio 2010 Version 10.0.30319.1 RTMRel Premium.
OS used: Windows 7 Enterprise x64.
VisualHG 1.1.0 installed.
Seems to work in VS 2008 though.

Solution

Remove all instances of VisualHG in Programs and Features.
Search the Program Files and Program Files (x86) for instances of visualhg and remove if they exist.
Search the registry for VisualHG related items (entries as well as keys). Delete them all.
Reinstall the latest version of VisualHG (currently 1.1.0).

Posts and links that provided resolution:
http://visualhg.codeplex.com/Thread/View.aspx?ThreadId=209792
http://visualhg.codeplex.com/workitem/36

Online Security – Teaching the Good Guys Bad Tricks

November 17, 2010

The company I work for during the day (PayGlobal) has been good enough to let me take the time off and pay for me to attend a half day seminar on security.
Security in software and networks is one of my passions, so hopefully I’ll get some good content out of this.

The agenda is looking pretty good.

* Cross-Site Scripting (XSS)
* Cross-Domain Request Forgery (CDRF)
* SQL Injection
* Man-In-the-Middle attacks
* Have an appreciation of how layering your defenses (defense-in-depth) that can help protect you from exploit chaining.

Check this out for details.

 

If anyone else is going that wants to catch up, sing out, and we can throw some ideas around 🙂

 

Java C# Similarities

November 14, 2010
Part 1

In this post, I’m just going to go over setting up command line compilers for C# and Java.

I was recently helping someone with a Java based project, so had to brush up on my skills in that area.
I haven’t had a need to use Java for a while.
Java is quite similar to C# in many ways.
When it comes to working out the similarities, I think it’s actually easier to work out the differences, because there are less of them.
It often feels like C# is just a more mature Java, with more features and bigger libraries.
In saying that, Java also has benefits over C#.
We’ll explore some of these in this series.

Without further ado, let’s get started.
The first thing I looked at doing, which I’d been meaning to for a while, was to set up command line compilation for both C# and Java on Windows 7.
The idea is that you can just run a command prompt and the directory that cmd puts you in (C:\Users\Me>), you have access to a source file or files you can build, debug and run.
This saves littering the world with Visual Studios File->New->Project->Console Application’s.

C# compiler setup

You’ll want to make sure you have the .net framework installed.

You’ll need to make sure you have your path variable included for csc.exe (the C# compiler).
There are several ways you can get to your path setup.
I normally just hit the keys [Windows] + [Pause-Break] combination, which brings up System Properties.

 

Go to the Advanced tab, and click the Environment Variables button.
I normally just enter the location of the compiler into the variables for the current user.
Select path, click edit.

 

I’m using .net 4. My path was C:\Windows\Microsoft.NET\Framework\v4.0.30319
If you already have other paths in the text field, past the same path in at the end of the line, but with a semi colon immediately before it.
Like so…

;C:\Windows\Microsoft.NET\Framework\v4.0.30319

If there is no existing path, add one by clicking the New button instead of the Edit button.
OK and apply all of that.
Now at your command prompt if you run path

C:\Users\Me>path

you will see all your path variables.
Now you can just add a file into C:\Users\Me\
This can be the file that you put your C# code into (I just called this “scratch”).

Once you think you’ve got your C# code compilable.
From the command prompt, type.

C:\Users\Me>csc scratch

That’s it, providing you have no errors your assembly is built.
If you’d like to know what’s in your assembly have a look here

Now if you want to debug with the likes of cordbg.exe, you’ll need the .NET SDK
You can find it here
At 600MB… I passed on this.
If you do decide to install the SDK, you’ll need to add the path, then you should be good to start using cordbg.exe.
Details on how to use cordbg.exe are here

I found the following links helpful.
http://www.johnsmiley.com/cis18/Smiley037.pdf
http://msdn.microsoft.com/en-us/library/ms379563%28VS.80%29.aspx
http://blogs.msdn.com/b/windowssdk/archive/2010/05/25/released-windows-sdk-for-windows-7-and-net-framework-4.aspx

Java compiler setup

If you haven’t already got it installed, you’ll need the Java Development Kit (JDK).
If you have the Java Runtime Environment (JRE) installed, this doesn’t mean you have the JDK.
If you have the JDK installed, you’ll have the JRE also.
In Windows you can see if you have these installed in Programs and Features in the Control Panel.

I got mine from here.
Once again open System Properties.
Go to the Advanced tab, and click the Environment Variables button.
Under the System variables, select Path, click edit.
As we did for csc.exe add the path with the semi colon in the front if there are already paths in there.

;E:\Program Files\Java\jdk1.6.0_18\bin

OK and apply all of that.
From then on, I just stick my java files in a directory in C:\Users\Me\
This way I just run cmd and cd into my dir that has my java files and I’m ready to go.

To compile your code into a bytecode file with a .class extension…

C:\Users\Me\MyDir>javac HelloWorld.java

To run your new bytecode…

C:\Users\Me\MyDir>java HelloWorld

Details here.

Now if you want to debug your java code on the command line,
it’s a breeze because the jdb.exe is in the same directory as java.exe and javac.exe.

 

All the commands and switches for jdb are here.

The Java documentation is very good, you won’t often not be able to find answers quickly.

There are also online options

Atlassian has some very comprehensive products that may suit.

Or you could go with a very light weight option.
compilr is a good one for C#, VB and Java.

Next post on this topic we’ll go into the language details.

Cya.