Skip to content

Instantly share code, notes, and snippets.

View bulk-single-radius.py
#!/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 )
View ripe-atlas-probetags.py
#!/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
View create-latencymon.py
#!/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]
View bulk-ris-lookup.py
#!/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 Nov 14, 2015
python-ixp-peering-lan-fetch
View get-ixp-info.py
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")
View process-nsid-ripeatlas-loss.py
#!/usr/bin/env python
import sys
import fileinput
from ripe.atlas.sagan import DnsResult
cache={}
latest={}
BIN = 3600
def process(line):
View process-nsid-ripeatlas.py
#!/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'),
@emileaben
emileaben / MyConfig.pm
Created Feb 3, 2015
Magic in ~/.cpan/CPAN/MyConfig.pm to make CPAN install in a user-local directory
View MyConfig.pm
'makepl_arg' => q[PREFIX=/home/emile/tmp/prefix INSTALLSITELIB=/home/emile/perl INSTALLARCHLIB=/home/emile/perl LIB=/home/emile/perl],