Category Archives: Blog

My first Github commit

My 2012 Summer vacation was 3 months long and it started to become very boring after the 1st few days. So I though I’ll try out Github , Python’s Http interfaces like urlli, urllib2 , httplib , twisted,etc ,writing a simple crawler which has been in my todo list for a very long time. So I started writing a simple single-threaderd crawler to get the list of users and list of problems on SPOJ.Its was pretty simple using urllib2. You just needed urllib2.urlopen() . A byproduct of this was the SPOJ-Problem selector whose code I wanted to commit to Github as my 1st project. Its a simple non threaded , non queued simple crawler.It crawled pretty slow. So I decided to thread it . Add a global queue that will store the list of URLS and multiple worker threads that will pop urls from queue and push back new urls. Still there was a problem ! As the no of URLs increased , u cant store all of them in memory . So , I had to make a persistent queue by wrapping a simple database with the interfaces of a queue. This way I made a fullfleged crawler that can crawl multiple pages and added ability to pause and resume too using python Shelves. Then I came across Scrapy, a crawler frame-work for python. It has of these feature pre built and I needed to write only the parser for each HTML page. I tried tweaking it a lot but still I liked my pause-play Crawler better.

Here is the link to it: https://github.com/jujojujo2003/SPOJ-Problem-Selector

Advertisements

Securing Windows With Password for UAC (A Pseudo-Sudo for Windows)

One of the most loathed attributes of Linux is security and the concept of root user,access rights for different user is a key to Linux’s Security. After I got my new laptop , I ran into a lot of issues with linux ,especially the drivers. Starting from the graphics drivers, sound drivers , to hotkeys, backlight control has issues. They never worked. So I decided to switch to Windows 7 as my primary OS and install Linux in a virtual machine. The one feature that I missed badly was the regular prompt for my password in linux which gave me a sense of security at-least from the hungry claws of my friends who eagerly wait for a chance to grab my laptop , screw up the settings and play a game of hide and seek with my files and end it with a “Guess The Password” game. For this very reason , I wanted some sort of password protection in windows , which would work like sudo , prompt me a password whenever settings / apps have to be started with admin privileges.So after a few seconds of Google-ing , I found out that Microsoft had an option to prompt for the password instead of the useless UAC dialogue box. In Windows 7/8 Professional/Ultimate , it is available in the security policy control panel. For others you need to change a registry value via Regedit.

 

Steps 

1) Go to Run (Win+R) and type “regedit” in the box.
ebf80-run
2) In the bar on the left, navigate to
 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System
Click on System.
3)The registry key that we need to change is ConsentPromptBehaviorAdmin:
The key for that is :
0 = Elevate without prompting
1 = Prompt for credentials on the secure desktop**
2 = Prompt for consent on the secure desktop
3 = Prompt for credentials
4 = Prompt for consent
5 = Prompt for consent for non-Windows binaries
In our case , we need to set it to 1.
ca7ff-regedit
4)So right click on ConsentPromptBehaviourAdmin->Modify
Check Hexadecimal and set the value as 1.
Now exit the editor, logoff , restart the computer. The next time Admin privileges are required , it will prompt you for the password like below
63c38-popupnotifier_-_uac
Although , this is can be by-passed by certain software , your friends can’t bypass it . So  
Do Lock your computer whenever you are letting it alone!