Skip to content

Instantly share code, notes, and snippets.

View digizeph's full-sized avatar
🌟

Mingwei Zhang digizeph

🌟
View GitHub Profile
@digizeph
digizeph / pybgpkit-v0-0-2.ipynb
Created February 26, 2022 18:43
pybgpkit-v0.0.2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@digizeph
digizeph / as9498-route-flapping.ipynb
Created February 11, 2022 00:04
as9498-route-flapping.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@digizeph
digizeph / example-peers-info.json
Created February 5, 2022 20:36
Example of extracted route collector peer information. File size: 65.8MB, processing time: 25s.
{
"project": "route-views",
"collector": "route-views.sg",
"rib_dump_url": "http://archive.routeviews.org/route-views.sg/bgpdata/2022.02/RIBS/rib.20220205.1800.bz2",
"peers": {
"2001:de8:4::13:6168:1": {
"asn": 136168,
"ip": "2001:de8:4::13:6168:1",
"num_connected_asn": 4,
"num_v4_pfxs": 0,
@digizeph
digizeph / cloudflare-akamai-leak.ipynb
Created February 1, 2022 23:26
cloudflare-akamai-leak.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@digizeph
digizeph / gist:e3ccde5fd5e722e1d4ecb53edc9ee563
Last active January 18, 2022 20:43
BGP updates for 1.1.1.0/24 or more specifc between 2022-01-18 14:30Z to 15:15Z. Data collected from all collectors of RIPE RIS and RouteViews, using @bgpkit parser. Original Tweet: https://twitter.com/tstrickx/status/1483452906921762826
A|1642516869.697048|80.249.211.155|61955|1.1.1.0/24|61955 13335|IGP|80.249.211.155|0|0||NAG|13335|162.158.84.1
W|1642516869.807738|80.249.211.155|61955|1.1.1.0/24|||||||||
A|1642516900.484923|80.249.211.155|61955|1.1.1.0/24|61955 9145 13335|IGP|80.249.211.155|0|0||NAG|13335|162.158.84.1
A|1642516879.060348|195.66.224.13|61955|1.1.1.0/24|61955 174 13335|IGP|195.66.224.13|0|0||NAG|13335|162.158.200.1
A|1642516910.431133|195.66.224.13|61955|1.1.1.0/24|61955 174 13335|IGP|195.66.224.13|0|0||NAG|13335|162.158.200.1
A|1642516917.78191|195.66.224.29|5413|1.1.1.0/24|5413 13335|IGP|195.66.224.29|0|0||NAG|13335|141.101.65.1
A|1642516323|195.66.227.203|58057|1.1.1.0/24|58057 62240 13335|IGP|195.66.227.203|0|0|13335:10021 13335:19020 13335:20050 13335:20500 13335:20530 62240:201 62240:302 ecas2:0:2:62240:00001770 lg:58057:62240:65010|NAG|13335|141.101.71.254
W|1642516324|195.66.226.212|7489|1.1.1.0/24|||||||||
W|1642516324|195.66.227.203|58057|1.1.1.0/24|||||||||
A|1642516324|195.66.227.203|58057|1.1.1.0/24|58057 62240 6
@digizeph
digizeph / gist:856b1b39c4d1da484ea8c14441213b09
Created December 25, 2021 21:47
Prefix announced by AS8346 and their counts observed from route-views2 collector from 2021-12-25T01:00:00 GMT to 2021-12-25T03:00:00 GMT
56 8.9.10.0/24
3 11.12.13.0/24
52 14.15.16.0/24
52 17.18.19.0/24
55 40.0.80.0/24
19 41.214.0.0/19
34 41.214.116.0/24
18 41.214.120.0/24
56 41.214.16.0/24
13 41.214.31.0/24
@digizeph
digizeph / generic-file-reader.rs
Created November 25, 2021 02:06
Example of a generic read that can handle bz2 and gz files either locally or remotely.
pub fn get_reader(path: &str) -> Result<Box<dyn Read>, ParserError> {
let file_type = path.split(".").collect::<Vec<&str>>().last().unwrap().clone();
assert!(file_type == "gz" || file_type== "bz2");
let raw_reader: Box<dyn Read> = match path.starts_with("http") {
true => {
let response = Request::get(path).body(())?.send()?;
Box::new(response.into_body())
}
false => {
@digizeph
digizeph / ris-live-facebook-example.rs
Created November 13, 2021 06:03
RIS Live stream Facebook example
use bgpkit_parser::parse_ris_live_message;
use serde_json::json;
use tungstenite::{connect, Message};
use url::Url;
use bgpkit_parser::parser::ElemType;
const RIS_LIVE_URL: &str = "ws://ris-live.ripe.net/v1/ws/?client=rust-bgpkit-parser";
/// This is an example of subscribing to RIS-Live's streaming data from one host (`rrc21`).
///
@digizeph
digizeph / ris-live-example.json
Created November 13, 2021 01:35
RIS Live Example JSON message
{
"timestamp": 1636763031.41,
"peer": "37.49.237.228",
"peer_asn": "39533",
"id": "21-588-20420441",
"host": "rrc21",
"type": "UPDATE",
"path": [39533, 6939, 9930, 132354],
"community": [[0, 39533], [39533, 49666], [64512, 11], [64512, 21], [65205, 61968]],
"origin": "igp",
@digizeph
digizeph / bgpkit-parser-ris-live-example.rs
Last active November 12, 2021 14:38
Example code for parsing RIS-Live JSON messages using BGPKIT Parser (https://github.com/bgpkit/bgpkit-parser).
use bgpkit_parser::parse_ris_live_message;
use serde_json::json;
use tungstenite::{connect, Message};
use url::Url;
const RIS_LIVE_URL: &str = "ws://ris-live.ripe.net/v1/ws/?client=rust-bgpkit-parser";
/// This is an example of subscribing to RIS-Live's streaming data from one host (`rrc21`).
///
/// For more RIS-Live details, check out their documentation at https://ris-live.ripe.net/manual/