<commit_before># bgpchart

Get charts on BGP prefixes and peers for a given AS-number. Data is based on 
Hurricane Electric's BGP toolkit. The charts are all in PNG format.

### Chart types
All charts are provided with data from the last 90-day period. And each chart
can be shown with either IPv4 data or IPv6.

 * **Prefixes announced**: number of prefixes announced by the AS.
 * **Originated prefixes**: number of prefixes owned by the AS.
 * **Peer count**: number of peers observed as neighbors to the given AS.
 
### Usage

    usage: bgpchart.py [-h] [-ip {v4,v6}] [-c {a,o,p}] [-o path] [-v] asn
    
    positional arguments:
      asn          AS-number to lookup
    
    optional arguments:
      -h, --help   show this help message and exit
      -ip {v4,v6}  IP version 4 (default) or 6 statistics
      -c {a,o,p}   Chart type: prefixes [a]nnounced (default) or [o]riginated,
                   or [p]eer count
      -o path      Output directory where charts are saved
      -v           Verbose console output (debugging)

### Examples

Get default chart (Announced IPv4 Prefixes) for AS2828 (XO Communications).

    bgpchart AS2828

Since we did't specify an output file, the chart is saved in your current 
directory as the file `AS2828-v4-a.png`.

Next, we specify both the IP version, chart type and output file.

    bgpchart -ip v6 -c p -o /home/user/chart.png AS2828

This will fetch the IPv6 Peers chart for AS2828 and save it as `chart.png` in 
the user's home directory<commit_msg>Added example chart<commit_after># bgpchart

Get charts on BGP prefixes and peers for a given AS-number. Data is based on 
Hurricane Electric's BGP toolkit. The charts are all in PNG format.

### Chart types
All charts are provided with data from the last 90-day period. And each chart
can be shown with either IPv4 data or IPv6.

 * **Prefixes announced**: number of prefixes announced by the AS.
 * **Originated prefixes**: number of prefixes owned by the AS.
 * **Peer count**: number of peers observed as neighbors to the given AS.

Here is an example of a chart (`bgpchart -c p AS2828`):

![Chart example](https://raw.githubusercontent.com/toringe/bgpchart/master/example.png)

### Usage

    usage: bgpchart.py [-h] [-ip {v4,v6}] [-c {a,o,p}] [-o path] [-v] asn
    
    positional arguments:
      asn          AS-number to lookup
    
    optional arguments:
      -h, --help   show this help message and exit
      -ip {v4,v6}  IP version 4 (default) or 6 statistics
      -c {a,o,p}   Chart type: prefixes [a]nnounced (default) or [o]riginated,
                   or [p]eer count
      -o path      Output directory where charts are saved
      -v           Verbose console output (debugging)

### Examples

Get default chart (Announced IPv4 Prefixes) for AS2828 (XO Communications).

    bgpchart AS2828

Since we did't specify an output file, the chart is saved in your current 
directory as the file `AS2828-v4-a.png`.

Next, we specify both the IP version, chart type and output file.

    bgpchart -ip v6 -c p -o /home/user/chart.png AS2828

This will fetch the IPv6 Peers chart for AS2828 and save it as `chart.png` in 
the user's home directory
{'fraction_non_alphanumeric': 0.08546199936928414, 'fraction_numerical': 0.02270577105014191, 'mean_word_length': 2.9112207151664613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '694684', 'n_tokens_mistral': 1026, 'n_tokens_neox': 963, 'n_words': 446}