Archive for July, 2011

Hacking Facebook “Like & Win” competition

No Comments »

 

Yappy,

I just won a price by "Liking" a page on facebook "Like & Win" competition

Actually some company announced that they will give free gifts to the 2000th and 2011th users, who like their facebook page.

So what I did was simple,  I just made a python script (that's not hacking, just power of programming) to win that price and start that script to check the page status and alert me when page like is near 1998-1999 🙂


import urllib2,time,winsound
from HTMLParser import HTMLParser  

class MyHTMLParser(HTMLParser):

  def __init__(self):
    HTMLParser.__init__(self)
    self.recording = 0 
    self.data = []
  def handle_starttag(self, tag, attrs):
	if tag == 'div':
		for name, value in attrs:
			if name == 'id' and value == 'profile_header':
				#print "Encountered the beginning of a %s tag" % tag 
				self.recording = 1 
				break


  def handle_endtag(self, tag):
    if tag == 'div':
      self.recording -=1 
      #print "Encountered the end of a %s tag" % tag 

  def handle_data(self, data):
    if self.recording:
      self.data.append(data)

var = 1
print "Checking current likes (remember 2000th and 2011th will get the price):"
while var == 1 :
	print "......"
	p = MyHTMLParser()
	f = urllib2.urlopen('http://www.facebook.com/pages/Some_URL_for_like_and_win')
	html = f.read()
	p.feed(html)
	#print p.data
	print p.data[4];
	string=p.data[4];
	if string.startswith( '1,999' ):
		winsound.PlaySound("SystemExclamation", winsound.SND_ALIAS)
		print "Check the page and get the price"
	p.close()
	print "Sleeping for 5 minutes"
	time.sleep(300)

Change this URL to the URL of your choice [http://www.facebook.com/pages/Some_URL_for_like_and_win]

Please note I am NOT responsible if that company sues you for cheating & for using programming skills in competition 🙂

Aloha