Skip to content

Installation

moo_hax edited this page May 2, 2021 · 10 revisions

The easiest way to get started is to use Docker or the Azure button above (which requires an Azure account). It is highly recommended that you run Counterfit inside a Docker container instance or install Counterfit in a virtual environment.

Azure

To run Counterfit from your browser

  1. Click the button below to initiate small resource deployment to your Azure account.

    Deploy to Azure

  2. In the configuration blade, specify your subscription and resource group.

  3. In your Azure Shell, type the following, replacing RESOURCE_GROUP with the name of the resource group selected in the previous step.

az container exec --resource-group RESOURCE_GROUP –name counterfit –exec-command '/bin/bash'
  1. Within the container, launch Counterfit.
python counterfit.py

Docker

  1. Install Docker Desktop
  2. Execute Counterfit as follows docker run -it [counterfit_image] python counterfit.py

Conda

  1. Install Anaconda Python.
  2. Create a virtual environment via conda.
$> conda create -n counterfit-venv python=3.7
$> conda activate counterfit-venv
$> (conda activate) git clone https://github.com/Azure/counterfit.git
$> (counterfit-venv) pip install -r requirements.txt
$> (counterfit-venv) python counterfit.py

Python Virtual Environment

1.Create a virtual environment.

$> Python -m venv counterfit-venv
  1. Activate virtual environment.
$> counterfit-venv\Scripts\activate.bat
$> source counterfit-venv/bin/activate

3.Install requirements

$> (counterfit-venv) pip install -r requirements.txt

Ubuntu and Windows

  1. Clone the repository and install the requirements.
$> git clone https://github.com/Azure/counterfit.git
$> cd counterfit
$> pip install -r requirements.txt
$> python counterfit.py

Non-Azure Environments

  1. Use your container service of choice.
  2. Pull the Docker image
Docker pull [image:tag]
  1. Execute the image
docker run -it [counterfit_image] python counterfit.py

Note: There is a known bug installing TextAttack on Windows. A workaround is to download paramcf manually, change the file extension to .zip, extract it, and drop the extracted paramcf folder into c:\users\user.cache. See Frameworks for more information on the caching mechanism.