The Python CodeTags: Python, Fusker, Gr33n Data
#!/usr/bin/python
""" PyFusker """
""" Author: Tarek Amr """
""" Version: 0.1 """
""" File: pyfusker.py """
""" Date: 07 January 2006 """
""" Replce [TAB] with \t """
class Fusker:
[TAB]def __init__(self, url):
[TAB][TAB]self.url = url
[TAB][TAB]self.urls = []
[TAB][TAB]self._generate()
[TAB]def _generate(self):
[TAB][TAB]comp = re.compile("\\[.+\\]")
[TAB][TAB]x = comp.findall(self.url)
[TAB][TAB]if not x:
[TAB][TAB][TAB]print "Url parsing error!"
[TAB][TAB][TAB]sys.exit()
[TAB][TAB]try:
[TAB][TAB][TAB]x[0] = x[0].strip("[")
[TAB][TAB][TAB]x[0] = x[0].strip("]")
[TAB][TAB][TAB]x1,x2 = x[0].split("-")
[TAB][TAB][TAB]x1 = string.atoi(x1)
[TAB][TAB][TAB]x2 = string.atoi(x2)
[TAB][TAB]except:
[TAB][TAB][TAB]print "Url parsing error!"
[TAB][TAB][TAB]sys.exit()
[TAB][TAB]if x1 > x2:
[TAB][TAB][TAB]print "Invalid range"
[TAB][TAB][TAB]sys.exit()
[TAB][TAB]temp_url = comp.split(url)
[TAB][TAB]i = x1
[TAB][TAB]while i < x2 :
[TAB][TAB][TAB]self.urls.append(string.join(temp_url,"%s" % i))
[TAB][TAB][TAB]i = i + 1
[TAB][TAB]return self.urls
[TAB]def list_urls(self):
[TAB][TAB]print self.urls
[TAB]def download_urls(self):
[TAB][TAB]for u in self.urls:
[TAB][TAB][TAB]try:
[TAB][TAB][TAB][TAB]print "Downloading ... ", u
[TAB][TAB][TAB][TAB]os.system("wget %s" % u)
[TAB][TAB][TAB]except:
[TAB][TAB][TAB][TAB]print "Wget Error!"
[TAB][TAB][TAB][TAB]continue
if __name__ == "__main__":
[TAB]try:
[TAB][TAB]url = sys.argv[1]
[TAB]except:
[TAB][TAB]print "Usage: python fusker.py http://www.website.com/img[01-06].jpg"
[TAB][TAB]sys.exit()
[TAB]f = Fusker(url)
[TAB]f.download_urls()
Are you looking for my non-technical blog?
This is now my technical-only blog, my non-technical blog is here.
07 January 2006
PyFusker
Python implementation of Fusker
Introduction:
Most probably you are redirected from Wikipedia to this page, so please if you have any comment on the code just leave it here so that I can improve it. Also if you can help me know why are people interested in the fusker technology that much, and what web sites do you usually fusker.
Subscribe to:
Post Comments (Atom)
You mau also replace os.system("wget %s" % u) with os.system("wget --user-agent=Mozilla %s" % u)
ReplyDeletethis is my own implementation of a fusker .. it is a one line:
ReplyDelete#!/bin/sh
wget -r -nc -A.jpg,.mpg,.avi,.mpeg -R *thumb*,*tn*,gif,GIF "$@"
this would download any jpg, mpg, avi or mpeg file in a page. It will avoid gif images and images with the string "thumb" or "tn" in them.
notice the above line extracts images linked in a page. if however i want to download a range of images i use curl.
ReplyDelete(replace those ugly [TAB] with tabs or 4 spaces i can't read your script)
WRT to the so called ugly [TAB] see above or even see the previous post.
ReplyDelete"Also if you can help me know why are people interested in the fusker technology that much"
ReplyDeleteporn mostly ;)
YES,,, people are interested...
ReplyDeleteSince the main site Fusker.Lewww.com went off-line, there are MANY people still interested.
Also, many fusker sites are popping up ... :):)