Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Saturday, November 8, 2008

The End of Annoying OTP's

If you're a student in CS at the Hebrew University of Jerusalem, you're familiar with OTP's (one time password) used to connect to the university servers from remote, submitting exercises, receiving grades and so on.

There are currently two ways to generate OTP's:
  • If you have a java-enabled phone (Nokia only) you can download an application called HOTP which will allow you to generate an OTP with each button click.
  • If you don't have a Nokia phone (like I do) you have to enter a website, fill your unix username and password and answer a CAPTCHA. Then SMS is sent to your cellphone, including 5 OTP's.
Needless to say, the latter option is really annoying, especially when you need to use the OTP 4-5 times in a row while submitting an exercise (connect to an FTP server, use SSH, enter the submission system and so on).

So I decided to create my own OTP client which will be able to generate OTP's locally. The main target was to create a program that will copy the next OTP to the clipboard, which will allow easy transportation of the 5-digit password.

I simulated a download of the HOTP program, and decompiled it (Jad rules). The code was scrambled, but I figured out by using the koders search engine that Java's bouncycastle package is used there. This package gives a lot of encryption services, and here they use the Rijndael (original AES) and the HMAC SHA-1 encryption in order to generate the OTP.

I won't go into further details. If you're really interested in how it works, you can go over the script's source - it's not that complicated.

Some installation details:
  • Very important note: if you're currently using the HOTP application, installing this script (requesting a new HOTP application download) will make your cellphone HOTP application broken. This is caused because the key counter is randomally selected each time an application is generated for download.
    If anyone of you sees this as an important issue, leave me a reply here or send me an email.
  • You'll need ActiveState Python (version 2.4 and up).
  • If you're using other operating system than Windows, you can still use the script, but the clipboard option will not work (only printing to stdout).
  • After installing python and downloading the script, run it without parameters and installation will begin.
  • For further options, use the --help or -h switch.
You can download NOTP from here.

Have a great semester :)

Monday, May 12, 2008

Python Winamp Control Module

As expected, I'm posting my iWC's Winamp control module here.

The module works without the need of installing a plugin in Winamp, hence it does alot of IPC (some of it is totally undocumented, and I think that even Winamp's developers didn't think of using their media library in such a way, but who cares).

All of the functions are documented beside of the three most complicated ones, because I'm just too lazy - so if you're really interested I can spread some lights on the ugly hacks I did too.

Get it from here.

Requirements: ctypes, win32 python modules (comes with ActiveState's python), Winamp 5+.

Feature request / comments - just leave a comment here.

Have fun!

Sunday, March 30, 2008

Some Updates


Hey mates,

Haven't got alot of time to write because of this crazy semester going on...
So this is the last week of semester 1A (the one which started after the strike), and the exam season will begin next week with a fine one in Mechanics, and after that there will be alot of fun with Infinitesimal Calculus, Intro to CS and Discrete Mathematics.

To the more interesting updates: I'm working on a small project, which is currently called iWC and its purpose is to remote control Winamp from the iPhone (possibly creating a similar iPod interface for that).

The iPhone has some remote control applications for your computer, mostly using VNC, but I want a clean and fast interface for song selection, volume control and so on.

So right now I'm working on a module that will communicate with Winamp using window messages (their API is one of the worst I've seen, but is full with funny comments - mabye I'll post some when I'll have some more time). After I'll finish that one I'm planning creating a client using RPyC and pyobjc.

That's it for now - I hope to give more updates soon about my progress.

And until next time... cy'a folks!

Saturday, January 5, 2008

Suggestion for a new Facebook API function

After I got a message from a 16 years old girl (does she knows how to write?), I thought about a new function that facebook applications should use:

def is_legit(filrting_girl_age):
    if self.age / 2 + 7 > flirting_girl_age:
        print "What the hell were you thinking!"
        return wtf
    else:
        print "All is good, you can go now!"
        return true