Many of us would be of the opinion that you firewall would protect you from the ugly world. But this might not be the case. Even though your firewall works fine when you have logged in, it might not work when you have logged off.
Archive for August, 2008
Simple test for your firewalls when you buy one
Python script to download pictures/Jpegs/jpgs from a website
Here is script to download images, from a website. I have taken the example of zune.net to download the images to my local disk.
you can alter it as you please:
import sgmllib
import re
class MyParser(sgmllib.SGMLParser):
A simple parser class.
def parse(self, s):
Parse the given string s.
self.feed(s)
self.close()
def __init__(self, verbose=0):
Initialise an object, passing verbose to the superclass.
sgmllib.SGMLParser.__init__(self, verbose)
self.hyperlinks = []
def start_a(self, attributes):
Process a hyperlink and its attributes.
for name, value in attributes:
if name == href:
self.hyperlinks.append(value)
def get_hyperlinks(self):
Return the list of hyperlinks.
return self.hyperlinks
import urllib, sgmllib
# Get something to work with.
f = urllib.urlopen(http://www.zune.net/en-us/mp3players/backgrounds/default.htm)
s = f.read()
# Try and process the page.
# The class should have been defined first, remember.
myparser = MyParser()
myparser.parse(s)
# Get the hyperlinks.
#print myparser.get_hyperlinks()
hlist = myparser.get_hyperlinks()
for links in hlist:
var_extn = links[-3:]
if(var_extn == jpg):
finalURL = http://www.zune.net+links
print finalURL
start = finalURL.find(480×640_)
end = finalURL.find(.jpg)
finalName = finalURL[start:end]
image = urllib.URLopener()
image.retrieve(finalURL,finalName+.jpg)
-
Recent Posts
Archives
- September 2010 (1)
- August 2010 (11)
- July 2010 (4)
- June 2010 (2)
- May 2010 (13)
- April 2010 (9)
- March 2010 (6)
- February 2010 (2)
- January 2010 (7)
- December 2009 (11)
- November 2009 (2)
- October 2009 (4)
- September 2009 (1)
- August 2009 (4)
- July 2009 (11)
- June 2009 (41)
- May 2009 (1)
- April 2009 (2)
- March 2009 (4)
- February 2009 (4)
- January 2009 (3)
- December 2008 (1)
- November 2008 (1)
- October 2008 (2)
- September 2008 (1)
- August 2008 (2)
- June 2008 (3)
- May 2008 (3)
- March 2008 (1)
- February 2008 (2)
- July 2007 (1)
TAGGED
about android AppVerifier background image bing search engine video search block spam bloodshed dev c++ linker error browser c++ std namespace c1.exe carray error vc6 vc8 vc9 windows clistbox DEP_SYSTEM_POLICY_TYPE GetSystemDEPPolicy domain testing download pictures jpegs encode decode ascii firefox google nexus phone iphone video grease monkey how hide windows file vc++ iphone palm pre lua c++ integers vector conversion split mbstowcs convert memory leak testing c++ mysqldb mysql mysqldb python n8 nokia iphone 4g nokia makesis .sis packaging comdlg32 ocx nokia n8 iphone killer maemo meego nokia oviappwizard app iphone nokia qt sleep opera firefox browser password passwd penetration penetration testing firewall python floating point sqlite3 tchar string testing fir tinyxml c++ xml trees linked list tree insertion deletin troops unit test ACL permission read access write access virtual machine windows unit tests uninstall wordpress database python phpMETA