Tuesday, August 7, 2012

SLT Usage Meter

[This does not work now. Please refer this post, it has browser plugins which do the same thing.]

Application Download Link: http://www.mediafire.com/?5ndfsq7ytz92zu4

One of my colleagues was checking his ADSL usage via the SLT's usage meter found on their website. But it was a lengthy process and practically not worth logging in every time just to see how much he has utilized from his quota. So he requested me to write a windows application to automate it.

I tried to develop it during a weekend and when I was inspecting the http traffic through Fiddler, I found that although the web users have to login to view their usage, the actual page which shows the usage is not checking any user session. That means if we can directly post data to the usage page, we can get the results without providing credentials. The creepiest thing is even we can check other people's usage if we know their usernames! Way to go SLT!

Here you can download the application. It has a really simple interface. You will have to enter your username at start and it will be saved in the registry. The application runs in the system tray and when you click the icon, it will notify you of the total usage. Check out the screenshots.







If you want this app to be loaded automatically when you start Windows, just copy it to your start-up folder.

Do try out the app and comment if you need any improvements to be added in the later versions. Also comment if there are any bugs. Enjoy!

Application Download Link: http://www.mediafire.com/?5ndfsq7ytz92zu4

PS: I wrote a Google Chrome Extension to do the same thing. Go here if you do not trust running EXEs :)

PPS: I ported it to Firefox as well. Get it here.

Monday, July 30, 2012

How to unlock your Huawei E173 dongle

I had a Huawei E173 dongle locked to Dialog and was able to unlock it successfully.
If that interests you, keep on reading... 



Download the following stuff: 
3. Unbranded dashboard (optional)

Steps: 
1. Run the code generator and enter your IMEI. Note the unlock code. 
2. Run the new firmware installer and input the unlock code when prompted. 
3. Optionally install unbranded dashboard software. (Dialog dashboard works with other SIMs!) 

Enjoy!!!

Wednesday, February 29, 2012

C#: Exploring OpenSSL.NET

I am currently involved in a project module which involves a bit of cryptography. The basic requirements are:
  • Generating RSA key pair
  • Creating a CSR file
  • Generating a Checksum
  • Encrypting with private key
  • Reading a certificate file
  • Verifying a signature 
So while I was googling for hints, I came across this free library called OpenSSL.NET which looked promising. Find the code below which I use to accomplish the above tasks.

This function generates an RSA key pair and returns a CryptoKey object. The length of the keys are hard-coded to be 2048.
        /// <summary>
        /// Generates a 2048 bit RSA key pair.
        /// </summary>
        /// <returns>The key container</returns>
        public static CryptoKey GenerateRsaKeyPair()
        {
            using(var rsa = new RSA())
            {
                rsa.GenerateKeys(2048, 0x10021, null, null);
                return new CryptoKey(rsa);
            }
        }

The following function takes in a RSA key and creates a CSR file. I have used a DTO to pass in the additional details needed for the CSR generation.
        /// <summary>
        /// Generates a CSR file content according to the details given.
        /// </summary>
        /// <param name="csr">CSR details</param>
        /// /// <param name="key">RSA key</param>
        /// <returns>The CSR file content</returns>
        public static string GenerateCsr(CsrProperties csr, CryptoKey key)
        {
            using (var subject = new X509Name
                              {
                                  Country = csr.CountryName,
                                  Organization = csr.OrganizationName,
                                  OrganizationUnit = csr.OrganizationalUnitName,
                                  SerialNumber = csr.SerialNumber,
                                  Common = csr.CommonName
                              })
            {
                using (var req = new X509Request(0, subject, key))
                {
                    return req.PEM;
                }
            }
        }

For Checksum generation, which is also knowing as generating the hash, I used the following code. The algorithm was SHA256.
        /// <summary>
        /// Generates checksum using SHA256 algorithm.
        /// </summary>
        /// <param name="payLoad">Data to be used for hashing</param>
        /// <returns>The hash</returns>
        public static byte[] GenerateChecksum(byte[] payLoad)
        {
            using (var algo = new SHA256Managed())
            {
                return algo.ComputeHash(payLoad);
            }
        }

To do RSA encryption, I used .NET's native cryptography methods.
        /// <summary>
        /// Encrypts the data using RSA key.
        /// </summary>
        /// <param name="payLoad">Data to be encrypted</param>
        /// <param name="key">RSA key</param>
        /// <returns>The encrypted data</returns>
        public static byte[] Encrypt(byte[] payLoad, CryptoKey key)
        {
            using (var rsa = key.GetRSA())
            {
                return rsa.PrivateEncrypt(payLoad, RSA.Padding.PKCS1);
            }
        }

Well that's about it for now. I will update this with more functions as I move on.
Cheers!

Arduino Line Following Robot: Cracking the shortest/fastest path on a grid with loops

I'm sure you've created a line following robot at some point, if you've been exposed to Arduino (or any other programmable elec...