This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("jsonlite") | |
# Function that returns the country code of a IP address | |
geoloc<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/geoloc/data.json?resource=",x))$data$locations$country) | |
} | |
# Function that returns the ASN of a IP address | |
getasn<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/network-info/data.json?resource=",x))$data$asns[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
# | |
# License GPLv2 | |
# Version 0.1 | |
# Original script from http://wiki.openwrt.org/doc/howto/packet.scheduler/packet.scheduler.example4 | |
# Modified for control in LAN interface too | |
START=99 | |
EXTRA_COMMANDS="status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Read the bgpdump output and generate a edge list with two columns source destination | |
use strict; | |
use warnings; | |
my $filename = $ARGV[0]; # store the 1st argument into the variable | |
open FILE, '<', $filename or die $!; # open the file using lexically scoped filehandle | |
while (<FILE>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(XML) | |
library(RMySQL) | |
library(jsonlite) | |
geoloc<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/geoloc/data.json?resource=",x))$data$locations$country) | |
} | |
getasn<-function(x){ | |
return(fromJSON(paste0("https://stat.ripe.net/data/network-info/data.json?resource=",x))$data$asns[1]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(data.table) | |
library(bit64) | |
library(igraph) | |
library(BioNet) | |
# Modify with the country | |
country<-"ES" | |
# You need the file with the edges genetad with the scrip bpgdump2edge.pl | |
# Read edge file SRC,DST,IP Prefix, nº ASes AS PATH | |
edges.df<-fread("bgp/edges2.txt",sep=",",colClasses=c("character","character","character","integer"),header=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import feedparser | |
import GeoIP | |
import csv | |
# assume that maxmind .dat files are in the same directory | |
# otherwise change the path | |
gi = GeoIP.open("GeoIP.dat",GeoIP.GEOIP_STANDARD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import csv, sys, time, json, elasticsearch | |
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
mapping = { | |
"fnf1x": { | |
"properties": { | |
"ts": {"type": "date", "format" : "YYYY-MM-dd HH:mm:ss"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ash | |
TASK=`ping -c 1 your.domain.here | grep PING | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'` | |
case $TASK in | |
127.0.0.1) | |
#Your code here | |
Message="Ok1" | |
;; | |
127.0.0.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import re | |
import GeoIP | |
import csv | |
import urllib2 | |
# Update maxmind databases: | |
os.system('wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for router_id in `neutron router-list | grep 's_rally' | awk '{print $2}'`; do | |
neutron router-gateway-clear $router_id | |
subnet_id=`neutron router-port-list $router_id | grep 'subnet_id' | awk '{print $8}' | awk -F '\"' '{print $2}'` | |
neutron router-interface-delete $router_id $subnet_id | |
neutron router-delete $router_id | |
net_id=`neutron subnet-show $subnet_id | grep 'network_id' | awk '{print $4}'` | |
neutron subnet-delete $subnet_id | |
neutron net-delete $net_id | |
done |
OlderNewer