This provides full instructions on how to set up CV-Inspector.
CV-Inspector was developed and used in the paper: CV-Inspector: Towards Automating Detection of Adblock Circumvention.
Visit our CV-Inspector Project page for more information, including datasets that we utilized in the paper.
If you create a publication (including web pages, papers published by a third party, and publicly available presentations) using CV-Inspector, please cite the corresponding paper as follows:
@inproceedings{le2021cvinspector,
title={{CV-Inspector: Towards Automating Detection of Adblock Circumvention}},
author={Le, Hieu and Markopoulou, Athina and Shafiq, Zubair},
booktitle={The Network and Distributed System Security Symposium (NDSS)},
url = {https://dx.doi.org/10.14722/ndss.2021.24055},
doi = {10.14722/ndss.2021.24055},
year={2021}
}
We also encourage you to provide us (athinagroupreleases@gmail.com) with a link to your publication. We use this information in reports to our funding agencies.
In order to properly run CV-Inspector, your environment must be completely setup.
This setup was tested using Amazon Machine Image: Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
- Install all basic dependencies
- npm, mongodb, xvfb, Python 3.6+, python-pip, virtualenv
- Create a virtual environment for python3: we will call this
cvinspector
virtualenv --python=python3 [path_to_your_envs]/cvinspector
- Next see Install Google-Chrome 78
- Next see Install Chrome Driver 78
- Set up CV-Inspector Adblock Plus Chrome Extension
- Follow instructions from that repo to build the extension
- Keep track of where the
devenv.chrome
directory is within that project
- git clone CV-Inspector
- Install CV-Inspector python module: See Installing CV-Inspector
- Build chrome extensions: See Build CV-Inspector Chrome Extensions
- Install the necessary MongoDB collections: See Setup MongoDB
- Setup the chrome profiles you will need. CV-Inspector relies on two main cases: (A) No Adblocker, (B) With Adblocker. Along with those, we also can decide whether to consider the anti-cv list or only the easylist.
- Install npm packages for ad-block postprocessing.
Your environment is now ready. Now proceed to Starting CV-Inspector
- cd to the root project
- Activate virtualenv if necessary
source [path_to_your_envs]/cvinspector/bin/activate
- As a development package:
pip install -e .
CV-Inspector uses google-chrome 78. To make sure it is compatible, do the following:
wget https://www.slimjet.com/chrome/download-chrome.php?file=files%2F78.0.3904.97%2Fgoogle-chrome-stable_current_amd64.deb -O google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get -f install
wget https://chromedriver.storage.googleapis.com/78.0.3904.105/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mv chromedriver [CV-Inspector]/chromedriver/chromedriver78
- cd to the root project
cvinspector_buildextensions --extension_path chromeext
- if this fails, you may need to update your nodejs and npm versions
- To update nodejs:
sudo npm cache clean -f sudo npm install -g n sudo n stable
- Then update npm:
sudo npm install -g npm
- See if both are updated by looking at their versions:
npm -v node -v
- Install MongoDB
- Create the necessary db and collections:
- cd to the
external_scripts/
directory of this project - Open a new terminal and start the client side of mongodb:
mongo
- Create a new db:
use anticircumvention
- Add all necessary collections using script:
load("setup_mongo_collections.js")
- Verify collections are there:
show collections
- You are done:
quit()
- cd to the
The proxy serves the version of EasyList and Anti-CV list that we want.
- Start a screen:
screen -S abp_proxy
- Activate the
cvinspector
virtual env:source [path_to_your_envs]/cvinspector/bin/activate
- Go to the root of CV-Inspector:
cvinspector_abp_proxy --filter_list_directory filter_lists
Automatically create four default profiles. For now, the chrome profiles are hardcoded to be in chromeprofiles
within CV-Inspector root directory.
First scenario: We need No Adblocker case and With Adblocker case (with EasyList only)
Second scenario: We need No Adblocker case and With Adblocker case (with EasyList + Anti-CV list)
- Run the Adblock Plus proxy first: See Adblock Plus Proxy
- Then within a different screen, activate the
cvinspector
virtualenvsource [path_to_your_envs]/cvinspector/bin/activate
- Run the command:
The below is an example of how you can call cvinspector_create_chrome_profiles
.
cvinspector_create_chrome_profiles --chrome_driver_path chromedriver/chromedriver78 --chrome_adblockplus_ext_abs_path /home/ubuntu/github/adblockpluschrome/devenv.chrome
Unfortunately, we cannot use nodeJS v14 to build the ad-block package.
To build this AND run CV-Inspector, you must have nodeJS v10 (assuming our environment is what we described in Setup Overview).
- Purge what we have before:
sudo apt-get purge nodejs npm
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get install -y nodejs
- Check that your
npm -v
should be 6 andnode -v
should be 10. - Go to the root directory of CV-Inspector
npm install --save fs path ad-block
Your environment must be setup already. See Setup Overview
Note 1: If you already have the screen necessary, then re-use them. Note 2: You must have the node version as described in Setup Ad-block Postprocessing
A. We need to start the local proxy that serves the static list of easylist and anti-cv list.
- Start a new screen :
screen -S abp_proxy
- Activate the virtualenv:
source [path_to_your_envs]/cvinspector/bin/activate
- Go to root directory of CV-Inspector
- start the proxy:
cvinspector_abp_proxy --filter_list_directory filter_lists
- Detach from the screen:
CTRL+a then press d
B. Now we can run the script for CV-Inspector
- Start a new screen :
screen -S cvinspector
- Activate the virtualenv:
source [path_to_your_envs]/cvinspector/bin/activate
- Go to root directory of CV-Inspector
- The main script is cvinspector_monitor. It has many parameters to pass in, so use
cvinspector_monitor --help
if need be. - While the script is running, you can detach from screen if necessary using
CTRL+a then press d
.
An example here: (this example can be used as is to run the example file misc_data/example_label_input.csv)
cvinspector_monitor --anticv_on False --trials 4 --beyond_landing_pages true --filter_list_paths filter_lists/easyprivacy.txt,filter_lists/disconnectme_abp.txt,filter_lists/getadmiral-domains.txt,filter_lists/antiadblockfilters.txt --classifier_path model/rf_model.sav --classifier_features_file_path model/features.txt --start_index 0 --end_index 2 --sites_csv misc_data/example_label_input.csv --output_directory /home/ubuntu/temp_output/detection_output/example_monitor/ --output_directory_ts /home/ubuntu/temp_output/detection_output/example_monitor_ts/ --output_suffix test_label --chrome_driver_path chromedriver/chromedriver78 --chrome_adblockplus_ext_abs_path /home/ubuntu/github/adblockpluschrome/devenv.chrome --by_rank false --log_level INFO
When the script finishes, it will print out where it outputs the last CSV with the label results. Use the cv_detect
column from the CSV to know whether it predicted 0 = No Circumvention
or 1 = Has Circumvention
Important parameters to notice:
--anticv_on
: whether you want CV-Inspector to load the anti-cv list. If false, it will only rely on EasyList--filter_list_paths
: path to filterlists that you want to use to filter out traffic that you DO NOT care about--sites_csv
: the file that you want CV-Inspector to run on. An example is in misc_data/example_label_input.csv. Formatting must match that file--start_index
and--end_index
: How many sites of the given file from--sites_csv
do you want to crawl? For example, if the csv file has 100 sites and you only want to first test the first 10, then use--start_index 0 --end_index 10
.--output_directory
: where the output will be--beyond_landing_pages
: if you want it to find a subpage to crawl as well.--beyond_landing_pages_only
: Given a URL, crawl an existing subpage only, while skipping the given URL.--chrome_driver_path
: Path to your chrome driver, this should be inchromedriver/chromedriver78
--chrome_adblockplus_ext_abs_path
: Path to the CV-Inspector custom adblock plus. See Setup Overview