Monday, August 24, 2009

GIT Tutorial[ Cont. ]

Following up from where I left in the last post. I will now introduce you to some concepts where GIT embeds itself into the internet and how it maintains security of project hosted on GIT.

Public Key Cryptography

We all have passwords, but the major limitation of passwords is that it's secret! Yeah, seems very odd ? Also it is a form of symmetric encryption, that is whatever you use as key( passwords ) to lock your data is used to unlock it.

Consider this simple Alice[ Bandi ] and Bob[ banda ] example. Now if Alice wants to send some data to Bob which will be encrypted over the network, they need to decide a way to encrypt it. Suppose they decide to use a simple Shift Cipher to do it. Shift Cipher Works as follows:

Plaintext: abc
Key : 2 ( say )
Ciphertext: (a+2)(b+2)(c+2) == cde

The method of Encryption is open and so is the method of Decryption. The only thing that holds any security is the KEY( 2 in the above case ). But if Alice and Bob are to use the same key for encryption and decryption, then there must be some way to communicate it before they actually do any conversation.! And hence the security of Key falls in hands of method of communication. Suppose we encrypt the method of Key Distribution we're into a loop....!!!

Public Key Cryptography comes as a rather surprise. In this scheme a person has a pair of Public and Private keys( generated by a suitable software ). The above problem of Alice<-->Bob interaction is handled in the following way.

Preconditions: Alice's and Bob's Public Keys are open to everyone, but the private keys are kept secret. A message encrypted by the Private Key can be Decrypted by the Public key and a message encrypted by a Public Key can be decrypted by the private key only.

Message Sending: Alice sends a message "abc"( say ) and encrypts that with the Public Key of Bob. Hence when Bob receives it, only he can Decrypt it with his private key.

If you notice we have completely avoided the problem of Key Distribution.

Public-Private Keys and GIT

Whenever you make a commit to the GIT repository there should be a way in which GIT can authenticate whether you're the authorised person to do so. It contains the Public Keys of all those who are allowed to make changes to the GIT Repository. When you send a message to Repository saying: "hey git, add this file", such a query is Encrypted with your Private Key, GIT knows your username and hence it sees if it has a Public Key corresponding to your username. If it exists, it'll try to Decrypt the query using the Public Key. If successful, that is the query makes sense, it'll authorise you. An incorrect Public Key will give garbage results which GIT will discard.

Making your Public Keys

Making Public Keys is simple and we'll be using a simple software called ssh to do so. All further steps are done on an Ubuntu.

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sanket/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Give appropriate information, remember to give a passphrase it'll save you in case you miss your private key. The key'll be generated in /home/.ssh/
The names of the files will be: id_rsa( private key ) and id_rsa.pub( public key ).

From now on this key is your identity, and yeah it's your universal identity.!

Handing me the keys

As I am the repository owner, you'll have to hand me over the Public Keys. You may do so by mailing me a copy at my email address or Posting on the list itself, Public Keys are meant to be public so don't hesitate in telling it to the whole world ;).

Please mail the file id_rsa.pub ONLY. And also remember to rename it to a username you would like to have.

Recommendation: Suppose my gmail account is: snktagarwal. I would send a copy of id_rsa.pub as snktagarwal.pub. You are also expected to follow the protocol.

Using the public-private key pair in GIT

Now I'll show you how to use your Public Private key pair with GIT. It is assumed that you've already done the following above steps:

  • Made a Public-Private( RSA ) key pair using ssh-keygen. SSH produces RSA Key Pairs.
  • Given me the Public Key with the name .pub
  • I have added you to the trusted users group!
First let's have a view of the project repository online: http://203.110.246.113/viewgit/

In the free_monkey repository you may see many Branches below in Heads section. These are the Branches created by various "Trusted" users. Wait for it, you'll have your own branch very soon :P.

1. Configuring ssh to port 4545

SSH on port 22 is blocked outside halls, so you won't be able to do normal SSH traffic. For bypassing this security you need to be able to talk with my server on Port 4545, my server is configured so as to read on port 4545. Make the following changes:

$ sudo gedit /etc/ssh/ssh_config

Change the # Port 22 to Port 4545.

Before:

# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1

After:

# IdentityFile ~/.ssh/id_dsa
Port 4545
# Protocol 2,1

2. Create a username for yourself in GIT

Execute these commands on your machine to tell others what your name stands for:

$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email mail@domain.com

3. Check out a copy of the repository

It's as simple as it may get:

$ git clone git@203.110.246.113:free_monkey.git

Let me explain this command to you:
  • git@ means that the machine that you are contacting has a user called git which will provide the git services. It could be git or repos or anything depending on the server administrator. Hence in our case I have named it to git on my server.
  • 203.110.246.113 is IP of the server.
  • free_monkey is the name of the repository which has default extension of .git.

If you're successful you'll have somthing like this:

Initialized empty Git repository in /home/user1/git/free_monkey/.git/
Enter passphrase for key '/home/user1/.ssh/id_rsa':
remote: Counting objects: 111, done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 111 (delta 17), reused 0 (delta 0)
Receiving objects: 100% (111/111), 48.99 KiB, done.
Resolving deltas: 100% (17/17), done.

4. Make your own branch and have fun with the repository!

Here are the brief steps to make your own branch, refer to this if you want a review of commands.

$ git branch
$ git checkout
$ vim README
...make some changes...
$ git add README
$ git commit -a -m " branch created and updated"
$ git push origin


The last command needs some explanation:
  • Push: make a commit on the remote server
  • origin branchname: This tells git to push on branchname, which is your branch!

This wiki might be awefully incomplete, but given the time limitations, I am bounded. Please ask any doubts in this post or on the KGP list if needed.!


Sunday, August 16, 2009

GIT Tutorial

Hey guys and gals,

This is my version of tutorial on Git.

I won't go into much details of what git is all about, though you can always go here to have a look, git tutorial, which is actually an excellent boot up guide to Git and it's advantages. To be very precise Git was developed by Linus Torvalds to manage the Linux Kernel Tree and it turned out that Git is presently the best Version Control system on paper and in implementation!

Public and Private Repositories

Repositories are the place where you actually keep your source code. So that a person who wishes to have a look at your code in a programmer friendly way! Also it is used to do collaborative coding, while maintaining an Organizational Hierarchy, it is equivalent to a management system built into the haphazard world of Open Source :).

Public repositories are the repositories which everyone can have a look at. Generally Repositories are public so that anyone can have look, open source needs to be open ;). But the ability to write to a repository still lies in the hands of "the" few from the Circle of Trust.

Private repositories are different in the sense that you can't have a look at the code it u aren't a part of the project, private repositories are rare... though they exist.

Starting a Basic Project in Git

There are a plethora of excellent tutorials that tell you how to use git, and I won't try to reinvent the wheel. Though here's something important to note. As Git is meant for collaborative work, you check out code from some remote host( repos ) and then make local changes, and then push it back to the remote repository. First thing you need to learn is to use Git in the local system. I would suggest you to go through the following texts.

0. Use a Linux Box if you may. Windows users should look at this: windows link. But try to use a linux box because it'll be easier to get help :).

1. Official Git Tutorial - A great place to start, follow the exact steps uptill the point you can pursue. Try to read upto the section: Managing Branches, and yeah work each command on your machine.

2. Those familiar with svn should look at this

3. Once you've dealt a fair deal with using git locally it's time to dive into some Remote servers.

Web View of Git Repository

If you are familiar with version control you might be aware of Web Views for common Version Control services. Familiar are Github, Google Code. You can visit these site and look at an arbitrary project and have a feel of the Repositories. I have maintained my own version of Git Server and the Web Views can be looked up from here. We'll be using this for the rest of the tutorial so make sure you are able to get it work!

http://maillist-cse.iitkgp.ernet.in/viewgit/
or
http://203.110.246.113/viewgit/

Note:- To use the maillist-cse.iitgkp.ernet.in Link please use 144.16.192.247 as your proxy and while using the second link you don't need to change your proxies :).

So you can see a free_monkey repository. It's just a test repository containing some of my interesting source code ;).
Things to watch out for( make urself familiar, now is the time ):

1. When you enter the repository you can see, Shortlogs, Tags and Heads. Shortlogs are the commits that coders do on a repository. Something like you make a local change and push it to the remote server.

2. There are two heads, master and experimental. These are the branches that exist for the code. A single project( code ) can have multiple, non interferring, branches.

3. Some hyperlinks above show a Tree link, which is the listing of code.... the stuff inside ;).

Heads

Heads are the branches of the code. Suppose you wish to work with me on this project, so instead of working on the master copy( which is a compulsary branch ), I would ask you to start your own branch and start commiting there. In our case we have the master and experimental.

You can switch the Code tree for any branch from these links.

Checking out Code

As this repository is public, you might wish to check code to have your own copy to work with. These are the steps you need to do.

First of all, git runs on a ssh service, and as port 22 is blocked in Institue. I am running this server on 4545 port. In a standard ubuntu box you will have to make the following changes:

$ sudo vim /etc/ssh/ssh_config

Search for a line which says "Port". Uncomment it and write: Port 4545. So the section now looks like:

# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
Port 4545
# Protocol 2,1
# Cipher 3des

Cool! Let's move further. You now need to clone the public repository into your computer. Do the following steps.

$ mkdir git # Make a folder for git repositories
$ cd git
$ git clone git://203.110.246.113/free_monkey/
Initialized empty Git repository in /home/user1/git/free_monkey/.git/
remote: Counting objects: 34, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 34 (delta 7), reused 0 (delta 0)
Receiving objects: 100% (34/34), 42.23 KiB, done.
Resolving deltas: 100% (7/7), done.

Voila! We have got our own copy of Git source. These are the interesting things that you might wish to do:

$ cd free_monkey
$ git branch -a
$ git checkout experimental
Note: moving to 'origin/experimental' which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
git checkout -b
HEAD is now at 878804d... Graph for activity logger

If you are done till here, watch ourt for the next iteration of git tutorial. Any doubts, please reply here :)!

Saturday, August 15, 2009

Pidgin Activity logger!

Hey guys,

I am really short of time to catch up with my lunch, and hence excuse me for my gibberish English :P. Recently my dear friend came up with this hilarious idea to log the activity of online users on our Gtalk accounts. Hmm, not a bad idea heh!

So I sat down( many though I was doin madness ) and this is the strategy that I blogged down:

1. Use DBus connectivity to access information from Pidgin client. DBus is a server based model by which you can connect to applications running on your Localhost transparently.

2. Use python as the binding to DBus.

3. When first starting the program, get a count of current online users.

4. Trap signals for Signed In and Signed Out, and whenever one happens, just increment/decrement the count.

5. Log all changes to a file.

6. Make a Graph from the Log file using Matlab.

You would like to see the final output first right ? Heh:


It was a nice experience to jot down the hueristics of your Gtalk activity because we use it way too often. The graph starts at 00:00:00 Midnight for 24 hrs so that makes it one full day. And you can visibly see that the Maximum peak is at about 8-10 Pm and the lowest at around 5-6 AM.

Want your own graph, reply to this post.... and btw I might be releasing a Pidgin Plugin named Activity-Logger pretty soon ;)

For the interested if you can manufacture a plugin earlier than I may, have a look at the code urself: git hub code

Wednesday, July 29, 2009

KGP -- A Juggernaut in the making

KGP -- KGP Group of Programmers, the recursive name shudders through me a flow of intense adrenaline! And I hope the plans and views that I have set for this 'TO BE' giant, turn out frightingly stupendous!

It's tough to say where it all started, but I know where's it going. I don't know if all my friends who have certainly made the abstract plans to hardware fabrication, share the same intensity and far[t] sightedness. I ain't boasting, and u'll realise in a matter of few kilos of words that I really am having a far[t] sightedness :D.

What is the KGP -- to be as simple as possible, it is an effort to produce "sexy" code. Sexy not only in terms of ideas, but in terms of Coding Style, Technologies, Architecture etc. It's an effort to churn out Cormen( the person ), yes why not! We've got to start somewhere, and maybe my batch has to do the dirty work of flooring, who the FUCK cares! What matters is that you contribute, and that contribution is rememberd not as a "Memorial" but as a profession!

I have many plans with KGP, first of all I would like to teach my juniors, teach won't be the right word.. I should rather use guide, towards a learning of practical aspects of coding. Today code is not all about a single piece of C code which can run with the good ol' gcc mybullshitfile.c followed by ./thiswillconquerortheworld.out :D. Rather we need an organised effort, roots of which can be derived from the community of Open Source!

Here I wish to tell that Open Source is a community rather than a category of software, a community which has people who understand the importance of collaborative coding, and also the idiocracies of Licenses etc. And this includes those from the heart of FSF( read Linux if confused ) to the backwaters of Microsoft and there's no one to say that the Microsoft guy should be hanged over all the code he's written. No!, Open Source is a place to learn and not to spread communism!

I like the model of Open Source and hence adopt it for most of my processes of programming, may be it Technologies to choice of Languages this community helps you out anywhere and everywhere :). This is exactly what I would wish to see.. KGP adopting the idiocracy as well as charm of Open Source Architecture. And I am sure working with a bunch of to-be 'Geeks' will be a fun experience!

What can't we achieve, there's nothing out of our reach! Making softwares can be fun and why can't we make competitive code ? All's needed is organised effort and that's what had been lacking till now! I won't be surprised to see scores of ideas in sections like 'Sandbox' and 'Incubation', and many being completed and launched. It has to get bigger! The Juggernaut has to roll to engulf all. Just look at the consequences, we might end up in a system where code is being produced and not just for voluntary ideas but maybe for companies! We can get work for sites of the magnitude of Kshitij and SF, why not ? Aren't we meant for this fate ?

Can't we produce winners in comptt like Imagine Cup, GSoC and lot's more of them ? Just the organised effort was missing and I and my batch hope to fulfil it with our gift to this beautiful institute, a gift to our juniors.... KGP!

Friday, July 24, 2009

SSH Port Blocking and CSE-Xeon server Tragedy

There has been a quite an uproar over the Xeon-64 servers not being able to accept connections by CSE students of my batch.

Abstract

[ For those who just want to know, "can I get to that fucking machine anyway ?" ]

The problem, to put in very accurate technical terms is, Port Blocking on Outbound traffic. SSH runs on Port 22( Default Value/XEON Server) and CIC network guys have blocked all outbound traffic on Port 22 for most of the halls.... ( atleast RK, RP, NH and more... ).

So the simple thing is this, YOU CANNOT HAVE ANY TRAFFIC ON PORT 22 OUTSIDE THE HALLS. Though local( inside halls ) traffic will suffice. And hence if you are too desperate for the 64bit lady, there are 3 solutions from me:

1. Get the Xeon server port changed to something other than 22, say 4455 etc.
2. OR Ask the CIC/Wipro guys to turn the stupid firewall off.
3. Tell the guys at Hall Server rooms, ask if they can get you through

Details

Let's see what exactly is the scene, I wont talk much theoretical nonsence, but rather show you some concrete output to support the facts.

First thing I will do is to ssh the Xeon( 10.5.18.75 ) server with my user

----------------------------------------------------------------------------------------------------------
sanket@sanket-desktop:~$ ssh sanketa@10.5.18.74
ssh: connect to host 10.5.18.74 port 22: No route to host
----------------------------------------------------------------------------------------------------------

Clearly I cannot open the server!

Now I shall try to ssh into Avishek's machine which is in the same Hall as I am:

----------------------------------------------------------------------------------------------------------
sanket@sanket-desktop:~$ ssh avishekbanerjee@10.110.11.209
The authenticity of host '10.110.11.209 (10.110.11.209)' can't be established.
RSA key fingerprint is 99:15:20:66:1f:d7:de:f9:24:be:dc:99:2a:62:6d:26.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.110.11.209' (RSA) to the list of known hosts.
avishekbanerjee@10.110.11.209's password:
----------------------------------------------------------------------------------------------------------

Evidently I can see that avishek's system is open for me on port 22.

Another more "techniche" check using nmap.

Xeon Server: nmap -p22 10.5.1875

----------------------------------------------------------------------------------------------------------
sanket@sanket-desktop:~$ nmap -p22 10.5.18.75
Starting Nmap 4.62 ( http://nmap.org ) at 2009-07-24 19:52 IST
Interesting ports on 10.5.18.75:
PORT STATE SERVICE
22/tcp filtered ssh

Nmap done: 1 IP address (1 host up) scanned in 13.085 seconds
----------------------------------------------------------------------------------------------------------

Avishek's Machine: nmap -p22 10.110.11.209
----------------------------------------------------------------------------------------------------------
sanket@sanket-desktop:~$ nmap -p22 10.110.11.209
Starting Nmap 4.62 ( http://nmap.org ) at 2009-07-24 19:53 IST
Interesting ports on 10.110.11.209:
PORT STATE SERVICE
22/tcp open ssh

Nmap done: 1 IP address (1 host up) scanned in 13.052 seconds
----------------------------------------------------------------------------------------------------------

The results are evident, Xeon server has got no port 22 request, Filtered! But Avishek my friend is very comfy with the thing :D

It's a easy test actually to see if your outbound traffic is blocked. Just try to ssh into a machine you know is ought to be working, and if you can't access.. you're doomed.

Though what I have shown here is Outbound Traffic blocking, and it's actually the case that inbound traffic is totallly okay. Try sshing into your computer from department computers and don't get surprised at the results. ;)

Here's a proof, the machine I will be using is kept in the CSE Deptt and I have access to it( on somehow ). All deptt machines have open outboud traffic, so if I get a filtered output when scanning my m/c in hall, that means that the m/c in hall is refusing!

----------------------------------------------------------------------------------------------------------
mailinglist@maillist-cse:~$ nmap -p22 10.110.11.10

Starting Nmap 4.76 ( http://nmap.org ) at 2009-07-24 20:00 IST
Interesting ports on 10.110.11.10:
PORT STATE SERVICE
22/tcp open ssh

Nmap done: 1 IP address (1 host up) scanned in 5.69 seconds
----------------------------------------------------------------------------------------------------------

I am OPEN! If you can realize the gravity of the results so far, I can go further explaining the network you're inside.

On the basic layer is a Hall which is connected to a Server( often called Server Room as you all know it ). This server, rather a Gateway, connects to the CIC Network Shells( at CIC ), and there's where they put the port throttling etc! But I don't know why is it that they've put it for some of the halls.
What I can suspect is that, maybe somehow, by redirecting the port 22 traffic to some open m/c and then bouncing off requests from that machine, you can be helped out of this port 22 menace. So if the people at the server room are intelligent enough, you're in God's hands I guess :).

Sunday, July 19, 2009

Let's Fly, Cut and Run a Kite with the Kite Runner!

It has been quite a fascinating experience to read the Debut novel of yet another Asian writing prodigy, Khalid Hosseini! The book as we all know, "Kite Runner". It would perhaps be the end of reading spree I have witnessed recently, and now that my breath has become solid and heavy looking at the Semester Performance, I better get some "real books" to read :P

Emotions have always been like a flowing river, uncomprehensible, unstoppable... the style the book's written is no big exception to the fact! I would perhaps go on to comment that, this book is more of an emotion-- cascading like a waterfall --which takes you into a world unknown and unplundered.

With a free flowing hand, and frightful bursts of exemplary imagery, dictionary has been on toes to keep pace with Hosseini's ink. A story truly heart-throbbing and exceptionally serene, takes one into a world few have witnessed. The writer is a small child of "Baba" living in some posh locality of Afghanistan. He and Hasan( their Servant's child ) become the best of friends sharing all possible curves of life, TILL, Amir( the writer ) betrays Hasan and they split.



Amir moves to America with Baba and the story proceeds with how he fights his conscience, which had made him inert to concepts of "Loyalty", "Truce" and "Countrymanship". He returns to Afghanistan, only to discover what his Vanity had hid from him when he was once a child. Without detailing further-- and hence popping the plot --I would recommend you reading this book.

Have a look at the summary for reference: http://www.wikisummaries.org/The_Kite_Runner

Sunday, July 12, 2009

1984 by George Orwell -- Devastatingly Serene !

Recently I laid my hands upon the much celebrated Dystopian Novel in English literature, 1984 by George Orwell. This book written in 1949( The exact details can be wikied out ) has been a relevance even after a Golden Jubilee! There are loads of reviews you could find on the internet, but I feel redundancy has always been a feature of this Webbified world !

Starting off with the genre this book belongs to -- Dystopian, Violent, Sexual and Aggressive -- truly exhilarating! Dystopian Literature is that form of thinking which is restricted to a Policy and Doctrine, the vision of a society in which conditions of life are miserable and characterized by poverty.

And hence the elements of Violence, Sexual Obscenity and Aggression can hardly be left out. At first the idea that:

WAR IS PEACE,
FREEDOM IS SLAVERY,
IGNORANCE IS STRENGTH!

Would make you fretted. Same was with me, though it is easy to swallow the fact that our ancestors could be "stupid" enough to believe in the above non-sense! But after I read the book and the views put forward by Goerge via our Narrator -- Winston Smith, you are made to rethink, with terms like "doublethink", "thoughtcrime", "crimestop"... a whole new train of thoughts tramp through!

Here's my favourite pick of thought: The author justifies pretty effortlessly that War is indeed peace, and here's how.

War has been a way for communities and rulers to impose their power and expand territory. But it has been a nature of law, until now, that one war gave rise to another, one conqueror to other. No one thought of ruling the world, FOREVER. The thought never came as they knew they were mortal, one day they had to give way to thier hiers who could be least potent of taking the legacy forward. But the "Party" which rules "Oceania" -- the piece of land on which our Narator is a part -- has different plans. They redefine war from roots, changing the very behaviour, meaning and purpose!

All that party wants is Power, immense power, a power which gives rise to power! They have a head in the form of Big Brother, whose very existence is doubtful. But one thing that is fixed is the "Party"! No person exist independently, and party shall rule forever as it is immortal. For them the greatest reason for "revolutions" in the past have been the Human Emotions, their heart and ability to think have overthrown empires to dust. The plan is simple, keep them in tight control. How to do it ? Eat up all the resources, drain them emotionally, make sex taboo, beat them, kill them, mercilessly! Monitor them day and night -- Thought Police they call it.

War is just a way to keep the resources busy, away from the reach of common man! What they want is not the betterment of people but more POWER. The wars have never been targetted to overthrow rivals, they hardly happen anywhere other than frontiers. Even the frontiers are ill defined. No major power tries to invade into other's territory... war is a convinient way to divert excess -- rather vital -- resources to wastelands!


Party feels that man can either be free, freedom in terms of intellectual and mental, or happy. Both things don't go hand in hand. It is easy to imagine, happiness is what they give! People are starving, dying, ailing of epidemics, but they are happy -- because the "Party" is their saviour!

I can go on and on with the doctrines of the "Party" and the ways in which Ocieana was controlled. But you would rather get your own hands dirty with the fantastic and heretic novel it is!

Happy Reading

Saturday, July 4, 2009

Spritual and serene.... the BRIDA way!

"Paulo Paulo, where thou get such words to explain the inexplicable ?"

I am all ga-ga with Paulo Coelho's yet another Masterpiece( if I may be least appreciating ), Brida. I had already been through Alchemist, the renowned bestseller! The story is of a girl, with rather extraordinary talents to see into the meta-ordinary. She is in search for a Guide who could tell her about Magic, about all those questions that intrigue mortals like me!

She finds a man who resides by the woods, called "Magus" and he teaches her the importance of patience, courage and the will to go on in life. She also meets "Wicca" who tells her that she's supposed to be a "Witch", one of the four ways-- the virgin, the saint, the martyr, and the witch --to realise one's mission in life!

The story builds around the internal contradiction Brida faces while trying to strike a logical balance between the Visible( Mortals, earth! ) and the Invisible. Invisible here referring to Heavens where all the Wisdom resides, where we have our fathers and forefathers, where there are answers to all !



Brida by Paulo Coelho

The search for spiritual peace and understanding leads her to her mission in life, to protect and pass the legacy witches had always had. She understands the true meaning of a Soulmate, which turns out to be the "Magus" in the end!

Soulmate is considered by Paulo as one of the major reasons of existence of a bieng, and that his questions about life, birth and aspirations could only be answered by the spiritual search for soulmate !

I would quote some stanzas which I see to be of great inspirational help:

1.

" People give flowers as presents because flowers contain the true meaning of love. Anyone who tries to possess a flower will have to watch it's beauty fading. But if you simply look at the flower in a field, you will keep it forever, because the flower is a part of the evening and the sunset and the smell of damp earth and the clouds on the horizon. "

2.
"Being human means having doubts and still continue on your path."

3.
"
And it taught me something else that I'll never forget: finding one important thing in your life dosen't mean you have to give up all the other important things"


There is one thing that people reading this review should take with them. Paulo is a great writer when it comes to influencing people with his sheer superiority of his thoughts, though if you are seeking for a "masala" flick with all those treacherous turns, better not disappoint yourself by taking this work of art! His books can be a rather boor when it comes to keeping the plot, but you need to lookout for those marvellous quotes as some I have posted!

For the record, it indeed is a good read.... go for it :-)!

Friday, June 26, 2009

Literature Gallore!

Though there is a lot I would like to share on this blog, I have a feeling that Blogs are not meant to pour yourself on nitty grity of your micro activities :D! I have been upto some work off late, notably amongst it would be working on the XMPP protocol and reading some of the Classical Literature. In the spree should be mentioned a couple of books which I have recently annhilated to my heart's content, 'The Alchemist by Paulo Coelho' and 'The Paths of Glory by Jeffrey Archer'. Let's have a miniature review of the books!

The Alchemist by Paulo Coelho


This is one state-of-art that made me believe of the capabilities of Literature! I assume that most of you have heard about the book, if not had an eye at this gleaning masterpiece. Religion has always been a dilemma for workaholics and dumbs of my kind[;)]. I have often wondered if those who boister about God, Religion, and Worship would hardly consider the importance of work and ONLY work! I was of the belief-- though not adamant --that work should always precede any other preference AS Work is Worship! But what this book has done is to successfully strike a bewildering concordance between Religion-- in forms of Omens --and ambitions! It is a manifestation of Rituals that one might consider outdated and passe, that have been converted to a substance acceptable by the contemporary society! Paulo Coelho has always been a Religious authority, but the way he has manifested himself into the recent flow of society changes, is not at all an 'ordinary' feat!

I am awestruck by the concordane the book has been able to synchronize with me, and would recommend it to all who wish to find the existence of Almighty amongst their Hectic Schedule.

Paths of Glory By Jeffrey Archer




It is said that the book is a real story, but who'll be amused to read my story ? Huh! C'mon every person on this damn world has his own tale to tell, but writting it down 'just' for the sake of it makes no sense! I hail Jeffrey Archer for the exhilarating display of gleaning bright English, sometimes makes me feel inferior to the richness of language! Indeed the intricate display of words has even kept the Dictionary on it toes! With a myriad display of plethoral diversity, I won't be bemused to see a few guys leave any hope from this book :D!

Though the screenplay has been perfect, I am afraid that the content has rahter blemished the Publication as a whole. The subtitle for the book, "THIS IS THE STORY OF A MAN WHO LOVED TWO WOMEN, AND ONE OF THEM KILLED HIM'. is pretty apt, as you would find out after reading it, but the pace is rather slow, there's no plot or anything of the like .

The story is of a man, a prodigy at mountaineering and first class Alpinist. First he climbs the walls of his college then the Alps of Europe , then the Eiffel Tower and finally set out to conquer the Leaning Lady, none other than 'Mt(Ms) Everest'. The author has impressingly described Everest as the 'Virgin still in slumber, waiting to be ripped through'.

And the other woman is-- pretty obviously --his wife Ruth, who has to muster the pain to live for months w/o him, and finally loses him in front of the more deserving candidate, Her Majesty, Her Highness -- Lady Everest!

The book has a flat paced attire though it talks of bumps and rides through the treacherous valleys and peaks, it is a bit disappointing though it promises a bit more :(!

"""Hope you got my part of story, I would love to hear from what you felt about the books."""

Sunday, June 7, 2009

BSNL Broadband FTP Connectivity!

Bsnl is the 'de-facto' standard for most Broadband using homes, specially in my area. Known for it's cool speeds, abridged connectivity and easy availability from Bsnl landline makes it a very easy and optimum option for most junta.

Recently I was fiddling with the router/modem that the Bsnl guys supply with their Connection. It was pretty interesting to note that you have the option to allow access to some ports like FTP( 21 ), Telnet( 23 ) and even port forwarding.

I dont know if people have tried this thing but I was able to make my computer visible to the internet by a mix of Port Forwarding and Opening the FTP port for access. This guide shall take you through a detour as to how you can be in touch of your Desktop PC connected via a Bsnl Router/Modem anywhere in the world ;).

Know My IP

First thing to note about Bsnl connection is that your global IP( IP of the modem ) is Dynamically assigned by the Bsnl guys. This is helpful in using a smaller range of IP's to serve to a large number of users. Suppose Bsnl serves 1000 connections, but only 500 are online at a given time. If it uses Static IP's then it has to purchase 1000 such IP's! But if it assigns them Dynamically then only 500 shall do... reducing the production cost by 50 % ;)

So in order to access your computer through any Internet m/c you need to know your IP at that given instant. Hmm, I dont know a fixed way to do this, but if ur computer remains on for a particular session... the IP cannot change during that time! You can use www.knowmyip.com for the current session IP.

Typical Results
---------------------------------------------------------------------------------------------------------
Your ip is: 59.95.178.126
Your hostname is: 59.95.178.126

---------------------------------------------------------------------------------------------------------


Hence your IP is the above value! Bsnl has two typical ranges, this is the old modem/router range.

Locally Static IP

The computer which you use to connect to internet is inside the router's network, this is called subnetting whereby a group of computers connect to a common gateway for their internet requests! You can have a good overview here, rather DO HAVE A VIEW AT THIS: http://www.portforward.com/help/portforwarding.htm

You might skip the part from Port Forwarding but the rest is essential for understanding. Your task is to assign a Staic IP to your computer. Then you need to set your computer to a Static IP by the following: http://www.portforward.com/networking/static-xp.htm

For linux do the following:

1. $/sbin/ifconfig -- Note the information corresponding to the Internet Connection
2. vim /etc/network/interfaces

In the interfaces file locate the Ethernet number corresponding to the Internet connection, if it is presently on dhcp the entry will be like:

iface eth0(1) inet dhcp

In this case change this Dynamic Allocation to Staic by:

iface eth0(1) inet static
address
netmask
gateway

And restart networking by:

$/etc/init.d/networking restart

This will give you the Static IP required for the purpose!

Open the FTP/TELNET Ports on Router

The router by default will reject all incoming information that is not a reply to some query by you. But in case you want to access the computer from a remote place you need to tell the router to allow specific port to be open for access. In my router the following page is helpful, it's a bsnl router so log in by putting this in the browser address bar:

http://192.168.1.1/

Use admin:admin as the uname:pass, if you have urself changed it earlier use that pair instead!

Following pics are for UT300R2U Modem.


As you can see that the common services are blocked in here! If you have a page similar to this try unblocking the FTP/Telnet services so as to allow access from outside! This might be just a precautionary measure so that we do not get locked from router itself!

Port Forwarding

Follow the instructions from http://www.portforward.com/english/routers/port_forwarding/routerindex.htm for your specific router! Remember we will be doing a FTP login... hence forward the port 21 for now. Also allow all ports from outside to connect to your FTP port!

Setting Up the FTP

There are many lot Operating Systems and also solutions for a FTP server, my personal choice is vsftpd which is a lighweight FTP server for Linuxes, in case of Windows, try scratching the market for an appropriate solution :).

You need to configure your FTP server according to your own needs, generally you would like to keep anonymous login DENIED so that only authorized personnel( generally only YOU ) may access the resources! I would not go into the working of FTP server as it is not a part of this scope.

Testing the FTP

For testing the FTP there are two ways, one from your own computer or a computer inside the LAN of the router/modem and other is from an external network. The better of the two is to use the external network, but then you'll have to find a patient person to give instructions :P.

From within the computer

Ftp into the local computer set for port forwarding
--------------------------------------------------------------------------------------------------------
$ftp 192.168.1.4
Connected to 192.168.1.4.
220 (vsFTPd 2.0.7)
Name (192.168.1.4:sanket): sanket
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
--------------------------------------------------------------------------------------------------------
This output shows that your system is accepting FTP connections from local network.
Try to retrieve files,
--------------------------------------------------------------------------------------------------------
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 2 1000 1000 4096 Jun 05 06:08 Desktop
<...>
drwxr-xr-x 24 1000 1000 4096 May 18 07:47 netbeans-6.5.1
-rw-r--r-- 1 1000 1000 11 May 19 19:17
<...>
226 Directory send OK.
ftp> get output
local: output remote: output
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for output (11 bytes).
226 File send OK.
11 bytes received in 0.01 secs (1.3 kB/s)
ftp>
------------------------------------------------------------------------------------------------------------

The file is saved to the folder from where u executed the FTP command!

Testing from external network is more essential!

Testing from External Network


Testing from external network shall require a external computer, maybe some friend who's willing to help you out. The procedure is pretty simple...

Get the external IP of your Router/Modem from http://www.knowmyip.com/
Tell ur friend to log into the system by,
$ftp

Rest checks are same as for an internal network!

Here are some snippets of my friend accessing my system from outside the network :)



Note that here while pasting file it gave 550 error! That is because my FTP server was set up so, please make sure your FTP settings are cool enough!




Saurav using FireFtp to do FTP transactions

Saturday, May 30, 2009

Mailman - Python powered mailing list manager

This post can be entertained by people who are list administrators wanting to add Custom Handlers to their mailing lists or audience to learn what Mailman is all about.

First I would like to congratulate all the people at GNU for churning out such useful *and* free softwares( read Free Software Foundation ). Hats off to Stallman for the phenomenon called GNU and FSF!

So what is Mailman all about, it's a mailing list manager... something very similar to a google group. When you start a google group you get an account where you may make changes, moderate and do stuff... but you have a limit to customization! The more common and professional way to manage mailing lists is to use Mailman ( or other mailling list managers )! My version of setting up the server was a complicated one though... it included the following steps:

1. Deploying a Mail Transfer Agent Locally, i used Postfix, other choices- Exim, Sendmail
2. Installing mailman on the same server, there are lot of permission issues.... be really aware of them :D
3. Testing the server and the mailman installation, if everything is right do next!
4. Customizing the installation with Filters you would like to have, Mailman has an easy interface to write plugins in Python
5. Getting a Global Domain so that servers like google, yahoo can connect to me on port 25( SMTP )
6. Initializing lists and populating members through the Web Interface( the coolest part ;) )

I'll take up step 4 for you guys.... rest steps require more of installing capability and negotiating it out with your ISP to grant you a DNS entry :D ( our side ISP's are cool enough ;) ).

The architecture of Mailman has a feature called pipeline, if you lookout for the file Defaults.py in mailman/Mailman/Defaults.py somewhere in /usr/lib or /var/lib or /usr/local/lib. There is a setting variable called GLOBAL_PIPELINE. This is a generic setting of the process a Mail has to go through. Though there can be exceptions for lists or mails directly to the Admin. You just need to place your own Handler in some suitable place. No, no dont edit the Defaults file, do this rather:

in mm_cfg.py add:
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Hold'), 'MyContentHandler')

This adds a handler called MyContentHandler.py BEFORE hold. The corresponding file should be pasted in Mailman/Handlers/ folder.

[Remember whenver you make a change to the MyContentHandler.py file reload mailman, the workaround could be to compile it locally... do as you wish!]

I'll post the handler I wrote... :

#Author: Sanket Agarwal
#Email: sketagarwal@gmail.com

"""Determines whether the content of the message that has been passed to mailman conttains any 'restricted' words!"""

#All imports taken from Hold.py
#TODO:Eliminate the non necessary ones
import email
import Hold
from email.MIMEText import MIMEText
from email.MIMEMessage import MIMEMessage
import email.Utils
from types import ClassType
import re

from Mailman import mm_cfg
from Mailman import Utils
from Mailman import Errors
from Mailman import Message
from Mailman import i18n
from Mailman import Pending
from Mailman.Logging.Syslog import syslog

# First, play footsie with _ so that the following are marked as translated,
# but aren't actually translated until we need the text later on.
def _(s):
return s

#The custom error class
class ForbiddenContent(Errors.HoldMessage):
"""This class defines our custom error for filtered content"""
reason = _('The content posted was caught in the filters!')
rejection = _('This message cannot be accepted.')

# And reset the translator
_ = i18n._

#The malicious content filter

def is_illegal(thread_text):
""" This function Returns a true if it finds a piece of illegal/illicit content in the message text, the whole thread has to be parsed unfortunately, as the sender can easily modify the message in case we neglect the history of the thread """

find_match = re.match('\w*bad_word\w*',str(thread_text))
if find_match == None:
return True #Content is cool enough
else:
return False #Restricted content found


def process(mlist, msg, msgdata):
#Experimentation period!
thread_text = email.message.Message.get_payload(msg)[0]
if( is_illegal(thread_text) ):
raise Errors.RejectMessage, "Your messaage was perhaps marked as containing some restriced content... such strikes might ban you from the list! \n -Sanket \n List Admin"
Hold.hold_for_approval(mlist,msg,msgdata,ForbiddenContent)
else:
pass


Pretty cool huh ?

You can have a pigmented version at my website.... http://maillist-cse.iitkgp.ernet.in/kgp/cab/4/

So referring to the pigmented version lemme take you through the code:

Ln: 1-2 , Thank you guys :D
Ln: 6-22: Pretty much from the Hold.py, I had to hold the messages that were caught... so that's why Hold.py
Ln: 40-58: This is the logic which checks if the message text contains bad content... using regular expressions is the best bet! Have a look at the python re docs for details.
Ln: 30-33: Extends the Errors.HoldMessage, a hold of message means that the message will go for moderation!
Ln: 50: A must have method, every handler has it... so should you!
Ln: 52: Extracts the text part of the message, look for Pyhton email.message Docs for details
Ln: 54: Here you go! The message shall go to the list-owner for further approval!

I liked this plugin thing because it makes all the more sense to make my filters only for Mailman or for that reason, the script might be restricted to a particular mailing list( I'll give the link... keep reading ). U might not have the server write privelages to properly setup a SpamAssasin or some other mail filter, but when you've got the Power of Python and Source of Mailman. Go here for a more technically sound version... but you wont find the code newhere else ;)

http://wiki.list.org/pages/viewpage.action?pageId=4030615


"""May the source be with you"""

Friday, May 29, 2009

Mixed Bag

This is what happens when you think too much for the title of your post... you end up with such a gross one, "Mixed bad", eh?

But as I always talk about what I've done in the last few days or weeks, perhaps a fortnight... this time I really have some mixed stuff in store.

West Bengal.... the first thing that might come to your mind is Mr Karat, who lost the battleground to the Gandhi Family but what comes to my mind is not the Communist but something way more dreadful, something which you can't escape... not even in your sweetest of sleeps[non wet ;)], a nightmare and day killer.... the HUMIDITY!!!!

When you've got a 90-95% average humidity and rainfalls which do no good for just over an hour of their vicinity, life's real tough. But as you might have heard, Aila Cyclone hit West Bengal ... though it didnt cause any regretable damage... trails are still visible, and roads say it all... here are some pics of the same:-

Just outside my hall, RK Hall of Residence

Water cluttering the ground... things were much worse in night

One of the "not so common" areas of the campus!


The trails of the monster are visible, but as the campus is fairly scarcely populated nowadays, the aftermath was not a big deal to handle :D.

But things in life are more important than L[Aila], and I being a fraction of workaholic did some progress in terms of my present works.

If you followed my posts... I am presently working on setting a mailserver, a webserver and a NLP project.

Well today I am going to discuss a bit about how domains are maintained, which is of direct consequence to mail/web or any sort of networking!

Consider the familiar www.google.com, www.yahoo.com or the less familiar like, cse.mit.edu.
Whatever I've written above are common in terms of regular use... but the concepts which make them theoretically consistent are pretty interesting.

So we know that when we give a address in Firefox it translates them to IP addresses.... if you didnt now you know.... :). Every human readable URL( Universal Resuource Locater ) converts to the computer format of xxx.xxx.xxx.xxx eg: 203.9.8.17 or 77.45.32.22 etc. I use the tool called 'nslookup' to do such queries... lemme take you through some output:

###############################################
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 209.85.153.104
###############################################
Name: google.com
Address: 209.85.171.100
Name: google.com
Address: 74.125.45.100
Name: google.com
Address: 74.125.67.100
###############################################
Name: gmail.com
Address: 64.233.161.83
Name: gmail.com
Address: 74.125.79.83
Name: gmail.com
Address: 209.85.171.83
################################################
mail.google.com canonical name = googlemail.l.google.com.
Name: googlemail.l.google.com
Address: 209.85.153.83
#################################################

So I made four IP addr lookups... www.google.com, google.com, mail.google.com, gmail.com

For a n00b, www.google.com and google.com are the same... aren't they... they dont make a diff when put in a browser ;). So are mail.google.com and gmail.com!

But in fact the above results show that something peculiar is going on!

This is what actually happens for finding the ultimate IP address corresponding web addr. Suppose I put cse.iitkgp.ernet.in and try to find the IP address... my computer will contact the "in" Domain Name Server which will have all entries which end with .in. Eg: ernet.in, gov.in etc.

As our target URL has a ernet.in we'll get the IP address of the ernet.in domain.
###########################################
Non-authoritative answer:
Name: ernet.in
Address: 202.41.97.64
###########################################

The DNS( Domain Name Server ) of ernet.in will have all entries of URL's which end in ernet.in.. eg: iitkgp.ernet.in BUT NOT cse.iitkgp.ernet.in because it is two domains deeper!

So we goto: iitkgp.ernet.in

###########################################
Name: iitkgp.ernet.in
Address: 144.16.192.55
###########################################

Then we'll goto cse.iitkgp.ernet.in

###########################################
Name: cse.iitkgp.ernet.in
Address: 144.16.192.57
###########################################

This is the order of the traversal... the IP's are just to tell that the long names are not just a conincidence... suppose you have a domain myspace.com anything preceding it will be your domain and you'll decide who owns it or not! So a URL like user1.myspace.com will be owned by myspace.com, and user11.user1.myspace.com by user1... if user1 has bought the full domain( there are some caveats here ).

This explains the difference b/w google.com and www.google.com. google.com is under the DNS servers of com and www.google.com under DNS of google.com! It's not a compulsion that all sites which have a website start with www, it's just a standard... I am not sure how Firefox guesses if www is to be prepended but all that should be doing would be nothing more than mere manipulation!

Like DNS translate URL's they also translate MRL's . There's a specific entry in the DNS telling who handles the mail for a particular domain... eg gmail.com :

##############################################
gmail.com mail exchanger = 30 alt3.gmail-smtp-in.l.google.com.
gmail.com mail exchanger = 40 alt4.gmail-smtp-in.l.google.com.
gmail.com mail exchanger = 5 gmail-smtp-in.l.google.com.
gmail.com mail exchanger = 10 alt1.gmail-smtp-in.l.google.com.
gmail.com mail exchanger = 20 alt2.gmail-smtp-in.l.google.com.
##############################################

A domain might have many [M]ail [E]xchanger records to signify that if one goes down... other picks up the mantle.

The above description is not by any means theoretically perfect or practically sound, but it does give an idea about how the Internet is one big database... one domain contains the information for other domains beneath it in the hierarchy! The experience of setting up a Mailserver has enlightened me about the Internet structure of my institute... and as it is one of those "restricted" and "secure" networks which is handled in a very careful manner, working my way out with the ISP was not an easy task at all... my mailinglist server is up and running... you might catch a glimpse of the web interface at:

http://maillist-cse.iitkgp.ernet.in/cgi-bin/mailman/listinfo/

Suggestions or accolades on mailing list, please do comment[ i am looking for a content filters, in case you have an idea]!

Well the second thing on which I've been on a high is the website I've been developing with one of my "brilliant" friends... we've worked most of the stuff out... you might catch a glimpse of the
same at:

http://maillist-cse.iitkgp.ernet.in/kgp/

The URL's might not work properly, but I'll fix them by time you visit the link.... do have a look :)!




Saturday, May 16, 2009

Knock Knock...... it's the mailman!!

If you had a brush through my last post, you would have noticed that there are a lot of things I have been doing around. Though, being practical one can easily realise that doing all of that simultaneously is, GROSS! You just can't do all of that....... if you can, then most invited to do this post!

I took up setting up the Mailing list server as my first task. Lemme tell you something about what it is all about... all you guys interested abt techie talks, here we go:-

Mailman is a mailing list manager, well all of you must have heard of Google Groups... where you can post common mails on different threads. Mailing list is the more generic version of Google Groups, generally a more crude and uneasy interface. Though it is much more elegent in the terms that you can have MUCH more control over the people who post, how they post, setting up spam-filters, blocking out open relays and all sort of that crap.

I have done quite a bit of fiddling with this tool and have a copy of it running safe and sound on a local server. I used Postfix as the Mail Server( MTA ). There's a request for a global IP to be assigned to me so that I can test my postfix installation with the more common Gmail, Yahoo or Rediff servers on the NET.

It's more of a legacy that will be left behind, the main purpose for scripting this kind of server was to maintain a archive of all discussions that might have taken place somewhere on some topic. It is generally found that later these discussions can be helpful... maybe in some research or someone interested in exploring!

Let's hope i can finish it up ASAP :D!

The second thing that I have dived into is Django.... sincerely speaking it roxx! You cannot get enough, and when I had a completely working site with a Forum, Blog, Code Post Space and generic featues like Login/Sign Up..... I was taken aback. Well Sumit has been quite a handful... having done all the CSS and templates part he's been the guy to watch out for.

The MaximumEntropy Part........ ummm... havent really got into that much though Rohit has been pretty upbeat with it.... but i'll get to it once I finish the Mailing List business.

Chao :)

Friday, May 8, 2009

Maximum Entropy

The previous post had a nice time sitting at the top, many factors like End Semester, then pressure to get a project and the society work have lead to a lag in the blog roll! Let's let it roll :D

These few weeks, mabye 1 or 2, have been pretty random in terms of the activities I have done. Ranging for complete fart to some real research mathematics. But yeah I am not sure how things will converge till the month's end when I plan to leave Kgp and join my frnzz back home.

I'll take you through a detour of the activities I pursued during these few days, not chronologically but logically :P

1. Well the first thing that I always had in mind was to do something in Web development. I've been pretty much scared by it due to lack of information and having done no server programming! Having your own society and working for it is turning to be a cool detour. But as you might guess web was never a single handed task... you need to design the backend, the fu**** html code and ofcourse use a connecting interface like php!

Cut the crap pple, who does all the suff nowadays, and being a vigilant open source follower I had heard about a Python web Framework called django( www.djangoproject.com ). It's a MVC( Model View Controller ) type of architecture. MVC is a fancy Jargon which imposes a clean and modular way to build applications. In our case the Database( Model ), Html( View ) and the logic( Control ) part are force seperated from each other.

The coolest thing about Django -> you never need to see database programming<- totally :D. And the hottest thing... the admin interface is already there, a template good enough to populate your blogs or file upload lists. Of course, programmers are most reluctant to build cool admin interfaces for themselves :P, you cant have your cake and eat it too. Django comes to your rescue and gives u a default interface!


Django Admin Interface( database layer developed my me )
I am strongly going to use this framework for the future development of the site, python is the future and anything that flows with it becomes gold!


2. Voila I started poetry again, well this is a very unlikely part of me, but I do write some very gross poetry! I wont go into the details because poets have long and tragedic detours... anyways. So I have started again and thats what counts... though have written only one, I hope to gain pace as time progress... it's tough to get solace in hot and humid Kgp :P

3. Literature again, I am scoring pretty high ;), Dan Brown! Yes the master plotter is back with all his wits and enthralling display of writting skills. I have got hands over the "not" so celebrated book.... Digital Fortress... having completed 90% till date I hope to gobble the remaining part in nick of time. But he totally rox ;).

4. Mailing list and Admin work: If you have been a part of a google group or a "mailing list" to be more professional, you might have observed the simplicity of idea but the great utility. Well some of the department seniors had suggested to establish a local archive of mails and discussions via a mailing list server. I am onto it right now and can be found sitting in my cabin in the research lab of CSE department ;) ( Seriously pple ! ). Havent actually got a great hint of how exactly I would be doing it, but challenges is what I think are common and there's nothing you can do avoid them... so just live with them.... hehe...

But tweaking with the Dns and understanding the priciples behind the "Firewalls", that, so often stop breach of malicious code is very enlightening! Kudos to CSE deptt for being supportive( so far ) :D

5. Last but not the least... the reason I am rubbing my Ass on 45 deg celcius and 90% humidity. God yes a dammed project. Comming to the domain, it is in the field of Natural Language Processing. The work is pretty straight and I feel it'll turn out to be very interesting to implement the ideas. The best thing is that we've got a target and that too short termed. This helps up to see the direction and gain motivation.

But why did I name this post "Maximum Entropy". Interesting enough the project on NLP ( Nat Lang Procseeing ) is aimed on working on a method of modelling called MaxEnt( Maximum entropy Modelling ). And a brief definiton of the same will enlighten the reason for this post being named so :)


"When trying to model an environment, try to take all factors into account but assume nothing about what you are not sure. Thus you maximize the entropy, or freedom, of the system. Such a model is perfect as it'll never give strong and incorrect result. It might refuse to give a affirmative answer, but never an incorrect answer"

Well in my article I think I didnt concentrate on any one topic... rather jumped and bounced over Literature, Web Devel, Mailservers, Poetry and Mathematics! Thus gaining maximum entropy :)

Saturday, April 11, 2009

The Free Software Foundation and Open Source Initiative

Histories have come and gone by, we never stay to remember them, 'cause there's lot more to do, than to remember the chronology of our descend. But what we do remember is our drawbacks, own mistakes... whether it be 10minutes back or 10 decades old! I don't wish to impose any school of thought through this post, what I do intend, is to put up a comprehensive view of what the software movement has been in the for out IT industry what it is was and what promises it holds. Who all are the think tanks and what do they offer. I wish you to keep an open mind through this detour.....

It was back 4-5 decades down the line, when a MIT researcher was fed up with the proprietary licences that he had to manage in order to develop a new concept. The problem he had to face is that, most of his time he was concerned of the budget overruns rather than coding standards ;).

His name, as many of you would have guessed, was Richard Stallman, the father of Free Software and family head of Free Software Foundation! He had the novel idea of sharing....

"You are not humane if you cheat with your neighbours.....",

were his common words.

He started the much needed Free Software Foundation, which was NOT an organization or license but a movement, simply a mass movement.





FREE SOFTWARE FOUNDATION

Thought the flow of events are too long to discuss I wish to tell you how Operating Systems evolved and eloped:

1. I dont remember the first seeds of operating systems but, System V, developed by Kerningham and Ritchie was one the first and full fledged OS developed. They developed it on a very meek m/c.

2. Following System V, BSD( Berkeley Software Distribution ) also started knitting their own Operating System. Finally there was UNIX which was a development version of System V.

3. The UNIX operating system was becoming pretty famous, but the problem being, the source was not open to people.

This is what led to Stallman's thinking of equality, freedom to code and the Free Software Foundation. Influenced by the efficiency of UNIX he sat down to write the whole Operating System( he left the Kernel for the end ) on his own. This can be considered the very root of Open Source Community. Not surprisingly people joined him on his detour towards a new world where there was no owner but contributors galore.

Stallman remarks that he was amazed to see the pace at which patches were included into the system and he was delighted that this methodology worked. He named this Operating System as GNU - GNU Not Unix. But why such a name?? As GNU was much more like UNIX but it had a different philosophy all together, he wanted people to know that there's something different from UNIX, and "that" something is the sole reason GNU is being developed. Hence the Recursive Acronym.

When Stallman had finished the GNU set of utilities, he sat down to write the kernel that would make the system complete( right now GNU utils were made on UNIX ). Interesting development took place at this step, a Finland Phd student was writing a kernel on the very same lines and amazingly he had completed it before Stallman could do it! He was none other than Linus Torvalds.

Linus himself thought on the lines of freedom to source and mild licensing. The GNU took Linus's kernel and attached their patch of utilities. By the while, Linus maned his kernel Linux as it meant Linus+Unix=Linux. The duo of Gnu and Linux is till date famous as GNU/LINUX. Here's a pic of the same.



The Linux Tux flying under the Gnu Bull, Gnu/Linux duo :D

The Open Source Initiative



OSI Trademark Logo

The open source initiative to me was more of a "Commercial Move" aimed at popularising the "Openness of softwares". The benifit? Well, by the name of Free Software Foundation it seemed like they were talking of the "Free Beer" more than "Free Speech"! There were not much of industry involvement or support to the FSF, simply because they didnt see any profitable marketing strategy and the FSF philosophy was more of a NGO... heh.

Open Source Foundation took the task of commercialising the very basics of FSF, though obviously, with some changes. I would not jump to the theoretical aspects, rather would take an example to illustrate the same.

UBUNTU

Known as the household face of "Linux". Here are some facts that'll spill the can of beans, right in front of you.... hmmm. So the first question is, what is Ubuntu, Open Source or Free Software, well it's an Open Source product. Free Software would not have allowed to have any proprietary software support, but Ubuntu has repositories which openly support binary only softwares. Take for example the RealPlayer for Linux, Flashplayer Plugins and lots more! If Stallman was to endorse Ubuntu, he simply would have stripped all those binary only softs.


But dear frnzz, if Open Source would not have been there... Ubuntu wouldnt have been whats it's today... the commercial benifits it claims as having openess to all... whether Proprietary of Free software, is what fills up it's cashbanks. But on the same hand, whatever activity or project it takes up are per Free Software standards.

Undoubtedly.... Open Source has had a practical approach to survive in the market! Some people have called Free Software Foundation as being communal( Communal -- Forcing Some Act ), I personally feel.... having a rigid and unbending view has been their problem.... that is why they never became a reality, remained a mere movement! Open Source has taken the steps in the right direction... and you might find Stallman screaming around.... telling peopple that they are DIFFERENT from OSI. For the facts GNU Operating System is perhaps one of the few "Free Software Project" under the Operating Sys catagory, you might google others, I dont really care.

Open Source or FSF... why should I do it ??

Many of my friends and a new budding programmer asked me recently. Whats the initiative to work in Open Source after all.

I dont want to convince anybody, I work in open source because I love to code, and Open Source projects is where I have no restrictions to learn, read, code and contribute. I love to help my neighbours and if that needs some initiative, you better start preparing for a English Vocab paper as Microsoft have changed strategies for new employees :)

Conclusion

The talk is highly shortened, partly because I've my exams up sleeves and because the History is never easy to interpret. But my feeling about the whole OSI and FSF thingy lies on the commoness of ideas and NOT on the differences. Where FSF is an ideology, Open Source is it's realization and in real time dynamics you need to have optimization( i sound an Engineer here ;) ).

Whats important for me is, if the source is made open... i can use it for modifying... I can code because I love it... I have access to the most intricately written media players, chat clients and his highness.... Kernel! I dont care a damn of what people make out of differences b/w FSF and OSI. I am with the concurrunt views.

May the Source be With you!

Thursday, April 9, 2009

ORKUT HACKED.... JOTIKA LINKS, PORTUGUESE LINKS...

Well it has been a fascinating overnite having tryst with the UGLY security of Orkut and the way it manages Cookies. If you are having your About me changed to Junk/Vulgar links of Jotika Sex Chat or Portugese Sex Chats... then this the place you are looking for to secure. I'll tell you how they are hacking the account so that you may understand the solution with affirmation....

HACK

Cookies are basically stored on your computer when you log onto Orkut. But why? Suppose you are navigating from one page to another, orkut has no way to tell if that navigation is secure until and unless you give it the password. But giving a password everytime will be cumbersome. So to avoid that Orkut saves a certificate on your computer, in the form of a cookie telling that if a request has the cookie information attached( as it is a local information only the owner has it right now ) then the navigation is secure.

Are cookies permanent? NO

Cookies have a lifetime which is defaulted to Session, i.e. as soon as you logout your cookie is destroyed. Orkut specifically has Session Lifetime.

So when you log in again a new cookie is assigned... have a screenshot of the cookie information...



How are they hacking it... if you click a malicious link and you have the cookie stored at that time... you are done!

The cookies is sent over the net to the hacker, he edits his own cookie with your information... as long as you dont logout the cookie holds goooood and you will be raped all angles :P.The links they are keeping on hacked profiles are malicious so if u click them u'll compromise badly.

SAFE BROWSING

Those who didnt get hacked, dont click any malicious link or hacked profile links! A higher precaution can be to logout after each use and not keep the account idle for exploits...

Those who got hacked.... do the following

1. Change the pic, aboutme, your sex, orientation and wat not :P
2. Remove the malicious communities from the account... see for malicious friends!
3. Logout immidiately..... actually as u'll goto the commmunity to remove it... they'll get your cookie! It takes time to process it... 5-10 min atleast.... make your changes and logout... the cookie will be destroyed.
4. Obviously the "Non hacked users" rules apply :P

Happy Orkutting, Chirkutting ;)

Saturday, April 4, 2009

Pen Drive Security System

Recently I with my team-mates made a solution to a problem statement released for an Intra Collegiate Event. The problem( in brief ) goes as follows:

1. You have to design a Pen Drive security system that resides on a Pen Drive, does no installation of software on a Operating Client and provides on the go run facility, as in plug and shoot.

2. The security should be two leveled where the Files are encrypted with a Key and a suitable algorithm( the key will generally be random ). The key has to be stored in a way so that it is secured via the main password that the user shall hold or the private key.

3. The software should preferably have a nice looking GUI, extra points for Native look.

Our Approach:

1. As the system has to be supported fully on a Operating System we definitely cannot assume packages like Java to be installed which can easily be the best choice for a platform-independent choice. Packing a whole JVM was a waste of effort as it'll take huge amount of space.

2. We used GTK+-2.0 for the same reason. Being a small and a protable library and having a cross platform support in Windows/Linux we'll have enough to say in terms of portability. Also the look and feel of GTK is far-far-far better than say Java-MOTIF or else!

3. The software installed will have two layers of security

(a) The master password which will be held by the master user.( there will be user accounts just
as in unix etc )

(b) A random key will be used to encrypt a file sored under the device. The random key will be encrypted via the master password and stored as the first bytes of the file. The Encryption algorithm used shall be of highest quality, namely, AES!

Have a look at the snapshots and u'll have a good feel of the software :)