Showing posts with label programming. Show all posts
Showing posts with label programming. 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 :)

Friday, May 9, 2008

The Semester is dead. Long live the Semester!

Semester 1A and its exams ended, and the new semester is beginning on Sunday.

This means I've got some spare time to do stuff beside sitting in my room and looking at some papers, so here are some updates on the upcoming projects I'm planning to work on:

iWC - I've decided to discontinue the project, because I've found out this application which allows you to control Winamp, Windows Media Player or iTunes using an iPhone web application. It seems that programming a web application specifically for the iPhone can replace most native applications, and you should give it a try.

However, I'm planning to release the Python Winamp module of iWC, which enables communication with Winamp 5+. I still need to document and refactor it a bit, so I hope I'll be able to release it this upcoming week.

iPhone Synchronization - I'm planning to enhance the currently available iTunes-iPhone synchronization. I know, there are some products which allow better synchronizing, but they cost money, and they are not modular and open-source.

Currently, the main features I'm planning are Facebook synchronization (fetch friends pictures, phone numbers, addresses, websites and so on) and better Outlook integration (such as notes and to-do synchronization). If you have any other ideas, please send me an email or leave a comment.

Smart-Home - I wonder if I shall start working on an embedded project to connect some switches / electronic devices to the wireless network at our apartment in Jerusalem. If you know a cheap wifi microcontroller, please leave a message.

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!

Monday, February 25, 2008

80's The Limit


I'm currently "studying" the course "Introduction to computer science" at the university.

Why "studying"? Because I have to, and because I don't really go to lectures because they are boring as hell and useless.

Anyhow, the course has its own coding conventions and style. Most of the conventions are totally fine and agreeable, but there's one that's driving me crazy - "Thou shall not write lines that include more than 80 characters.".
The reason is not specified (as usual here - why specify why to do something when you can just tell the students to do A and B), but I may assume it concerns the 1980's DOS/Amiga/Mainframes 80 chars limit, when working in textual video mode.

So let's count how many graphical operating systems that can display and print lines longer than 80 chars in one line got released by Microsoft(TM) 'till now:
  1. Microsoft(TM) Windows(R) 3.1
  2. Microsoft(TM) Windows(R) NT 4
  3. Microsoft(TM) Windows(R) 95
  4. Microsoft(TM) Windows(R) 98
  5. Microsoft(TM) Windows(R) ME
  6. Microsoft(TM) Windows(R) 2000
  7. Microsoft(TM) Windows(R) XP
  8. Microsoft(TM) Windows(R) 2003
  9. Microsoft(TM) Windows(R) Vista

And they still haven't found the "Change font size" button... too sad.

Limiting line length is good, but why limit it to the ridiculous number of 80? When programming in an object oriented language, creating a line which calls a class method and specifying 2-3 parameters will exceed this limit. So to avoid losing points an evil linefeed needs to be inserted.

The huge problem here, as I see it, is that most of the people studying with me haven't programmed in a real programming language (not Pascal) and doesn't know how a real-life code should look like. This is one of some bad habits they learn in a place that should theoretically teach them everything they should know about programming.

So what's the moral here? Read Code Complete and forget about people who know nothing about programming.

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