Jump to content

Phrack - great old school hacking e-zine


Recommended Posts

Well since we're talking about phrack link I'll add a little script I wrote years back to back up phrack files. you can tell its age because at the time i wrote it we were only up to issue 67.

#!/usr/bin/env python

import sys
import socket

def recvline(sock):
    stop = 0
    line = ''
    while True:
        i = sock.recv(1)
        if i == '\n': stop = 1
        line += i
        if stop == 1:
    return line

# super awesome recvall function!
def recvall(sock, size):
    buff = ''
    while True:
        buff += sock.recv(size)
        if len(buff) < size:
            size -= len(buff)
            return buff

def getheader(s):
    header = []
    for n in range(9):
    return header

def main():
    host = socket.gethostbyname('www.phrack.org')
    port = 80
    for issue in xrange(0,67): # modify for issue ranges
        print "Getting issue {0} of 67".format(issue+1),
        s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
        # if statement for the naming
        s.sendall('GET /archives/tgz/phrack{0}.tar.gz HTTP/1.1\r\n'
        s.sendall('Host: www.phrack.org\r\n\r\n')

        header = getheader(s)
        load = int(header[6].split(':')[1].rstrip())
        print "size: " + str(load) + " bytes"
        # another if statement for naming
        f = open('phrack{0}.tar.gz'.format(issue+1),'wb')

        while True:
            recv_size = 100
            if load < recv_size:
                f.write(recvall(s, load))
                f.write(recvall(s, recv_size))
            load -= recv_size

    return 0

if __name__ == '__main__':


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • killab
      By killab
      Badass mind map for passive open source intelligence gathering.
    • killab
      By killab
      ExploitDB, Offensive Security's Exploit Database Archive is an amazing resource.
      Be it for google dorks, exploits, shellcode, or technical papers.
      Want to be able to search for exploits offline, or via terminal?
      Check out the following, a few simple commands will arm you with the entire DB!
    • killab
      By killab
      Many of you will no doubt already have this site bookmarked but it is worth a mention even if one person does not.
      This site contains a ton of recent news on topics like how apple has fucked up yet again, or what malware is now sweeping the globe.
      Along with that, they also have many exploits, and informative whitepapers.
  • Create New...