Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import requests
import time
ips = set()
for line in sys.stdin:
# assume its well formed
line = line.rstrip('\n')
ips.add( line )
#!/usr/bin/env python
import fileinput
from ripe.atlas.sagan import DnsResult
def process(line):
result = DnsResult(line)
try:
print("{}\t{}\t{}\t{}".format(
result.created.strftime('%s'),
#!/usr/bin/env python
import sys
import json
import urllib2
from collections import Counter
url = "https://atlas.ripe.net/api/v2/probes?page_size=500"
tc = Counter() # tag counter
tcu = Counter() # tag counter for probes that are up
#!/usr/bin/env python
import sys
## usage
## ./create-latencymon.py <prb> <msm>,<msm>,<msm>,<msm> > index.html
## then load html in a browser
prb_str = sys.argv[1]
prb_list = prb_str.split(',')
msm_str = sys.argv[2]
#!/usr/bin/env python
'''
Prototype tool for bulk IP->AS lookups for a specific date
Downloads RIS data locally (using CAIDA BGPSTREAM)
expects IP addresses/prefixes on STDIN (IPv4 and IPv6)
takes a single command-line argument which is the DATE for which to download the table (any format convertable by arrow will do)
example use:
cat file_with_maaaaany_ips | ./bulk-ris-lookup.py 2009-03-22
'''
@emileaben
emileaben / get-ixp-info.py
Last active November 14, 2015 12:34
python-ixp-peering-lan-fetch
import requests
def get_ixp_info():
## ccix contains country code with lists of IXP peering LANs
ccix = {}
## contains useful info on peering lans, indexed by peeringdb ix_id
ix2lans = {}
r_ixlan = requests.get("https://beta.peeringdb.com/api/ixlan?depth=2")
#!/usr/bin/env python
import sys
import fileinput
from ripe.atlas.sagan import DnsResult
cache={}
latest={}
BIN = 3600
def process(line):
@emileaben
emileaben / MyConfig.pm
Created February 3, 2015 13:11
Magic in ~/.cpan/CPAN/MyConfig.pm to make CPAN install in a user-local directory
'makepl_arg' => q[PREFIX=/home/emile/tmp/prefix INSTALLSITELIB=/home/emile/perl INSTALLARCHLIB=/home/emile/perl LIB=/home/emile/perl],