# Contributed code and tools

# goat, the Go Atlas Tools

goat (opens new window) is a CLI tool and an API wrapper library for the RIPE Atlas APIs written in Go. It supports searching in probes, anchors and measurements, as well as scheduling measurements, and downloading, parsing and displaying results. The CLI tool in its compiled form is available as a single executable binary.

# Other Contributions

The RIPE Atlas Community GitHub page (opens new window) hosts a few scripts that have been contributed before.

# Accessing site functionality from scripts with API keys

For some kinds of data, you can gain access using API keys. These keys can be created in the key management screen (opens new window).

See the API key documentation for help on creating and using keys.

# Convert JSON traceroutes to human-readable format

(Contributed by Jan Hugo Prins)

A python script (opens new window) to convert the Atlas traceroute output to readable traceroutes.

The whois information is gathered from Cymru using: https://github.com/JustinAzoff/python-cymruwhois (opens new window)

# Decoding result details

Decoding of result JSON blobs is most easily accomplished by way of the Sagan (opens new window) Python library. You pass the result text to the parser and out comes a native Python object:

from ripe.atlas.sagan import PingResult

my_result = PingResult("<result string from RIPE Atlas ping measurement>")

print(my_result.rtt_median)
123.456

print(my_result.af)
6

# Manual decoding DNS result details

If you'd rather not use a library, instead opting to do the parsing yourself, the samples below should help.

The following code examples show possible ways in which a abuf or qbuf field in the DNS measurement results could be decoded. The examples were written for version 4400 and apply the example abuf embedded in the code.

# Perl

#!/usr/bin/perl -I/root/Net-DNS-0.68/lib
use MIME::Base64;
use Net::DNS;
use Net::DNS::Packet;
#use strict;
my $bb64 = 'f2+AgAABAAEAAAAAA3d3dwRyaXBlA25ldAAAAQABwAwAAQABAAA3+gAEwQAGiw==';
my $data = decode_base64($bb64);
my $packet = Net::DNS::Packet->new(\$data, 1);

;; HEADER SECTION
;; id = 32623
;; qr = 1      opcode = QUERY    aa = 0    tc = 0    rd = 0
;; ra = 1      ad = 0    cd = 0    rcode  = NOERROR
;; qdcount = 1  ancount = 1  nscount = 0  arcount = 0

;; QUESTION SECTION (1 record)
;; www.ripe.net.    IN    A

;; ANSWER SECTION (1 record)
www.ripe.net.    14330    IN    A    193.0.6.139

;; AUTHORITY SECTION (0 records)

;; ADDITIONAL SECTION (0 records)

# Python

atlas@ronin:~$ python/bin/python
>>> import base64
>>> import dns.message
>>> dnsmsg = dns.message.from_wire(base64.b64decode('f2+AgAABAAEAAAAAA3d3dwRyaXBlA25ldAAAAQABwAwAAQABAAA3+gAEwQAGiw=='))
>>> print dnsmsg
id 32623
opcode QUERY
rcode NOERROR
flags QR RA
;QUESTION
www.ripe.net. IN A
;ANSWER
www.ripe.net. 14330 IN A 193.0.6.139
;AUTHORITY
;ADDITIONAL
Last Updated: Monday 10 June 2024