About Me

Saturday, 19 May 2012

Website Source Code Grabber

it will create source.txt in the same directory

import urllib
import httplib
import socket

print "\n\nFast Webpage Saver"
print "input URL and run it. It will Save Webpage Within Seconds"

print "\n\n\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
print "\t|||||                                                       |||||"
print "\t|||||                                                       |||||"
print "\t|||||        Coded By Ajith KP                              |||||"
print "\t|||||                                                       |||||"
print "\t|||||                                                       |||||"
print "\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"

try:
    url = raw_input("URL:")
    url =url.replace("http://","")
    txt = open('source.txt','w')
    cobra = urllib.urlopen('http://'+url)
    for source in cobra.readlines():
        print source.rstrip()
        txt.write(source.rstrip())
    txt.close()
    cobra.close()
    raw_input('Complete: Open source.txt')
except (httplib.HTTPResponse, socket.error):
    print "\n\t[!] Session Cancelled; Error occured. Check internet settings"
except (KeyboardInterrupt, SystemExit):
    print "\t[x] Session cancelled"

2 comments:

hehe :D how about https pages lol tell him that its the biggest bug :D of his code.. it will work only for http pages :D

Post a Comment