August « 2010 « Security related discussions, articles, and tutorials

Quick HTTP Header grabbing script

Just a quick script I came up with when I had to grab multiple url http headers. The script prints output to the terminal as well as writes an output file in the CWD you run the script from. The list of urls needs to have full http:// syntax and one url per line. Click here to view and download the script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python

# Simple program which opens a file of urls, retrives their headers and prints them to tty and writes to a file

import urllib2
import sys

usage = '''
Port 80 Headers - Multiple site list
Author: bostonlink
Usage:  ./80headers.py url_list'
Notes: Use a custom list of urls, each url should be on a new line.
eg:
http://google.com
http:yahoo.com
if there is an empty new line at the end of the file, the script will terminate when the '\n' newline is passed to it.
'''


if (len(sys.argv)!=2):
    print(usage)
    sys.exit(0)

usrfile = open(sys.argv[1], 'r')
outfile = open('output.txt', 'w')
outfile.close()

urls = usrfile.readlines()

for url in urls:
    if url == '\n':
        break
    else:
        url.rstrip()
        header = urllib2.urlopen(url).info()
        print('=' * 60)
        print(url)
        print('-' * 60)
        print(header)
        print('=' * 60)
        print('')
        f = open('output.txt', 'a')
        f.write(('=' * 60) + '\n' )
        f.write(url)
        f.write(('-' * 60) + '\n')
        f.write(str(header))
        f.close()

usrfile.close()
No Comments »

Defcon 18 == Awesomeness

I just returned from Las Vegas and Defcon 18.  The conference this year was awesome, I reconnected with people I met last year as well as met a lot of new attendees.  I always love meeting new people who have a passion for hacking and information security.  Here are some pictures not the greatest but I was there to learn and have fun, not to be a photographer.

Riviera Small Suite Upgrade - 10th floor

Riviera Small Suite Upgrade - 10th floor

My Defcon 18 Badge

My Defcon 18 Badge

Back of my badge

Back of my badge

Outside of the Riviera Hotel and Casino

Outside of the Riviera Hotel and Casino

Wall Of Sheep

Wall Of Sheep

Oh can you say unlocked badge

Oh can you say unlocked badge

Track 5

Track 5

Well it was great, all the speakers and talks, seeing the social-engineer.org CTF contest live, and making some new friends, was awesome.  I also came home with money in my pocket, not from gambling but from not gambling =) see you on the flip or next year at Defcon 19

No Comments »