PhrackDownloader



In [2]:
import re
import shutil
from urllib.request import urlopen, urlretrieve

BASE_URL = "http://phrack.org/archives/tgz/"

with urlopen(BASE_URL) as resp:
    html = resp.read()
    links = re.findall(r'<A HREF="(.*?)">', str(html))[5:]
    
    shutil.os.mkdir('phrack-files')
    shutil.os.chdir('phrack-files')
    
    for link in links:
        print('Now downloading: ' + link)
        if not shutil.os.path.exists(link):
            with urlopen(BASE_URL + link) as resp, open(link, 'wb') as fobj:
                shutil.copyfileobj(resp, fobj)
    print("\nDownload Complete.")


Now downloading: phrack1.tar.gz
Now downloading: phrack10.tar.gz
Now downloading: phrack11.tar.gz
Now downloading: phrack12.tar.gz
Now downloading: phrack13.tar.gz
Now downloading: phrack14.tar.gz
Now downloading: phrack15.tar.gz
Now downloading: phrack16.tar.gz
Now downloading: phrack17.tar.gz
Now downloading: phrack18.tar.gz
Now downloading: phrack19.tar.gz
Now downloading: phrack2.tar.gz
Now downloading: phrack20.tar.gz
Now downloading: phrack21.tar.gz
Now downloading: phrack22.tar.gz
Now downloading: phrack23.tar.gz
Now downloading: phrack24.tar.gz
Now downloading: phrack25.tar.gz
Now downloading: phrack26.tar.gz
Now downloading: phrack27.tar.gz
Now downloading: phrack28.tar.gz
Now downloading: phrack29.tar.gz
Now downloading: phrack3.tar.gz
Now downloading: phrack30.tar.gz
Now downloading: phrack31.tar.gz
Now downloading: phrack32.tar.gz
Now downloading: phrack33.tar.gz
Now downloading: phrack34.tar.gz
Now downloading: phrack35.tar.gz
Now downloading: phrack36.tar.gz
Now downloading: phrack37.tar.gz
Now downloading: phrack38.tar.gz
Now downloading: phrack39.tar.gz
Now downloading: phrack4.tar.gz
Now downloading: phrack40.tar.gz
Now downloading: phrack41.tar.gz
Now downloading: phrack42.tar.gz
Now downloading: phrack43.tar.gz
Now downloading: phrack44.tar.gz
Now downloading: phrack45.tar.gz
Now downloading: phrack46.tar.gz
Now downloading: phrack47.tar.gz
Now downloading: phrack48.tar.gz
Now downloading: phrack49.tar.gz
Now downloading: phrack5.tar.gz
Now downloading: phrack50.tar.gz
Now downloading: phrack51.tar.gz
Now downloading: phrack52.tar.gz
Now downloading: phrack53.tar.gz
Now downloading: phrack54.tar.gz
Now downloading: phrack55.tar.gz
Now downloading: phrack56.tar.gz
Now downloading: phrack57.tar.gz
Now downloading: phrack58.tar.gz
Now downloading: phrack59.tar.gz
Now downloading: phrack6.tar.gz
Now downloading: phrack60.tar.gz
Now downloading: phrack61.tar.gz
Now downloading: phrack62.tar.gz
Now downloading: phrack63.tar.gz
Now downloading: phrack64.tar.gz
Now downloading: phrack65.tar.gz
Now downloading: phrack66.tar.gz
Now downloading: phrack67.tar.gz
Now downloading: phrack68.tar.gz
Now downloading: phrack69.tar.gz
Now downloading: phrack7.tar.gz
Now downloading: phrack8.tar.gz
Now downloading: phrack9.tar.gz

Download Complete.

In [ ]: