Skip to content

Instantly share code, notes, and snippets.

View RichiH's full-sized avatar

Richard Hartmann RichiH

View GitHub Profile
#!/usr/bin/python
# setup: pip install requests beautifulsoup4
from decimal import Decimal
import requests
from bs4 import BeautifulSoup
import sys
import getpass
@RichiH
RichiH / xr2pcap.rb
Created March 11, 2016 13:21 — forked from ytti/xr2pcap.rb
XR NPU counter to pcap
#!/usr/bin/env ruby
# put output of 'monitor np counter PUNT_IPV4_ADJ_NULL_RTE_EXCD np3 count 25 location 0/1/CPU0' to a file 'foox.txt'
# run './xr2pcap.rb foox.txt' and you'll have 'packets.txt' and 'packets.pcap'
class XRNPUCounter
PACKET_START = /byte packet/
LINE_RE = /^....: (.{48}).*/
def self.parse lines