Please follow this order to set up each component.
The scanner used by 6Sense can be found here: https://github.com/IPv6-Security/scanv6
Download and install it somewhere on your machine. To check that it compiled properly, run ./scanv6 -h. 6Sense will create the config file for scanv6 based on the parameters in the 6Sense config.py. You can optionally define your config file separately and pass it to 6Sense by setting the config file path and setting RESET_CONFIG to be False.
The offline dealiaser (used for prefix matching of aliased regions) used by 6Sense is here: https://github.com/IPv6-Security/offline-dealiaser
Download and install it somewhere on your machine. To check that it compiled properly, run ./aliasv6 -h.
You will need three separate datasets to run 6Sense:
- A mapping of IPv6 routing prefixes to ASes. We suggest Routeviews Pfx2AS for ease of use. It can be found here: https://www.caida.org/catalog/datasets/routeviews-prefix2as/
- A list of known aliased prefixes. One option is the alias prefix dataset provided by the IPv6 Hitlist here: https://ipv6hitlist.github.io/. You may use an empty file if you wish to bypass offline dealiasing.
- A seed dataset of potentially active IPv6 addresses. Choosing the optimal seed dataset for a particular use case is a nontrivial open problem. Hitlists such as the IPv6 Hitlist (https://ipv6hitlist.github.io/) give some diversity of data sources, and may be good for early users. Choose your seed dataset wisely as it will determine what you find... (Note: IPv6 seed addresses should be in fully expanded format).
When both the Scanner and the Dealiaser are built, and you have your dataset, you are ready to run 6Sense! Follow the steps below to setup the generator.
- Set all of the file paths in
config.py(including the paths to the scanner and dealiaser you just installed and the datasets you just downloaded or collected). Keep in mind some paths are relative to your home directory, and some are absolute, so make sure to check the comments inconfig.pyif it's not finding your filepath. - Set the scanner parameters in config.py.
- Create your python environment (we suggest using Conda) and initialize it with the packages in 6sense.yml.
- Build the cython module for printing IPs with
python3 setup.py build_ext --inplaceBe careful to do this in your final python envionrment. Cython does not port well between different python enivronments. - Next you need to ensure your pfx2as file is properly parsed. You can do so by running
python3 rounding.py pfx2as_filename.dat pfx2as_rounded_filename.dat. - Initiate a Jupyter Notebook instance for
Gradient_Testing_On_Generation.ipynb. - To train the models, you should run the cells under Train Model.
- To run the model, you should run the cells under Run Model.
6Sense contains numerous parameters that can be changed to augment generator behavior. While there are many variations of inputs, we'll address a few of the important parameters (specifically those passed to the ComparisonModel_online function and it's Upper64_HPs and Lower64_HPs parameters) here:
- Generation Amount: The first and primary input parameter to
ComparisonModel_onlineis the number of addresses to generate. - Comparison Name: The second input parameter to
ComparisonModel_onlineis the experiment name (used when creating output files/folders). allocation_gradient_threshold: This parameter adjusts how long the Breadth phase (even sampling) of allocation generation lasts. After generating everyallocation_gradient_amountaddresses, 6Sense checks the ratio of new allocations discovered with active addresses in that batch to total allocations discovered with active addreses so far. Once this ratio drops belowallocation_gradient_threshold, allocation generation switches to Depth. If not provided, it defaults to0.005. This default provides a good depth/breadth ratio for a100Maddress scan. It is suggested to decrease this parameter as you increase the number of addresses to generate (since you have more budget to explore initially). One suggestion is to decrease this parameter by an order of magnitude with every order of magnitude increase in generative amount.allocation_gradient_amount: Used in conjunction withallocation_gradient_thresholdto describe how many IPs to generate before re-evaluating the number of new ASes found. If not provided it defaults to1M.ppi: Number of addresses to generate per Depth iteration before updating the Allocation weights. By default it is1M. We suggest increasing this when generation amount increases by an order of magnitude (i.e. increasing from1Mfor a100Mscan to10Mfor a1Bscan) to ensure Depth allocation sampling does not converge too quickly.per_iteration: How many IPs to generate before sending to the scanner. This is bounded byallocation_gradient_thresholdfor the Breadth phase andppifor the Depth phase. This does not change generator behavior, but can optimze for efficiency/concurrency (i.e. if scanning slowly, it may make sense to generate smaller amounts like100Kat a time, so more scanning can occur concurrently with generation). Important for optimization because generating larger batches is typically faster (i.e. due to GPU optimizations with the LSTM and moving data between modules), but smaller batches can be sent to the scanner more quickly. We suggest using100Kfor most applications, since this ensures most scanning is concurrent with generation (since usually generation is faster than scanning), but if your scan rate is very high, you may wish to change this to500Kor higher.Upper64_HPs: Hyperparameters describing the LSTM. For most users we do not suggest adjusting these. However, users on multi-gpu machines can adjust the number of gpus used during generation with thegpusparameter.Lower64_HPs.subprocesses: Thesubprocessesattribute allows users to list how many subprocesses to allocate to the Multiprocess Lower-64 generator.
6Sense is licensed under Apache 2.0. For more information, see the LICENSE file.