├── docs
├── _static
│ ├── .keep
│ └── custom.css
├── requirements.txt
├── changelog.rst
├── contributing.rst
├── .readthedocs.yaml
├── index.rst
├── packaging.rst
├── quickstart.rst
└── troubleshooting.rst
├── scripts
├── adig
├── ahttp
├── antp
├── aping
├── asslcert
├── atraceroute
└── ripe-atlas
├── ripe
├── atlas
│ ├── tools
│ │ ├── __init__.py
│ │ ├── commands
│ │ │ ├── __init__.py
│ │ │ ├── go.py
│ │ │ ├── measure
│ │ │ │ ├── ntp.py
│ │ │ │ ├── sslcert.py
│ │ │ │ ├── ping.py
│ │ │ │ ├── __init__.py
│ │ │ │ ├── spec.py
│ │ │ │ ├── http.py
│ │ │ │ ├── traceroute.py
│ │ │ │ └── dns.py
│ │ │ ├── probe_info.py
│ │ │ ├── stream.py
│ │ │ ├── shibboleet.py
│ │ │ ├── alias.py
│ │ │ └── configure.py
│ │ ├── helpers
│ │ │ ├── __init__.py
│ │ │ ├── actions.py
│ │ │ ├── sanitisers.py
│ │ │ ├── colours.py
│ │ │ └── xdg.py
│ │ ├── renderers
│ │ │ ├── templates
│ │ │ │ └── reports
│ │ │ │ │ ├── aggregate_ping.txt
│ │ │ │ │ ├── ssl_consistency.txt
│ │ │ │ │ ├── sslcert.txt
│ │ │ │ │ └── dns.txt
│ │ │ ├── __init__.py
│ │ │ ├── raw.py
│ │ │ ├── dst_asn.py
│ │ │ ├── http.py
│ │ │ ├── sslcert.py
│ │ │ ├── traceroute.py
│ │ │ ├── ntp.py
│ │ │ ├── dns_compact.py
│ │ │ ├── ssl_consistency.py
│ │ │ ├── traceroute_aspath.py
│ │ │ ├── dns.py
│ │ │ └── ping.py
│ │ ├── version.py
│ │ ├── aggregators
│ │ │ ├── __init__.py
│ │ │ └── base.py
│ │ ├── exceptions.py
│ │ ├── settings
│ │ │ └── templates
│ │ │ │ └── base.yaml
│ │ ├── streaming.py
│ │ ├── ipdetails.py
│ │ ├── cache.py
│ │ └── filters.py
│ └── __init__.py
└── __init__.py
├── tests
├── README
├── __init__.py
├── commands
│ ├── __init__.py
│ ├── test_base.py
│ ├── test_loading.py
│ └── test_alias.py
├── helpers
│ ├── __init__.py
│ ├── test_sanitisers.py
│ └── test_validators.py
├── aggregators
│ └── __init__.py
├── renderers
│ ├── __init__.py
│ ├── test_http.py
│ └── test_dns_compact.py
├── test_docs.py
├── base.py
└── test_bash_completion.py
├── screenshots
├── ripe-atlas-measure-ping.png
├── ripe-atlas-probe-search.png
└── ripe-atlas-measurement-search.png
├── tox.ini
├── MANIFEST.in
├── ripe-atlas-bash-completion.sh
├── .github
└── workflows
│ ├── test.yaml
│ └── python-package.yml
├── .gitignore
├── README.rst
├── setup.py
├── CONTRIBUTING.rst
├── PACKAGING.md
├── dev-scripts
└── compare-openapi-spec.py
└── CHANGES.rst
/docs/_static/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/adig:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/scripts/ahttp:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/scripts/antp:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/scripts/aping:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/ripe/atlas/tools/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/asslcert:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/scripts/atraceroute:
--------------------------------------------------------------------------------
1 | ripe-atlas
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx-rtd-theme
--------------------------------------------------------------------------------
/ripe/atlas/tools/commands/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/helpers/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/changelog.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../CHANGES.rst
2 |
--------------------------------------------------------------------------------
/docs/contributing.rst:
--------------------------------------------------------------------------------
1 | .. include:: ../CONTRIBUTING.rst
2 |
--------------------------------------------------------------------------------
/tests/README:
--------------------------------------------------------------------------------
1 | How to run tests
2 | Make sure you have nose installed and run from the main directory:
3 | nosetests tests
4 |
--------------------------------------------------------------------------------
/screenshots/ripe-atlas-measure-ping.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RIPE-NCC/ripe-atlas-tools/HEAD/screenshots/ripe-atlas-measure-ping.png
--------------------------------------------------------------------------------
/screenshots/ripe-atlas-probe-search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RIPE-NCC/ripe-atlas-tools/HEAD/screenshots/ripe-atlas-probe-search.png
--------------------------------------------------------------------------------
/screenshots/ripe-atlas-measurement-search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RIPE-NCC/ripe-atlas-tools/HEAD/screenshots/ripe-atlas-measurement-search.png
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [testenv]
2 | deps =
3 | flake8
4 | pytest
5 | sphinx
6 | sphinx-rtd-theme
7 | commands =
8 | flake8 --max-line-length=88 setup.py ripe/atlas/tools/ scripts/ tests/
9 | pytest -r a {posargs}
10 |
--------------------------------------------------------------------------------
/docs/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | version: 2
2 |
3 | build:
4 | os: ubuntu-24.04
5 | tools:
6 | python: "3.12"
7 |
8 | sphinx:
9 | configuration: docs/conf.py
10 |
11 | python:
12 | install:
13 | - requirements: docs/requirements.txt
14 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/templates/reports/aggregate_ping.txt:
--------------------------------------------------------------------------------
1 |
2 | --- {target} ping statistics ---
3 | {sent} packets transmitted, {received} received, {packet_loss:.3}% loss
4 | rtt min/med/avg/max = {min:.3f}/{median:.3f}/{mean:.3f}/{max:.3f} ms
5 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/templates/reports/ssl_consistency.txt:
--------------------------------------------------------------------------------
1 | Certificate:
2 | Issuer: C={issuer_c}, O={issuer_o}, CN={issuer_cn}
3 | Subject: C={subject_c}, O={subject_o}, CN={subject_cn}
4 | SHA256 Fingerprint={sha256fp}
5 |
6 | Seen by {seenby} probe{s}
7 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include LICENSE
2 | include README.rst
3 | include CHANGES.rst
4 | include MANIFEST.in
5 | include ripe/atlas/tools/user-agent
6 | recursive-include ripe *.py
7 | recursive-include ripe *.yaml
8 | recursive-include ripe *.txt
9 | recursive-include tests *.py
10 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/helpers/actions.py:
--------------------------------------------------------------------------------
1 | from argparse import Action
2 |
3 |
4 | class StoreIfNotEmpty(Action):
5 | """
6 | Like 'store' but don't overwrite an existing/conflicting option if the given
7 | value is empty.
8 | """
9 | def __call__(self, parser, namespace, values, option_string=None):
10 | if values:
11 | setattr(namespace, self.dest, values)
12 |
--------------------------------------------------------------------------------
/docs/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* override table width restrictions */
2 | @media screen and (min-width: 767px) {
3 |
4 | .wy-table-responsive table td {
5 | /* !important prevents the common CSS stylesheets from
6 | overriding this as on RTD they are loaded after this stylesheet */
7 | white-space: normal !important;
8 | }
9 |
10 | .wy-table-responsive {
11 | overflow: visible !important;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/ripe-atlas-bash-completion.sh:
--------------------------------------------------------------------------------
1 | ## This is highly inspired from Django's manage.py autocompletion
2 | ## https://github.com/django/django/blob/1.9.4/extras/django_bash_completion#L42-L57
3 | ## To install this, add the following line to your .bash_profile:
4 | ##
5 | ## . ~/path/to/django_bash_completion
6 |
7 | _ripe_atlas_bash_completion()
8 | {
9 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
10 | COMP_CWORD=$COMP_CWORD \
11 | RIPE_ATLAS_AUTO_COMPLETE=1 $1 ) )
12 | }
13 | complete -F _ripe_atlas_bash_completion -o default ripe-atlas
14 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/templates/reports/sslcert.txt:
--------------------------------------------------------------------------------
1 | Certificate:
2 | Data:
3 | Version: {version}
4 | Serial Number: {serial_number}
5 | Signature Algorithm: {signature_algorithm}
6 | Issuer: C={issuer_c}, O={issuer_o}, CN={issuer_cn}
7 | Validity
8 | Not Before: {not_before}
9 | Not After : {not_after}
10 | Subject: C={subject_c}, O={subject_o}, CN={subject_cn}
11 | Subject Public Key Info:
12 | Public Key Algorithm: {pkey_type}
13 | Public-Key: ({pkey_bits} bit)
14 | SHA1 Fingerprint={sha1fp}
15 | SHA256 Fingerprint={sha256fp}
16 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/templates/reports/dns.txt:
--------------------------------------------------------------------------------
1 |
2 | - {response_id} -
3 |
4 | ; <<>> RIPE Atlas Tools <<>> {question_name}
5 | ;; global options: +cmd
6 | ;; Got answer:
7 | ;; ->>HEADER<<- opcode: {header_opcode}, status: {header_return_code}, id: {header_id}
8 | ;; flags: {header_flags}; QUERY: 1, ANSWER: {answer_count}, AUTHORITY: {authority_count}, ADDITIONAL: {additional_count}
9 | {edns}{question}{answers}{authorities}{additionals}
10 | ;; Query time: {response_time} msec
11 | ;; SERVER: {destination_address}#53({destination_address})
12 | ;; WHEN: {created}
13 | ;; MSG SIZE rcvd: {response_size}
14 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/tests/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/tests/helpers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/tests/aggregators/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/tests/renderers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/version.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | __version__ = "3.3.1"
17 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | RIPE Atlas Tools (Magellan)
2 | ===========================
3 |
4 | The official command-line client for RIPE Atlas.
5 |
6 | .. _index-why-this-exists:
7 |
8 |
9 | Why This Exists
10 | ===============
11 |
12 | `RIPE Atlas`_ is a powerful Internet measurements platform that until recently
13 | was only accessible via the website and the RESTful API. The reality however is
14 | that a great many people using RIPE Atlas are most comfortable on the
15 | command-line, so this project is an attempt to fill that gap.
16 |
17 | .. _RIPE Atlas: https://atlas.ripe.net
18 |
19 |
20 | Contents
21 | ========
22 |
23 | .. toctree::
24 | :maxdepth: 2
25 |
26 | quickstart
27 | installation
28 | use
29 | plugins
30 | contributing
31 | packaging
32 | troubleshooting
33 | changelog
34 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | from .base import Renderer
17 |
18 | __all__ = ["Renderer"]
19 |
--------------------------------------------------------------------------------
/ripe/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | try:
17 | __import__('pkg_resources').declare_namespace(__name__)
18 | except ImportError:
19 | from pkgutil import extend_path
20 | __path__ = extend_path(__path__, __name__)
21 |
--------------------------------------------------------------------------------
/ripe/atlas/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | try:
17 | __import__('pkg_resources').declare_namespace(__name__)
18 | except ImportError:
19 | from pkgutil import extend_path
20 | __path__ = extend_path(__path__, __name__)
21 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/aggregators/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | from .base import RangeKeyAggregator, ValueKeyAggregator, aggregate
17 |
18 | __all__ = [
19 | "aggregate",
20 | "RangeKeyAggregator",
21 | "ValueKeyAggregator",
22 | ]
23 |
--------------------------------------------------------------------------------
/.github/workflows/test.yaml:
--------------------------------------------------------------------------------
1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3 |
4 | name: Python package
5 |
6 | on:
7 | push:
8 | branches: [ master, 'release-*' ]
9 | pull_request:
10 | branches: [ $default-branch ]
11 |
12 | jobs:
13 | test:
14 |
15 | runs-on: ubuntu-latest
16 | strategy:
17 | fail-fast: false
18 | matrix:
19 | python-version: ["3.10", "3.11", "3.12", "3.13"]
20 |
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Set up Python ${{ matrix.python-version }}
24 | uses: actions/setup-python@v2
25 | with:
26 | python-version: ${{ matrix.python-version }}
27 | - name: Install dependencies
28 | run: |
29 | python -m pip install --upgrade pip
30 | python -m pip install tox
31 | - name: tox
32 | run: tox
33 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *.swp
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 |
27 | # PyInstaller
28 | # Usually these files are written by a python script from a template
29 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
30 | *.manifest
31 | *.spec
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *,cover
46 |
47 | # Translations
48 | *.mo
49 | *.pot
50 |
51 | # Django stuff:
52 | *.log
53 |
54 | # Sphinx documentation
55 | docs/_build/
56 |
57 | # PyBuilder
58 | target/
59 |
60 | # PyCharm
61 | .idea/
62 |
63 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/exceptions.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | from ripe.atlas.tools.helpers.colours import colourise
17 |
18 | import sys
19 |
20 |
21 | class RipeAtlasToolsException(Exception):
22 | def write(self):
23 | r = str(self)
24 | sys.stderr.write("\n{0}\n\n".format(colourise(r, "red", fileobj=sys.stderr)))
25 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/helpers/sanitisers.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | FORBIDDEN = dict((i, None) for i in list(range(0, 32)) + [127])
17 |
18 |
19 | def sanitise(s, strip_newlines=True):
20 | """
21 | Strip out control characters to prevent people from screwing with the output
22 | """
23 | if isinstance(s, bytes):
24 | s = s.decode("utf-8")
25 | if not isinstance(s, str):
26 | return s
27 |
28 | if not strip_newlines:
29 | return s.translate(dict((k, v) for k, v in FORBIDDEN.items() if not k == 10))
30 |
31 | return s.translate(FORBIDDEN)
32 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/renderers/raw.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | import json
17 |
18 | from .base import Renderer as BaseRenderer
19 | from ..helpers.sanitisers import sanitise
20 |
21 |
22 | class Renderer(BaseRenderer):
23 |
24 | RENDERS = [
25 | BaseRenderer.TYPE_PING,
26 | BaseRenderer.TYPE_TRACEROUTE,
27 | BaseRenderer.TYPE_DNS,
28 | BaseRenderer.TYPE_SSLCERT,
29 | BaseRenderer.TYPE_HTTP,
30 | BaseRenderer.TYPE_NTP,
31 | ]
32 |
33 | SHOW_DEFAULT_HEADER = False
34 | SHOW_DEFAULT_FOOTER = False
35 |
36 | def on_result(self, result, probes=None):
37 | return sanitise(json.dumps(result.raw_data, separators=(",", ":"))) + "\n"
38 |
--------------------------------------------------------------------------------
/tests/helpers/test_sanitisers.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | import unittest
17 |
18 | from ripe.atlas.tools.helpers.sanitisers import sanitise
19 |
20 |
21 | class TestSanitisersHelper(unittest.TestCase):
22 | def test_sanitise(self):
23 |
24 | self.assertEqual("clean", sanitise("clean"))
25 | for i in list(range(0, 32)) + [127]:
26 | self.assertEqual("unclean", sanitise("unclean" + chr(i)))
27 |
28 | self.assertEqual(None, sanitise(None))
29 | self.assertEqual(7, sanitise(7))
30 |
31 | def test_sanitise_with_newline_exception(self):
32 | self.assertEqual("unc\nlean", sanitise("unc\nlean", strip_newlines=False))
33 | for i in set(list(range(0, 32)) + [127]).difference({10}):
34 | self.assertEqual(
35 | "unc\nlean", sanitise("unc\nlean" + chr(i), strip_newlines=False)
36 | )
37 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/settings/templates/base.yaml:
--------------------------------------------------------------------------------
1 | #
2 | # This is the config file for the ripe-atlas command. It follows the YAML
3 | # formatting standard found here: http://yaml.org/ -- but the layout should be
4 | # rather intuitive.
5 | #
6 | # Lines that start with "#" (like this one) are considered comments and
7 | # are ignored by the parser. Beyond that, the configuration data is laid out
8 | # in a hierarchical fashion
9 | #
10 | # section_name:
11 | # variable_name: "some-value"
12 | # some_other_variable_name: 123
13 | # a_subsection:
14 | # something: "something else"
15 | #
16 | # Where possible, we've commented this file to help you out, but you can also
17 | # use the ripe-atlas script to modify it for you. Simply type:
18 | #
19 | # $ ripe-atlas configure --help
20 | #
21 | # And the help text that appears will walk you through it.
22 | #
23 | # One good thing to put in here is your API key. This makes it easy to
24 | # generate measurements quickly. Defining your API key looks like this:
25 | #
26 | # authorisation:
27 | # create: "YOUR-API-KEY"
28 | #
29 | # Leaving this file empty won't hurt, but it will mean that you'll have to
30 | # use the --auth=YOUR-API-KEY flag every time you try to create a
31 | # measurement.
32 | #
33 | # What follows is a complete break down of all possible options, set initially
34 | # to their defaults. If you wish to change a default, simply change the value
35 | # to whatever you like and save this file.
36 | #
37 |
38 | ############################################################################
39 |
40 | {payload}
41 |
42 |
--------------------------------------------------------------------------------
/tests/test_docs.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | import unittest
17 |
18 | from sphinx.application import Sphinx
19 |
20 |
21 | class DocTest(unittest.TestCase):
22 |
23 | SOURCE_DIR = "docs"
24 | CONFIG_DIR = "docs"
25 | OUTPUT_DIR = "docs/build"
26 | DOCTREE_DIR = "docs/build/doctrees"
27 |
28 | def test_html_documentation(self):
29 | Sphinx(
30 | self.SOURCE_DIR,
31 | self.CONFIG_DIR,
32 | self.OUTPUT_DIR,
33 | self.DOCTREE_DIR,
34 | buildername="html",
35 | warningiserror=True,
36 | ).build(force_all=True)
37 |
38 | def test_text_documentation(self):
39 | Sphinx(
40 | self.SOURCE_DIR,
41 | self.CONFIG_DIR,
42 | self.OUTPUT_DIR,
43 | self.DOCTREE_DIR,
44 | buildername="text",
45 | warningiserror=False,
46 | ).build(force_all=True)
47 |
--------------------------------------------------------------------------------
/docs/packaging.rst:
--------------------------------------------------------------------------------
1 | Packaging
2 | =========
3 |
4 | For those interested in packaging RIPE Atlas Tools for their favourite distro,
5 | this section is for you.
6 |
7 | Currently Supported
8 | -------------------
9 |
10 | * OpenBSD
11 | * FreeBSD
12 | * Gentoo
13 | * Debian
14 | * Ubuntu
15 |
16 | In Progress
17 | -----------
18 |
19 | * Fedora: Jan Včelák is currently building the binary packages in `COPR`_ (which will take some time as there is a lot of other packages in the queue)
20 |
21 | .. _`COPR`: https://copr.fedoraproject.org/coprs/jvcelak/ripe-atlas-tools/
22 |
23 | Additional Distributions
24 | ------------------------
25 |
26 | Is your distribution not listed? If you'd like to build a package for another
27 | distro or even if you're just someone who knows someone who can help us package
28 | and distribute this, please get in touch.
29 |
30 | Further Information
31 | -------------------
32 |
33 | User Agent
34 | ~~~~~~~~~~
35 |
36 | When packaging, it's good practise to manually set the user agent used within
37 | the toolkit so that we can get a rough idea of which distros are using this
38 | software. This is easily done by writing an arbitrary string to
39 | ``/ripe/atlas/tools/user-agent``. Something like this is recommended:::
40 |
41 | RIPE Atlas Tools [FreeBSD 10.2] 1.2
42 |
43 | The only limitations to this file are that it should:
44 |
45 | * Only have one line in it (all other will be ignored)
46 | * That line should have a maximum of 128 characters in it
47 |
48 | If no ``user-agent`` file is included then a platform-specific string will be
49 | automatically generated based on Python's ``platform`` module.
50 |
--------------------------------------------------------------------------------
/ripe/atlas/tools/commands/go.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2016 RIPE NCC
2 | #
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 | #
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 | #
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | import webbrowser
17 | from .base import Command as BaseCommand
18 | from ..helpers.validators import ArgumentType
19 |
20 |
21 | class Command(BaseCommand):
22 |
23 | NAME = "go"
24 |
25 | DESCRIPTION = "Visit the web page for a specific measurement"
26 | URL = "https://atlas.ripe.net/measurements/{0}/"
27 |
28 | def add_arguments(self):
29 | self.parser.add_argument(
30 | "measurement_id",
31 | type=ArgumentType.msm_id_or_name(),
32 | help="The measurement id or alias you want reported",
33 | )
34 |
35 | def run(self):
36 | url = self.URL.format(self.arguments.measurement_id)
37 | if not webbrowser.open(url):
38 | self.ok(
39 | "It looks like your system doesn't have a web browser "
40 | "available. You'll have to go there manually: {0}".format(url)
41 | )
42 |
--------------------------------------------------------------------------------
/docs/quickstart.rst:
--------------------------------------------------------------------------------
1 | Quickstart
2 | ==========
3 |
4 | This is a very fast break down of everything you need to start using Ripe Atlas
5 | on the command line. Viewing public data is quick & easy, while creation is a
6 | little more complicated, since you need to setup your authorisation key.
7 |
8 | Viewing Public Data
9 | -------------------
10 |
11 | 1. :ref:`Install ` the toolkit.
12 | 2. View help with: ``ripe-atlas --help``
13 | 3. View a basic report for a public measurement: ``ripe-atlas report ``
14 | 4. View the live stream for a measurement: ``ripe-atlas stream ``
15 | 5. Get a list of probes in ASN 3333: ``ripe-atlas probe-search --asn 3333``
16 | 6. Get a list of measurements with the word "wikipedia" in them: ``ripe-atlas measurement-search --search wikipedia``
17 |
18 | Creating a Measurement
19 | ----------------------
20 |
21 | 1. Log into `RIPE Atlas`_. If you don't have an
22 | account, you can create one there for free.
23 | 2. Visit the `API Keys`_ page and create a new key
24 | with the permission ``Create a new user defined measurement``
25 | 3. Install the toolkit as below.
26 | 4. Configure the toolkit to use your key with ``ripe-atlas configure --set authorisation.create=MY_API_KEY``
27 | 5. View the help for measurement creation with ``ripe-atlas measure --help``
28 | 6. Create a measurement with ``ripe-atlas measure ping --target example.com``
29 |
30 | .. _`RIPE Atlas`: https://atlas.ripe.net/
31 | .. _`API Keys`: https://atlas.ripe.net/keys/
32 |
33 | Advanced Use
34 | ------------
35 |
36 | Refer to the :ref:`complete usage documentation