[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: bug\nassignees: SkypLabs\n\n---\n\n## Describe the bug\n\nA clear and concise description of what the bug is.\n\n## To Reproduce\n\nSteps to reproduce the behaviour.\n\n## Expected behaviour\n\nA clear and concise description of what you expected to happen.\n\n## Screenshots\n\nIf applicable, add screenshots to help explain your problem.\n\n## Execution environment\n\nPlease complete the following information:\n\n - **OS:** [e.g. Debian Stretch]\n - **Python version:** [e.g. 3.6]\n - **ProbeQuest version:** [e.g. 0.7.0]\n - **Method of installation:** [e.g. pip]\n\n## Additional context\n\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: feature\nassignees: SkypLabs\n\n---\n\n## Is your feature request related to a problem?\n\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n## Describe the solution you'd like\n\nA clear and concise description of what you want to happen.\n\n## Describe alternatives you've considered\n\nA clear and concise description of any alternative solutions or features you've considered.\n\n## Additional context\n\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n\n  - package-ecosystem: pip\n    directory: \"/\"\n    schedule:\n      interval: weekly\n      time: \"09:00\"\n      timezone: Europe/Dublin\n    open-pull-requests-limit: 10\n    target-branch: develop\n\n  - package-ecosystem: github-actions\n    directory: \"/\"\n    schedule:\n      interval: weekly\n      time: \"09:00\"\n      timezone: Europe/Dublin\n    open-pull-requests-limit: 10\n    target-branch: develop\n"
  },
  {
    "path": ".github/settings.yml",
    "content": "# See https://github.com/probot/settings for more information.\n\nrepository:\n  name: probequest\n  description: Toolkit for Playing with Wi-Fi Probe Requests\n  homepage: https://probequest.readthedocs.io/en/latest/\n  topics: python, python3, scapy, wifi-security, sniffer, dot11, network-attacks, monitoring, security, wireless, wifi, toolkit\n  private: false\n  has_issues: true\n  has_projects: true\n  has_wiki: false\n  has_downloads: true\n  default_branch: develop\n  allow_squash_merge: true\n  allow_merge_commit: true\n  allow_rebase_merge: true\n\nlabels:\n  - name: feature\n    description: New feature\n    color: 84b6eb\n  - name: enhancement\n    description: Enhancement\n    color: 84b6eb\n  - name: refactor\n    description: Refactoring\n    color: 84b6eb\n\n  - name: sniffer\n    description: Related to the sniffer\n    color: 1d76db\n  - name: parser\n    description: Related to the parser\n    color: 1d76db\n  - name: ui\n    description: Related to the user interface\n    color: 1d76db\n  - name: exporters\n    description: Related to the exporters\n    color: 1d76db\n  - name: cli\n    description: Related to the CLI tool\n    color: 1d76db\n  - name: dependencies\n    description: Related to the dependencies\n    color: 1d76db\n\n  - name: android\n    description: Android platform support issues\n    color: 04727a\n  - name: linux\n    description: Linux platform support issues\n    color: 04727a\n  - name: macos\n    description: Apple macOS platform support issues\n    color: 04727a\n  - name: windows\n    description: Microsoft Windows platform support issues\n    color: 04727a\n\n  - name: bug\n    description: New bug\n    color: ee0701\n  - name: regression\n    description: Software regression\n    color: ee0701\n  - name: security\n    description: Security issue\n    color: ee0701\n\n  - name: duplicate\n    description: Duplicate issue\n    color: cccccc\n  - name: invalid\n    description: Invalid issue\n    color: cccccc\n  - name: on hold\n    description: On hold (waiting for an answer, action required...)\n    color: cccccc\n  - name: won't fix\n    description: The issue won't be fixed\n    color: cccccc\n\n  - name: help wanted\n    description: Help wanted\n    color: 33aa3f\n  - name: question\n    description: Question\n    color: 33aa3f\n\n  - name: documentation\n    description: Related to the documentation\n    color: 2d2de2\n\n  - name: packaging\n    description: Related to software packaging\n    color: 31f427\n\n  - name: testing\n    description: Related to software testing\n    color: efa5ef\n\n  - name: ci/cd\n    description: Related to CI/CD\n    color: e85733\n\n  - name: good first issue\n    description: Good first issue\n    color: 7057ff\n\nbranches:\n  - name: master\n    protection:\n      required_pull_request_reviews:\n      required_status_checks:\n        strict: false\n        contexts:\n          - continuous-integration/travis-ci\n      enforce_admins: true\n      restrictions:\n  - name: develop\n    protection:\n      required_pull_request_reviews:\n      required_status_checks:\n      enforce_admins: false\n      restrictions:\n"
  },
  {
    "path": ".github/workflows/codeql.yml",
    "content": "name: \"CodeQL\"\n\non:\n  push:\n    branches: [ \"develop\", \"main\" ]\n  pull_request:\n    branches: [ \"develop\" ]\n  schedule:\n    - cron: \"41 22 * * 2\"\n\njobs:\n  analyze:\n    name: Analyze\n    runs-on: ubuntu-latest\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n\n    strategy:\n      fail-fast: false\n      matrix:\n        language: [ python ]\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6\n\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v4\n        with:\n          languages: ${{ matrix.language }}\n          queries: +security-and-quality\n\n      - name: Autobuild\n        uses: github/codeql-action/autobuild@v4\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v4\n        with:\n          category: \"/language:${{ matrix.language }}\"\n"
  },
  {
    "path": ".github/workflows/test_and_publish.yml",
    "content": "name: Test and Publish\n\non:\n  push:\n  pull_request:\n    branches: [develop]\n\njobs:\n  test-code:\n    name: Test code\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n        os: [ubuntu-latest, macos-latest]\n        python-version:\n        - '3.9'\n        - '3.10'\n        - '3.11'\n        - '3.12'\n        - '3.13'\n\n    steps:\n      - name: Check out code\n        uses: actions/checkout@v6\n\n      - name: Set up Python ${{ matrix.python-version }}\n        uses: actions/setup-python@v6\n        with:\n          python-version: ${{ matrix.python-version }}\n\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install .[tests] tox-gh-actions\n\n      - name: Test with Tox\n        run: tox\n\n  test-docs:\n    name: Test documentation\n    runs-on: ubuntu-latest\n    env:\n      PYTHON_VERSION: '3.x'\n    steps:\n      - name: Check out code\n        uses: actions/checkout@v6\n\n      - name: Set up Python ${{ env.PYTHON_VERSION }}\n        uses: actions/setup-python@v6\n        with:\n          python-version: ${{ env.PYTHON_VERSION }}\n\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install .[docs]\n\n      - name: Build documentation\n        working-directory: docs\n        run: make html\n\n  publish-to-test-pypi:\n    name: Publish to TestPyPI\n    environment: staging\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs/heads/main' && github.event_name == 'push'\n    needs:\n      - test-code\n      - test-docs\n\n    steps:\n      - name: Check out code\n        uses: actions/checkout@v6\n\n      - name: Set up Python\n        uses: actions/setup-python@v6\n        with:\n          python-version: '3.x'\n\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install --upgrade setuptools wheel twine build\n\n      - name: Build and publish\n        env:\n          TWINE_USERNAME: '__token__'\n          TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}\n        run: |\n          python -m build\n          twine upload --repository testpypi dist/*\n\n  publish-to-pypi:\n    name: Publish to PyPI\n    environment: production\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs/heads/main' && github.event_name == 'push'\n    needs: publish-to-test-pypi\n\n    steps:\n      - name: Check out code\n        uses: actions/checkout@v6\n\n      - name: Set up Python\n        uses: actions/setup-python@v6\n        with:\n          python-version: '3.x'\n\n      - name: Install dependencies\n        run: |\n          python -m pip install --upgrade pip\n          pip install --upgrade setuptools wheel twine build\n\n      - name: Build and publish\n        env:\n          TWINE_USERNAME: '__token__'\n          TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}\n        run: |\n          python -m build\n          twine upload dist/*\n"
  },
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*,cover\n.hypothesis/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# Output files\n*.csv\n\n# Others\n*.swp\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n  - repo: https://github.com/pre-commit/pre-commit-hooks\n    rev: 0b70e285e369bcb24b57b74929490ea7be9c4b19 # v2.2.3\n    hooks:\n      - id: check-ast\n      - id: check-executables-have-shebangs\n      - id: check-yaml\n      - id: flake8\n      - id: trailing-whitespace\n  - repo: https://github.com/pre-commit/mirrors-pylint\n    rev: 135c0cb79ced730834391aa6eeb5a27b6f5867ff # v2.3.1\n    hooks:\n      - id: pylint\n        entry: python3 -m pylint.__main__\n        language: system\n"
  },
  {
    "path": ".readthedocs.yaml",
    "content": "version: 2\n\nbuild:\n  os: ubuntu-20.04\n  tools:\n    python: \"3\"\n\npython:\n  install:\n    - method: pip\n      path: .\n      extra_requirements:\n        - complete\n        - docs\n\nsphinx:\n  configuration: docs/conf.py\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## v0.8.0 - Mar 22, 2022\n\n### Breaking Changes\n\n* The PNL view has been removed.\n\n### Improvements\n\n* Add `pyproject.toml` and `setup.cfg`\n* Remove argparse from dependencies (@fabaff)\n* Use f-strings instead of `str.format()`\n* Add support for Python 3.8, 3.9 and 3.10\n* Drop support for Python 3.4, 3.5 and 3.6\n* Make some dependencies optional\n* Refactor code around Scapy's PipeTools\n* Add metavars to argument parser\n* Turn `interface` option into argument\n* Cache the compiled regex in `Config` once computed\n* Cache the frame filter in `Config` once computed\n* Cache the MAC address' OUI in `ProbeRequest`\n* Use the logging package\n* Add extra dependency group `tests`\n* Add unit tests for the argument parser\n* Add `__version__` attribute to package\n* Use an entry point to generate the CLI tool\n* Use tox for unit testing\n\n### Fixes\n\n* Fix interface checking\n* Close open files before exiting\n* Use a fake `Config` object in unit tests\n* Fix linting issues\n\n### Infrastructure\n\n* Upgrade RTD configuration file to version 2\n* Monitor GH Actions dependencies with Dependabot\n* Use `main` as branch for production releases\n* Upgrade to GitHub-native Dependabot\n* Add macOS to build matrix\n* Switch from Travis CI to GitHub Actions\n\n## v0.7.2 - Aug 26, 2019\n\n### Improvements\n\n* Use the new [Scapy built-in asynchronous\n  sniffer](https://scapy.readthedocs.io/en/latest/usage.html#asynchronous-sniffing)\n* Introduce the new `Config` object containing the configuration of ProbeQuest\n\n### Fixes\n\n* Fix all linting and style errors\n\n### Misc.\n\n* Drop support for Python 3.3\n\n## v0.7.1 - Mar 6, 2019\n\n### Fixes\n\n* Error when trying to decode ESSIDs using invalid UTF-8 characters\n  ([#4](https://github.com/SkypLabs/probequest/issues/4))\n* Arguments not working (-e, -r)\n  ([#17](https://github.com/SkypLabs/probequest/issues/17))\n\n## v0.7.0 - Oct 8, 2018\n\n### Features\n\n* Add the `--fake` option to display fake Wi-Fi EDDISs for development purposes\n\n### Fixes\n\n* Add unit tests following [#5](https://github.com/SkypLabs/probequest/issues/5)\n\n## v0.6.2 - Jul 31, 2018\n\n### Fixes\n\n* Test if a packet has a `Dot11ProbeReq` layer before parsing it\n  ([#5](https://github.com/SkypLabs/probequest/issues/5),\n  [#8](https://github.com/SkypLabs/probequest/issues/8))\n\n## v0.6.1 - May 28, 2018\n\n### Features\n\n* Change the short description in `setup.py`\n\n### Documentation\n\n* Update the installation documentation\n\n### Fixes\n\n* Fix a missing dependency\n\n## v0.6.0 - May 27, 2018\n\nThe project has been renamed to ProbeQuest.\n\n### Features\n\n* Refactor the software architecture\n* Add a TUI\n\n### Documentation\n\n* Use Sphinx for the documentation\n\n## v0.5.1 - Feb 18, 2018\n\n### Features\n\n* Improve the debug mode\n\n### Fixes\n\n* The sniffer stops after having received the first frame\n  ([#3](https://github.com/SkypLabs/probequest/issues/3))\n\n## v0.5.0 - Feb 7, 2018\n\n### Features\n\n* Refactor the software architecture\n* Add the `--ignore-case` argument\n* Add a mutual exclusion for the `--exclude` and `--station` arguments\n* Add a debug mode\n* Display the timestamp as a readable time\n* Add unit tests\n\n## v0.4.0 - Sep 19, 2017\n\n### Features\n\n* Display MAC address's OUI if available\n\n## v0.3.0 - Sep 10, 2017\n\n### Features\n\n* Add regex filtering\n\n### Infrastructure\n\n* Deploy automatically the new releases to PyPI using Travis CI\n\n## v0.2.0 - Sep 10, 2017\n\n### Features\n\n* Add station filtering\n* Add ESSID filtering\n* Add exclusion filtering\n\n## v0.1.0 - Sep 10, 2017\n\nFirst pre-release.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to ProbeQuest\n\nProbeQuest is a free and open-source software, which means that you can\ncontribute to its improvement. The following document is a set of guidelines to\nhelp you in this process. Thank you for taking the time to read it!\n\n## Types of Contributions\n\n### Issues\n\nSeveral templates are available when [creating a new issue][new issue]:\n\n* Bug report\n* Feature request\n* Report a security vulnerability\n\nPlease select the appropriate one and follow the instructions. Also, make sure\nto:\n\n* Check for duplicates before creating your issue\n* Choose a descriptive title\n\nIf you want to ask a question, please open a new [discussion][discussions]\ninstead of a new issue.\n\n### Pull Requests\n\nProbeQuest follows the [gitflow][gitflow] branching model, which means that your\npull request needs to target the `develop` branch.\n\nWhen introducing new code to ProbeQuest, please make sure to add the appropriate\ntests and documentation that cover your changes.\n\n## Development Environment\n\nTo set up your development environment, please read the [\"Development\"\nsection][development] of ProbeQuest's documentation.\n\n [development]: https://probequest.readthedocs.io/en/latest/development.html \"Development - ProbeQuest's documentation\"\n [discussions]: https://github.com/SkypLabs/probequest/discussions \"GitHub Discussions\"\n [gitflow]: https://nvie.com/posts/a-successful-git-branching-model/ \"A successful Git branching model\"\n [new issue]: https://github.com/SkypLabs/probequest/issues/new/choose \"Create a new issue\"\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "include README.rst\ninclude LICENSE\n"
  },
  {
    "path": "README.rst",
    "content": "==========\nProbeQuest\n==========\n\n|PyPI Package| |PyPI Downloads| |PyPI Python Versions| |Build Status| |LGTM\nGrade| |LGTM Alerts| |Documentation Status|\n\nToolkit allowing to sniff and display the Wi-Fi probe requests passing nearby\nyour wireless interface.\n\nProbe requests are sent by a station to elicit information about access points,\nin particular to determine if an access point is present or not in the nearby\nenvironment. Some devices (mostly smartphones and tablets) use these requests\nto determine if one of the networks they have previously been connected to is\nin range, leaking personal information.\n\nFurther details are discussed in `this paper\n<https://brambonne.com/docs/bonne14sasquatch.pdf>`__.\n\n.. image:: docs/_static/img/probequest_demo.gif\n   :target: https://asciinema.org/a/205172\n   :alt: ProbeQuest - Demo\n\nInstallation\n============\n\n::\n\n    pip3 install --upgrade probequest\n\nDocumentation\n=============\n\nThe project is documented `here\n<http://probequest.readthedocs.io/en/latest/>`__.\n\nIn the Media\n============\n\nProbeQuest has appeared in the following media:\n\n- `KitPloit\n  <https://www.kitploit.com/2018/06/probequest-toolkit-for-playing-with-wi.html>`__\n- `Hakin9 Magazine, VOL.13, NO. 05, \"Open Source Hacking Tools\"\n  <https://skyplabs.keybase.pub/Papers/Magazines/Hakin9%20Magazine%2C%20VOL.13%2C%20NO.%2005%2C%20%22Open%20Source%20Hacking%20Tools%22.pdf>`__\n- `WonderHowTo\n  <https://null-byte.wonderhowto.com/how-to/track-wi-fi-devices-connect-them-using-probequest-0186137/>`__\n  (including a `YouTube video <https://www.youtube.com/watch?v=Z8RHMUSYTiA>`__)\n- `ShellVoide\n  <https://www.shellvoide.com/wifi/wifi-karma-a-brief-guid-on-probe-response-frames/>`__\n- `Cyber Pi Projects\n  <https://www.cyberpiprojects.com/student-designed-projects>`__ (`Worksheet\n  <https://www.cyberpiprojects.com/s/Probequest-Sniffing-Student.pdf>`__)\n\nLicense\n=======\n\n`GPL version 3 <https://www.gnu.org/licenses/gpl.txt>`__\n\n.. |Build Status| image:: https://github.com/SkypLabs/probequest/actions/workflows/test_and_publish.yml/badge.svg?branch=develop\n   :target: https://github.com/SkypLabs/probequest/actions/workflows/test_and_publish.yml?query=branch%3Adevelop\n   :alt: Build Status Develop Branch\n\n.. |Documentation Status| image:: https://readthedocs.org/projects/probequest/badge/?version=latest\n   :target: https://probequest.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n.. |LGTM Alerts| image:: https://img.shields.io/lgtm/alerts/g/SkypLabs/probequest.svg?logo=lgtm&logoWidth=18\n   :target: https://lgtm.com/projects/g/SkypLabs/probequest/alerts/\n   :alt: LGTM Alerts\n\n.. |LGTM Grade| image:: https://img.shields.io/lgtm/grade/python/g/SkypLabs/probequest.svg?logo=lgtm&logoWidth=18\n   :target: https://lgtm.com/projects/g/SkypLabs/probequest/context:python\n   :alt: LGTM Grade\n\n.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/probequest.svg?style=flat\n   :target: https://pypi.org/project/probequest/\n   :alt: PyPI Package Downloads Per Month\n\n.. |PyPI Package| image:: https://img.shields.io/pypi/v/probequest.svg?style=flat\n   :target: https://pypi.org/project/probequest/\n   :alt: PyPI Package Latest Release\n\n.. |PyPI Python Versions| image:: https://img.shields.io/pypi/pyversions/probequest.svg?logo=python&style=flat\n   :target: https://pypi.org/project/probequest/\n   :alt: PyPI Package Python Versions\n"
  },
  {
    "path": "docs/Makefile",
    "content": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHINXBUILD   = sphinx-build\nSPHINXPROJ    = ProbeQuest\nSOURCEDIR     = .\nBUILDDIR      = _build\n\n# Put it first so that \"make\" without argument is like \"make help\".\nhelp:\n\t@$(SPHINXBUILD) -M help \"$(SOURCEDIR)\" \"$(BUILDDIR)\" $(SPHINXOPTS) $(O)\n\n.PHONY: help Makefile\n\n# Catch-all target: route all unknown targets to Sphinx using the new\n# \"make mode\" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).\n%: Makefile\n\t@$(SPHINXBUILD) -M $@ \"$(SOURCEDIR)\" \"$(BUILDDIR)\" $(SPHINXOPTS) $(O)"
  },
  {
    "path": "docs/_static/.gitkeep",
    "content": ""
  },
  {
    "path": "docs/_templates/.gitkeep",
    "content": ""
  },
  {
    "path": "docs/_templates/layout.html",
    "content": "{% extends \"!layout.html\" %}\n\n{% block extrahead %}\n  {{ super() }}\n\n  {% if READTHEDOCS %}\n  <script defer data-domain=\"{{ plausible_domain }}\" src=\"https://plausible.io/js/script.js\"></script>\n  {% endif %}\n{% endblock extrahead %}\n\n{% block document %}\n  {{ super() }}\n{% endblock document %}\n"
  },
  {
    "path": "docs/conf.py",
    "content": "# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in configuration values, see the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\n# pylint: skip-file\n\nfrom datetime import datetime\n\nfrom probequest import __version__ as VERSION\n\n# -- Project information -----------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information\n\nproject = \"ProbeQuest\"\ncopyright = f\"2017-{datetime.now().year}, Paul-Emmanuel Raoul\"\nauthor = \"Paul-Emmanuel Raoul\"\n\nrelease = VERSION\n\n# -- General configuration ---------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration\n\nextensions = [\n    \"sphinx.ext.autodoc\",\n    \"sphinx.ext.todo\",\n    \"sphinx.ext.viewcode\",\n    \"sphinxarg.ext\",\n    \"sphinxcontrib.seqdiag\",\n]\n\ntemplates_path = [\"_templates\"]\n\nmaster_doc = \"index\"\n\nexclude_patterns = [\"_build\", \"Thumbs.db\", \".DS_Store\"]\n\n# -- Options for HTML output -------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output\n\nhtml_theme = \"sphinx_rtd_theme\"\n\nhtml_static_path = [\"_static\"]\n\nhtml_context = {\n    \"conf_py_path\": \"/docs/\",\n    \"display_github\": True,\n    \"github_user\": \"SkypLabs\",\n    \"github_repo\": \"probequest\",\n    \"github_version\": \"develop\",\n    \"plausible_domain\": \"probequest.skyplabs.net\",\n}\n\n# -- Extension configuration -------------------------------------------------\n\n# -- Options for todo extension ----------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/extensions/todo.html\n\ntodo_include_todos = True\n\n# -- Options for sphinxcontrib-seqdiag extension -----------------------------\n# http://blockdiag.com/en/seqdiag/sphinxcontrib.html\n\nseqdiag_fontpath = \"/usr/share/fonts/truetype/ipafont/ipagp.ttf\"\n"
  },
  {
    "path": "docs/development.rst",
    "content": "===========\nDevelopment\n===========\n\nRunning the unit tests\n----------------------\n\n`tox`_ is used to run the unit tests:\n\n::\n\n    tox\n\n\nReleasing a new version\n-----------------------\n\nBelow are the different steps to follow before releasing a new version:\n\n- Run all tests and be sure they all pass.\n- Update the `version` field in `setup.cfg`.\n- Update the requirements in `setup.cfg` if needed.\n- Update the package's metadata (description, classifiers, etc.) in `setup.cfg`\n  if needed.\n- Update `README.rst` if needed.\n- Update the documentation if needed and make sure it compiles well (`cd ./docs\n  && make html`).\n- Update the copyright year in `docs/conf.py` if needed.\n- Add the corresponding release note to `CHANGELOG.md`.\n\nAfter having pushed the new release:\n\n- Create the corresponding release note on GitHub.\n\n.. _tox: https://tox.readthedocs.io\n"
  },
  {
    "path": "docs/index.rst",
    "content": ".. ProbeQuest documentation master file, created by\n   sphinx-quickstart on Sat May 26 13:03:20 2018.\n   You can adapt this file completely to your liking, but it should at least\n   contain the root `toctree` directive.\n\nWelcome to ProbeQuest's documentation!\n======================================\n\nProbeQuest is a toolkit allowing to sniff and display the Wi-Fi probe requests\npassing nearby your wireless interface.\n\nThis project has been inspired by `this paper`_.\n\n.. image:: _static/img/probequest_demo.gif\n   :target: https://asciinema.org/a/205172\n   :alt: ProbeQuest - Demo\n\n.. toctree::\n    :caption: Table of Contents\n\n    probe_requests\n    installation\n    usage\n    use_case\n    mitigation\n    modules\n    development\n    security\n\n.. _this paper: https://brambonne.com/docs/bonne14sasquatch.pdf\n"
  },
  {
    "path": "docs/installation.rst",
    "content": "============\nInstallation\n============\n\nFrom PyPI (recommended)\n-----------------------\n\n::\n\n    pip3 install --upgrade probequest\n\nFrom sources\n------------\n\nProbeQuest is packaged with `Setuptools`_.\n\nThe default Git branch is `develop`. To install the latest stable version, you\nneed to clone the `main` branch.\n\n::\n\n    git clone -b main https://github.com/SkypLabs/probequest.git\n    cd probequest\n    pip3 install --upgrade .\n\n.. _Setuptools: https://setuptools.pypa.io/\n"
  },
  {
    "path": "docs/make.bat",
    "content": "@ECHO OFF\n\npushd %~dp0\n\nREM Command file for Sphinx documentation\n\nif \"%SPHINXBUILD%\" == \"\" (\n\tset SPHINXBUILD=sphinx-build\n)\nset SOURCEDIR=.\nset BUILDDIR=_build\nset SPHINXPROJ=ProbeQuest\n\nif \"%1\" == \"\" goto help\n\n%SPHINXBUILD% >NUL 2>NUL\nif errorlevel 9009 (\n\techo.\n\techo.The 'sphinx-build' command was not found. Make sure you have Sphinx\n\techo.installed, then set the SPHINXBUILD environment variable to point\n\techo.to the full path of the 'sphinx-build' executable. Alternatively you\n\techo.may add the Sphinx directory to PATH.\n\techo.\n\techo.If you don't have Sphinx installed, grab it from\n\techo.http://sphinx-doc.org/\n\texit /b 1\n)\n\n%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%\ngoto end\n\n:help\n%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%\n\n:end\npopd\n"
  },
  {
    "path": "docs/mitigation.rst",
    "content": "==========\nMitigation\n==========\n\nAs far as I know, there are two mitigation techniques:\n\n- Don’t use probe requests at all. It is by far the most efficient way not to\n  leak any piece of information. As said earlier, it is not necessary to rely on\n  probe requests to get the list of the nearby access points since they\n  broadcast their name by themselves.\n- Randomise the source MAC address of each probe request sent. This way, it’s no\n  longer possible for a third party to link probe requests to a specific device\n  based on the Wi-Fi data collected. However, using a Software-Defined Radio to\n  capture RF metadata such as the frequency offset, it would be possible to\n  fingerprint each Wi-Fi packet and so each Wi-Fi device, regardless of their\n  source MAC address (this technique will be implemented in ProbeQuest).\n\nAndroid\n-------\n\nSome Android-based operating systems, like `GrapheneOS`_, randomise the source\nMAC address natively. Otherwise, you can install `Wi-Fi Privacy Police`_ from\n`F-Droid`_ or the `Play Store`_ to prevent your Android devices from leaking\ntheir PNL.\n\n.. image:: _static/img/wifi_privacy_police_main_screen.png\n\nOnce installed, the **Privacy protection** option should be switched on.\n\niOS\n---\n\nOn iOS, the source MAC address is randomised since iOS 8.\n\n.. _F-Droid: https://f-droid.org/packages/be.uhasselt.privacypolice/\n.. _GrapheneOS: https://grapheneos.org/\n.. _Play Store: https://play.google.com/store/apps/details?id=be.uhasselt.privacypolice\n.. _Wi-Fi Privacy Police: https://github.com/BramBonne/privacypolice\n"
  },
  {
    "path": "docs/modules/cli.rst",
    "content": "CLI\n---\n\n.. automodule:: probequest.cli\n    :members:\n"
  },
  {
    "path": "docs/modules/config.rst",
    "content": "ProbeQuest Configuration\n------------------------\n\n.. automodule:: probequest.config\n    :members:\n"
  },
  {
    "path": "docs/modules/exceptions.rst",
    "content": "Exceptions\n----------\n\n.. automodule:: probequest.exceptions\n    :members:\n"
  },
  {
    "path": "docs/modules/exporters/csv.rst",
    "content": "CSV Exporter\n------------\n\n.. automodule:: probequest.exporters.csv\n    :members:\n\n"
  },
  {
    "path": "docs/modules/probe_request.rst",
    "content": "Probe Request\n-------------\n\n.. automodule:: probequest.probe_request\n    :members:\n"
  },
  {
    "path": "docs/modules/probe_request_filter.rst",
    "content": "Probe Request Filter\n--------------------\n\n.. automodule:: probequest.probe_request_filter\n    :members:\n"
  },
  {
    "path": "docs/modules/probe_request_parser.rst",
    "content": "Probe Request Parser\n--------------------\n\n.. automodule:: probequest.probe_request_parser\n    :members:\n"
  },
  {
    "path": "docs/modules/sniffers/fake_probe_request_sniffer.rst",
    "content": "Fake Probe Request Sniffer\n--------------------------\n\n.. automodule:: probequest.sniffers.fake_probe_request_sniffer\n    :members:\n"
  },
  {
    "path": "docs/modules/sniffers/probe_request_sniffer.rst",
    "content": "Probe Request Sniffer\n---------------------\n\n.. automodule:: probequest.sniffers.probe_request_sniffer\n    :members:\n"
  },
  {
    "path": "docs/modules/ui/console.rst",
    "content": "Console\n-------\n\n.. automodule:: probequest.ui.console\n    :members:\n"
  },
  {
    "path": "docs/modules.rst",
    "content": "=======\nModules\n=======\n\n.. toctree::\n    :maxdepth: 1\n    :glob:\n\n    modules/**\n"
  },
  {
    "path": "docs/probe_requests.rst",
    "content": "==============================\nWhat are Wi-Fi probe requests?\n==============================\n\nProbe requests are sent by a station to elicit information about access points,\nin particular to determine if an access point is present or not in the nearby\nenvironment. Some devices (mostly smartphones and tablets) use these requests to\ndetermine if one of the networks they have previously been connected to is in\nrange, leaking their preferred network list (PNL) and, therefore, your personal\ninformation.\n\nBelow is a typical Wi-Fi authentication process between a mobile station (for\nexample, your smartphone) and an access point (AP):\n\n.. seqdiag::\n\n    seqdiag admin {\n      default_fontsize = 14;\n      edge_length = 260;\n\n\t  autonumber = True;\n\n      \"Mobile Station\" -> \"Access Point\" [label = \"Probe Request\"];\n      \"Mobile Station\" <-- \"Access Point\" [label = \"Probe Response\"];\n      \"Mobile Station\" -> \"Access Point\" [label = \"Authentication Request\"];\n      \"Mobile Station\" <-- \"Access Point\" [label = \"Authentication Response\"];\n      \"Mobile Station\" -> \"Access Point\" [label = \"Association Request\"];\n      \"Mobile Station\" <-- \"Access Point\" [label = \"Association Response\"];\n    }\n\nStep 1 is optional (and therefore, step 2) since the access points announce\ntheir presence by broadcasting their name (ESSID) using `beacon frames`_.\nConsequently, it is not necessary to rely on probe requests to get the list of\nthe access points available. It is a design choice that, although it speeds up\nthe discovery process, causes privacy and security issues.\n\nProbeQuest can be used to leverage this leak of information to conduct diverse\nsocial engineering and network attacks.\n\n.. _beacon frames: https://en.wikipedia.org/wiki/Beacon_frame\n"
  },
  {
    "path": "docs/security.rst",
    "content": "===============\nSecurity Policy\n===============\n\nReporting a Vulnerability\n-------------------------\n\nIf you have found a security issue in ProbeQuest, please disclose it responsibly\nby emailing me at `skyper(at)skyplabs[dot]net`. My PGP public key can be found\non my `Keybase profile`_:\n\n.. image:: https://img.shields.io/keybase/pgp/skyplabs.svg\n   :target: https://keybase.io/skyplabs/pgp_keys.asc\n   :alt: PGP key fingerprint\n\nTo facilitate the encryption process, you can use `this online tool`_. You can\nalso use it to verify my signatures.\n\n.. _Keybase profile: https://keybase.io/skyplabs\n.. _this online tool: https://keybase.io/encrypt#skyplabs\n"
  },
  {
    "path": "docs/usage.rst",
    "content": "=====\nUsage\n=====\n\nEnabling the monitor mode\n-------------------------\n\nTo be able to sniff the probe requests, your Wi-Fi network interface must be set\nto `monitor mode`_.\n\nWith `ip` and `iw`\n^^^^^^^^^^^^^^^^^^\n\n::\n\n    sudo ip link set <wireless interface> down\n    sudo iw <wireless interface> set monitor control\n    sudo ip link set <wireless interface> up\n\nFor example:\n\n::\n\n    sudo ip link set wlan0 down\n    sudo iw wlan0 set monitor control\n    sudo ip link set wlan0 up\n\nWith `ifconfig` and `iwconfig`\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n    sudo ifconfig <wireless interface> down\n    sudo iwconfig <wireless interface> mode monitor\n    sudo ifconfig <wireless interface> up\n\nFor example:\n\n::\n\n    sudo ifconfig wlan0 down\n    sudo iwconfig wlan0 mode monitor\n    sudo ifconfig wlan0 up\n\nWith `airmon-ng` from aircrack-ng\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTo kill all the interfering processes:\n\n::\n\n    sudo airmon-ng check kill\n\nTo enable the monitor mode:\n\n::\n\n    sudo airmon-ng start <wireless interface>\n\nFor example:\n\n::\n\n    sudo airmon-ng start wlan0\n\nCommand line arguments\n----------------------\n\n.. argparse::\n   :module: probequest.cli\n   :func: get_arg_parser\n   :prog: probequest\n\nExample of use\n^^^^^^^^^^^^^^\n\n::\n\n    sudo probequest wlan0\n\nHere is a sample output:\n\n.. image:: _static/img/probequest_output_example.png\n\n.. _monitor mode: https://en.wikipedia.org/wiki/Monitor_mode\n"
  },
  {
    "path": "docs/use_case.rst",
    "content": "========\nUse Case\n========\n\nLet's consider the following simple scenario inspired from a real data\ncollection (the data have been anonymised): a device tries to connect to `John's\niPhone`, `CompanyX_staff`, `STARBUCKS-FREE-WIFI` and `VM21ECAB2`. Based on this\ninformation, several assumptions can be made:\n\n- The device owner's name is John.\n- The device is set in English and its owner speaks this language (otherwise it\n  would have been `iPhone de John` in French, `iPhone von John` in German, etc).\n- The device should be a laptop trying to connect to an iPhone in hotspot mode.\n  The owner has consequently at least two devices and is nomad.\n- The owner works for CompanyX.\n- The owner frequents coffee shops, in particular StarBucks.\n- The owner is used to connecting to open Wi-Fi access points.\n- `VM21ECAB2` seems to be a home access point and is the only one in the\n  device's PNL. It is likely the owner's place and, consequently, the device's\n  owner is a customer of Virgin Media.\n\nAs you can see, the amount of data inferred from these four probe requests is\nalready impressive, but we can go further. Relying on a database of Wi-Fi access\npoints’ location, such as `WIGLE.net`_, it becomes possible to determine the\nplaces the device’s owner has previously been to. VM21ECAB2 should be a unique\nname, easily localisable on a map. Same for CompanyX_staff. If this last one is\nnot unique (because CompanyX has several offices), crossing the data we have can\nhelp us in our investigation. For example, if CompanyX is present in several\ncountries, we can assume that the device’s owner lives in a country where both\nCompanyX and Virgin Media are present. Once we have determined which office it\nis, we can suppose that the device’s owner is used to stopping in StarBucks\nlocated on their way from home to their office.\n\nProfiling a person is the first step to conduct a social engineering attack. The\nmore we know about our target, the better chance the attack has to succeed.\nAlso, because we know which Wi-Fi access points our target’s devices will try to\nconnect to, an evil twin attack is conceivable.\n\n.. _WIGLE.net: https://wigle.net/\n"
  },
  {
    "path": "pyproject.toml",
    "content": "[build-system]\nrequires = [\n    \"setuptools >= 61\",\n    \"wheel\",\n]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"probequest\"\nauthors = [\n  {name = \"Paul-Emmanuel Raoul\", email = \"skyper@skyplabs.net\"},\n]\ndescription = \"Toolkit for Playing with Wi-Fi Probe Requests.\"\nreadme = \"README.rst\"\nlicense = \"GPL-3.0-only\"\nlicense-files = [\"LICENSE\"]\nkeywords = [\"wifi\", \"wireless\", \"security\", \"sniffer\"]\nclassifiers = [\n  \"Development Status :: 4 - Beta\",\n  \"Environment :: Console\",\n  \"Intended Audience :: Information Technology\",\n  \"Natural Language :: English\",\n  \"Topic :: Security\",\n  \"Topic :: System :: Networking\",\n  \"Topic :: System :: Networking :: Monitoring\",\n  \"Programming Language :: Python :: 3 :: Only\",\n  \"Programming Language :: Python :: 3.9\",\n  \"Programming Language :: Python :: 3.10\",\n  \"Programming Language :: Python :: 3.11\",\n  \"Programming Language :: Python :: 3.12\",\n  \"Programming Language :: Python :: 3.13\",\n]\nrequires-python = \">=3.9, <4\"\ndependencies = [\n  \"netaddr >= 0.7.19\",\n  \"scapy >= 2.4.3\",\n]\ndynamic = [\"version\"]\n\n[project.urls]\n\"Bug Tracker\" = \"https://github.com/SkypLabs/probequest/issues\"\nDocumentatioon = \"https://probequest.skyplabs.net\"\n\"Source Code\"= \"https://github.com/SkypLabs/probequest\"\n\n[project.optional-dependencies]\ncomplete = [\"faker_wifi_essid\"]\ndocs = [\n  \"Sphinx >= 3.2\",\n  \"sphinxcontrib-seqdiag >= 2.0.0\",\n  \"sphinx-argparse >= 0.2.2\",\n  \"sphinx_rtd_theme >= 0.5.0\",\n]\ntests = [\"flake8\", \"pylint\", \"tox\"]\n\n[project.scripts]\nprobequest = \"probequest.cli:main\"\n\n[tool.setuptools.dynamic]\nversion = {attr = \"probequest.__version__\"}\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\n[tool.pylint.main]\nload-plugins = \"pylint.extensions.no_self_use\"\n\n[tool.pylint.\"messages control\"]\ndisable = \"duplicate-code\"\n"
  },
  {
    "path": "requirements.txt",
    "content": ".\n"
  },
  {
    "path": "src/probequest/__init__.py",
    "content": "\"\"\"\nProbeQuest package.\n\"\"\"\n\nimport logging\n\n__version__ = \"0.8.0\"\n\n\ndef set_up_package_logger():\n    \"\"\"\n    Sets up the package logger.\n    \"\"\"\n\n    logger = logging.getLogger(__name__)\n    logger.setLevel(logging.DEBUG)\n    logger.addHandler(logging.NullHandler())\n\n\nset_up_package_logger()\n"
  },
  {
    "path": "src/probequest/__main__.py",
    "content": "\"\"\"\nExecutes the command-line tool when run as a script or with 'python -m'.\n\"\"\"\n\nfrom .cli import main\n\nmain()\n"
  },
  {
    "path": "src/probequest/cli.py",
    "content": "\"\"\"\nCLI module.\n\"\"\"\n\nimport logging\nfrom argparse import ArgumentParser, FileType\nfrom logging.handlers import MemoryHandler\nfrom os import geteuid\nfrom sys import exit as sys_exit\nfrom time import sleep\n\nfrom scapy.pipetool import PipeEngine\n\nfrom . import __version__ as VERSION\nfrom .config import Config\nfrom .exceptions import (DependencyNotPresentException,\n                         InterfaceDoesNotExistException)\nfrom .exporters.csv import ProbeRequestCSVExporter\nfrom .probe_request_filter import ProbeRequestFilter\nfrom .probe_request_parser import ProbeRequestParser\nfrom .sniffers.probe_request_sniffer import ProbeRequestSniffer\nfrom .ui.console import ProbeRequestConsole\n\n# Used to specify the capacity of the memory handler which will store the logs\n# in memory until the argument parser is called to know whether they need to be\n# flushed to the console (see \"--debug\" option) or not.\nMEMORY_LOGGER_CAPACITY = 50\n\n\ndef get_arg_parser():\n    \"\"\"\n    Returns the argument parser.\n    \"\"\"\n\n    arg_parser = ArgumentParser(\n        description=\"Toolkit for Playing with Wi-Fi Probe Requests\",\n    )\n    arg_parser.add_argument(\n        \"interface\",\n        help=\"wireless interface to use (must be in monitor mode)\",\n    )\n    arg_parser.add_argument(\n        \"--debug\", action=\"store_true\",\n        dest=\"debug\",\n        help=\"debug mode\",\n    )\n    arg_parser.add_argument(\n        \"--fake\", action=\"store_true\",\n        dest=\"fake\",\n        help=\"display only fake ESSIDs\",\n    )\n    arg_parser.add_argument(\n        \"--ignore-case\", action=\"store_true\",\n        dest=\"ignore_case\",\n        help=\"ignore case distinctions in the regex pattern (default: false)\",\n    )\n    arg_parser.add_argument(\n        \"-o\", \"--output\",\n        type=FileType(\"a\"),\n        dest=\"output_file\",\n        help=\"output file to save the captured data (CSV format)\",\n    )\n    arg_parser.add_argument(\"--version\", action=\"version\", version=VERSION)\n    arg_parser.set_defaults(debug=False)\n    arg_parser.set_defaults(fake=False)\n    arg_parser.set_defaults(ignore_case=False)\n\n    essid_arguments = arg_parser.add_mutually_exclusive_group()\n    essid_arguments.add_argument(\n        \"-e\", \"--essid\",\n        nargs=\"+\",\n        metavar=\"ESSID\",\n        dest=\"essid_filters\",\n        help=\"ESSID of the APs to filter (space-separated list)\",\n    )\n    essid_arguments.add_argument(\n        \"-r\", \"--regex\",\n        metavar=\"REGEX\",\n        dest=\"essid_regex\",\n        help=\"regex to filter the ESSIDs\",\n    )\n\n    station_arguments = arg_parser.add_mutually_exclusive_group()\n    station_arguments.add_argument(\n        \"--exclude\",\n        nargs=\"+\",\n        metavar=\"STATION\",\n        dest=\"mac_exclusions\",\n        help=\"MAC addresses of the stations to exclude (space-separated list)\",\n    )\n    station_arguments.add_argument(\n        \"-s\", \"--station\",\n        nargs=\"+\",\n        metavar=\"STATION\",\n        dest=\"mac_filters\",\n        help=\"MAC addresses of the stations to filter (space-separated list)\",\n    )\n\n    return arg_parser\n\n\ndef set_up_root_logger(level=logging.DEBUG):\n    \"\"\"\n    Sets up the root logger.\n\n    Returns a tuple containing the root logger, the memory handler and the\n    console handler.\n    \"\"\"\n\n    root_logger = logging.getLogger(\"\")\n    root_logger.setLevel(level)\n\n    console = logging.StreamHandler()\n\n    console_formatter = \\\n        logging.Formatter(\"%(name)-12s: %(levelname)-8s %(message)s\")\n    console.setFormatter(console_formatter)\n\n    memory_handler = MemoryHandler(MEMORY_LOGGER_CAPACITY)\n    root_logger.addHandler(memory_handler)\n\n    return (root_logger, memory_handler, console)\n\n\ndef build_cluster(config):\n    \"\"\"\n    Build the ProbeQuest cluster.\n    \"\"\"\n\n    # pylint: disable=import-outside-toplevel\n    # pylint: disable=pointless-statement\n\n    try:\n        if config.fake:\n            from .sniffers.fake_probe_request_sniffer \\\n                import FakeProbeRequestSniffer\n            sniffer = FakeProbeRequestSniffer(1)\n        else:\n            sniffer = ProbeRequestSniffer(config)\n    except ModuleNotFoundError as err:\n        raise DependencyNotPresentException(err) from err\n\n    parser = ProbeRequestParser(config)\n    filters = ProbeRequestFilter(config)\n    console = ProbeRequestConsole()\n\n    engine = PipeEngine(sniffer)\n\n    sniffer > parser > filters > console\n\n    if config.output_file:\n        csv_exporter = ProbeRequestCSVExporter(config)\n        filters > csv_exporter\n\n    return engine\n\n\ndef check_permissions() -> bool:\n    \"\"\"\n    Check the user permissions to ensure the network trafic can be captured.\n\n    For now, this function only checks if the current user is root.\n    \"\"\"\n\n    if geteuid() == 0:\n        return True\n\n    return False\n\n\ndef main():\n    \"\"\"\n    Entry point of the command-line tool.\n    \"\"\"\n\n    # pylint: disable=too-many-statements\n\n    root_logger, memory_handler, console = set_up_root_logger()\n\n    logger = logging.getLogger(__name__)\n\n    logger.info(\"Program started\")\n\n    # -------------------------------------------------- #\n    # CLI configuration\n    # -------------------------------------------------- #\n    logger.debug(\"Creating configuration object\")\n    config = Config()\n\n    # -------------------------------------------------- #\n    # Parsing arguments\n    # -------------------------------------------------- #\n    logger.debug(\"Parsing arguments\")\n\n    try:\n        get_arg_parser().parse_args(namespace=config)\n    except InterfaceDoesNotExistException as err:\n        logger.critical(err, exc_info=True)\n        sys_exit(f\"[!] {err}\")\n\n    # -------------------------------------------------- #\n    # Debug mode\n    # -------------------------------------------------- #\n    # If the \"--debug\" option is present, flush the log buffer to the console,\n    # remove the memory handler from the root logger and add the console\n    # handler directly to the root logger.\n    if config.debug:\n        logger.debug(\"Setting the console as target of the memory handler\")\n        memory_handler.setTarget(console)\n\n        logger.debug(\"Removing the memory handler from the root logger\")\n        # The buffer is flushed to the console at close time.\n        memory_handler.close()\n        root_logger.removeHandler(memory_handler)\n\n        root_logger.addHandler(console)\n        logger.debug(\"Console handler added to the root logger\")\n    # If the \"--debug\" option is absent (default), close the memory handler\n    # without flushing anything to the console.\n    else:\n        memory_handler.flushOnClose = False\n        memory_handler.close()\n        logger.debug(\"Memory handler closed\")\n\n    # -------------------------------------------------- #\n    # Check permissions\n    # -------------------------------------------------- #\n    if not config.fake and not check_permissions():\n        logger.critical(\"User needs to be root to sniff the traffic\")\n        sys_exit(\"[!] You must be root\")\n\n    # -------------------------------------------------- #\n    # Sniffing loop\n    # -------------------------------------------------- #\n    try:\n        logger.info(\"Creating Pipe engine\")\n        engine = build_cluster(config)\n\n        logger.info(\"Starting Pipe engine\")\n        print(\"[*] Start sniffing probe requests...\")\n        engine.start()\n        while True:\n            sleep(100)\n    except DependencyNotPresentException as err:\n        err_msg = f\"An optional dependency is missing: {err}\"\n        logger.critical(err_msg, exc_info=True)\n        sys_exit(\"[x] \" + err_msg)\n    except KeyboardInterrupt:\n        logger.info(\"Keyboard interrupt received\")\n        print(\"[*] Bye!\")\n    finally:\n        if \"engine\" in locals():\n            logger.debug(\"Stopping the Pipe engine\")\n            engine.stop()\n\n        if config.output_file is not None:\n            logger.debug(\"Closing output file\")\n            config.output_file.close()\n\n        logger.info(\"Program ended\")\n"
  },
  {
    "path": "src/probequest/config.py",
    "content": "\"\"\"\nProbeQuest configuration.\n\"\"\"\n\nimport logging\nfrom re import compile as rcompile, IGNORECASE\n\nfrom scapy.arch import get_if_list\n\nfrom .exceptions import InterfaceDoesNotExistException\n\n\nclass Config:\n    \"\"\"\n    Configuration object.\n    \"\"\"\n\n    # pylint: disable=too-many-instance-attributes\n\n    _interface = None\n\n    essid_filters = None\n    essid_regex = None\n    ignore_case = False\n\n    mac_exclusions = None\n    mac_filters = None\n\n    output_file = None\n\n    fake = False\n    debug = False\n\n    _compiled_essid_regex = None\n    _frame_filter = None\n\n    def __init__(self):\n        self.logger = logging.getLogger(__name__)\n\n    @property\n    def interface(self):\n        \"\"\"\n        Interface from which the probe requests will be captured.\n        \"\"\"\n\n        return self._interface\n\n    @interface.setter\n    def interface(self, interface):\n        # If interface does not exist.\n        if interface not in get_if_list():\n            raise InterfaceDoesNotExistException(\n                f\"Interface {interface} does not exist\"\n            )\n\n        self._interface = interface\n\n    @property\n    def frame_filter(self):\n        \"\"\"\n        Generates and returns the frame filter according to the different\n        options set of the current 'Config' object.\n\n        The value is cached once computed.\n        \"\"\"\n\n        if self._frame_filter is None:\n            self._frame_filter = \"type mgt subtype probe-req\"\n\n            if self.mac_exclusions is not None:\n                self._frame_filter += \" and not (\"\n\n                for i, station in enumerate(self.mac_exclusions):\n                    if i == 0:\n                        self._frame_filter += \\\n                            f\"ether src host {station}\"\n                    else:\n                        self._frame_filter += \\\n                            f\"|| ether src host {station}\"\n\n                self._frame_filter += \")\"\n\n            if self.mac_filters is not None:\n                self._frame_filter += \" and (\"\n\n                for i, station in enumerate(self.mac_filters):\n                    if i == 0:\n                        self._frame_filter += \\\n                            f\"ether src host {station}\"\n                    else:\n                        self._frame_filter += \\\n                            f\"|| ether src host {station}\"\n\n                self._frame_filter += \")\"\n\n            self.logger.debug(\"Frame filter: \\\"%s\\\"\", self._frame_filter)\n\n        return self._frame_filter\n\n    @property\n    def compiled_essid_regex(self):\n        \"\"\"\n        Returns the compiled version of the ESSID regex.\n\n        The value is cached once computed.\n        \"\"\"\n\n        # If there is a regex in the configuration and it hasn't been compiled\n        # yet.\n        if self._compiled_essid_regex is None and self.essid_regex is not None:\n            self.logger.debug(\"Compiling ESSID regex\")\n\n            if self.ignore_case:\n                self.logger.debug(\"Ignoring case in ESSID regex\")\n\n                self._compiled_essid_regex = rcompile(\n                    self.essid_regex,\n                    IGNORECASE\n                )\n            else:\n                self._compiled_essid_regex = rcompile(self.essid_regex)\n\n        return self._compiled_essid_regex\n"
  },
  {
    "path": "src/probequest/exceptions.py",
    "content": "\"\"\"\nProbeQuest exceptions module.\n\"\"\"\n\n\nclass ProbeQuestException(Exception):\n    \"\"\"\n    Base class for all exceptions thrown by the probequest module.\n    \"\"\"\n\n\nclass InterfaceDoesNotExistException(ProbeQuestException):\n    \"\"\"\n    Thrown when the network interface does not exist.\n    \"\"\"\n\n\nclass DependencyNotPresentException(ProbeQuestException):\n    \"\"\"\n    Thrown when an optional dependency is not present on the system.\n    \"\"\"\n"
  },
  {
    "path": "src/probequest/exporters/__init__.py",
    "content": ""
  },
  {
    "path": "src/probequest/exporters/csv.py",
    "content": "\"\"\"\nProbe request CSV exporter module.\n\"\"\"\n\nimport logging\nfrom csv import writer\n\nfrom scapy.pipetool import Sink\n\n\nclass ProbeRequestCSVExporter(Sink):\n    \"\"\"\n    A probe request CSV exporter.\n    \"\"\"\n\n    def __init__(self, config, name=None):\n        self.logger = logging.getLogger(__name__)\n\n        Sink.__init__(self, name=name)\n\n        self.csv_file = config.output_file\n        self.csv_writer = None\n\n        if self.csv_file is not None:\n            self.csv_writer = writer(self.csv_file, delimiter=\";\")\n\n        self.logger.info(\"CSV exporter initialised\")\n\n    def push(self, msg):\n        if self.csv_writer is not None:\n            self.csv_writer.writerow([\n                msg.timestamp,\n                msg.s_mac,\n                msg.s_mac_oui,\n                msg.essid\n            ])\n"
  },
  {
    "path": "src/probequest/probe_request.py",
    "content": "\"\"\"\nA Wi-Fi probe request.\n\"\"\"\n\nfrom time import localtime, strftime\nfrom netaddr import EUI, NotRegisteredError\n\n\nclass ProbeRequest:\n    \"\"\"\n    Probe request class.\n    \"\"\"\n\n    def __init__(self, timestamp, s_mac, essid):\n        self.timestamp = timestamp\n        self.s_mac = str(s_mac)\n        self.essid = str(essid)\n\n        self._s_mac_oui = None\n\n    def __str__(self):\n        timestamp = strftime(\n                \"%a, %d %b %Y %H:%M:%S %Z\",\n                localtime(self.timestamp)\n                )\n        s_mac = self.s_mac\n        s_mac_oui = self.s_mac_oui\n        essid = self.essid\n\n        return f\"{timestamp} - {s_mac} ({s_mac_oui}) -> {essid}\"\n\n    @property\n    def s_mac_oui(self):\n        \"\"\"\n        OUI of the station's MAC address as a string.\n\n        The value is cached once computed.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        if self._s_mac_oui is None:\n            try:\n                self._s_mac_oui = EUI(self.s_mac).oui.registration().org\n            except NotRegisteredError:\n                self._s_mac_oui = \"Unknown OUI\"\n\n        return self._s_mac_oui\n"
  },
  {
    "path": "src/probequest/probe_request_filter.py",
    "content": "\"\"\"\nProbe request filter module.\n\"\"\"\n\nimport logging\nfrom re import match\n\nfrom scapy.pipetool import Drain\n\n\nclass ProbeRequestFilter(Drain):\n    \"\"\"\n    A Wi-Fi probe request filtering drain.\n    \"\"\"\n\n    def __init__(self, config, name=None):\n        self.logger = logging.getLogger(__name__)\n\n        Drain.__init__(self, name=name)\n\n        self._config = config\n        self._cregex = self._config.compiled_essid_regex\n\n        self.logger.info(\"Probe request filter initialised\")\n\n    def push(self, msg):\n        if self.can_pass(msg):\n            self._send(msg)\n\n    def high_push(self, msg):\n        if self.can_pass(msg):\n            self._send(msg)\n\n    def can_pass(self, probe_req):\n        \"\"\"\n        Whether or not the probe request given as parameter can pass the drain\n        according to a set of filters.\n        \"\"\"\n\n        # If the probe request doesn't have an ESSID.\n        if not probe_req.essid:\n            return False\n\n        # If the probe request's ESSID is not one of those in the filtering\n        # list.\n        if (self._config.essid_filters is not None and\n                probe_req.essid not in self._config.essid_filters):\n            return False\n\n        # If the probe request's ESSID doesn't match the regex.\n        if (self._cregex is not None and\n                not match(self._cregex, probe_req.essid)):\n            return False\n\n        return True\n"
  },
  {
    "path": "src/probequest/probe_request_parser.py",
    "content": "\"\"\"\nProbe request parser module.\n\"\"\"\n\nimport logging\n\nfrom scapy.pipetool import Drain\nfrom scapy.layers.dot11 import RadioTap, Dot11ProbeReq\n\nfrom probequest.probe_request import ProbeRequest\n\n\nclass ProbeRequestParser(Drain):\n    \"\"\"\n    A Wi-Fi probe request parsing drain.\n    \"\"\"\n\n    def __init__(self, config, name=None):\n        self.logger = logging.getLogger(__name__)\n\n        Drain.__init__(self, name=name)\n\n        self.config = config\n\n        self.logger.info(\"Probe request parser initialised\")\n\n    def push(self, msg):\n        try:\n            self._send(self.parse(msg))\n        except TypeError:\n            pass\n\n    def high_push(self, msg):\n        try:\n            self._high_send(self.parse(msg))\n        except TypeError:\n            pass\n\n    @staticmethod\n    def parse(packet):\n        \"\"\"\n        Parses the raw packet and returns a probe request object.\n        \"\"\"\n\n        try:\n            if packet.haslayer(Dot11ProbeReq):\n                timestamp = packet.getlayer(RadioTap).time\n                s_mac = packet.getlayer(RadioTap).addr2\n                essid = packet.getlayer(Dot11ProbeReq).info.decode(\"utf-8\")\n\n                return ProbeRequest(timestamp, s_mac, essid)\n\n            # The packet is not a probe request.\n            raise TypeError\n        except UnicodeDecodeError as unicode_decode_err:\n            # The ESSID is not a valid UTF-8 string.\n            raise TypeError from unicode_decode_err\n"
  },
  {
    "path": "src/probequest/sniffers/__init__.py",
    "content": ""
  },
  {
    "path": "src/probequest/sniffers/fake_probe_request_sniffer.py",
    "content": "\"\"\"\nFake probe request sniffer module.\n\"\"\"\n\nimport logging\nfrom time import sleep\n\nfrom scapy.layers.dot11 import RadioTap, Dot11, Dot11ProbeReq, Dot11Elt\nfrom scapy.pipetool import ThreadGenSource\n\nfrom faker import Faker  # pylint: disable=import-error\nfrom faker_wifi_essid import WifiESSID  # pylint: disable=import-error\n\n\nclass FakeProbeRequestSniffer(ThreadGenSource):\n    \"\"\"\n    A fake probe request sniffer.\n\n    This pipe source sends periodically fake Wi-Fi ESSIDs for development and\n    test purposes.\n\n    This class inherits from 'ThreadGenSource' and not from 'PeriodicSource' as\n    this last one only accepts lists, sets and tuples.\n    \"\"\"\n\n    # pylint: disable=too-many-ancestors\n\n    def __init__(self, period, period2=0, name=None):\n        self.logger = logging.getLogger(__name__)\n\n        ThreadGenSource.__init__(self, name=name)\n\n        self.fake_probe_requests = FakeProbeRequest()\n        self.period = period\n        self.period2 = period2\n\n        self.logger.info(\"Fake probe request sniffer initialised\")\n\n    def generate(self):\n        # Fix a false positive about not finding '_wake_up'.\n        # pylint: disable=no-member\n\n        while self.RUN:\n            # Infinite loop until 'stop()' is called.\n            for fake_probe_req in self.fake_probe_requests:\n                self._gen_data(fake_probe_req)\n                sleep(self.period)\n\n            self.is_exhausted = True\n            self._wake_up()\n\n            sleep(self.period2)\n\n    def stop(self):\n        ThreadGenSource.stop(self)\n        self.fake_probe_requests.stop()\n\n\nclass FakeProbeRequest:\n    \"\"\"\n    A fake probe request iterator.\n    \"\"\"\n\n    def __init__(self):\n        self._fake = Faker()\n        self._fake.add_provider(WifiESSID)\n\n        self._should_stop = False\n\n    def __iter__(self):\n        return self\n\n    def __next__(self):\n        \"\"\"\n        Generator of fake Wi-Fi probe requests.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        if self._should_stop:\n            raise StopIteration\n\n        return RadioTap() \\\n            / Dot11(\n                addr1=\"ff:ff:ff:ff:ff:ff\",\n                addr2=self._fake.mac_address(),\n                addr3=self._fake.mac_address()\n            ) \\\n            / Dot11ProbeReq() \\\n            / Dot11Elt(\n                info=self._fake.wifi_essid()\n            )\n\n    def stop(self):\n        \"\"\"\n        Interrupts the iteration.\n\n        The next time the iterator will be called, a 'StopIteration' exception\n        will be raised.\n        \"\"\"\n\n        self._should_stop = True\n"
  },
  {
    "path": "src/probequest/sniffers/probe_request_sniffer.py",
    "content": "\"\"\"\nProbe request sniffer module.\n\"\"\"\n\nimport logging\n\nfrom scapy.scapypipes import SniffSource\n\n\nclass ProbeRequestSniffer(SniffSource):\n    \"\"\"\n    Probe request sniffer.\n\n    Wrapper around the 'SniffSource' Scapy pipe module.\n    \"\"\"\n\n    def __init__(self, config):\n        self.logger = logging.getLogger(__name__)\n\n        self.config = config\n\n        frame_filter = self.config.frame_filter\n\n        SniffSource.__init__(\n            self,\n            iface=self.config.interface,\n            filter=frame_filter\n        )\n\n        self.logger.info(\"Probe request sniffer initialised\")\n"
  },
  {
    "path": "src/probequest/ui/__init__.py",
    "content": ""
  },
  {
    "path": "src/probequest/ui/console.py",
    "content": "\"\"\"\nProbe request console module.\n\"\"\"\n\nimport logging\n\nfrom scapy.pipetool import Sink\n\n\nclass ProbeRequestConsole(Sink):\n    \"\"\"\n    Probe request displaying sink.\n    \"\"\"\n\n    def __init__(self):\n        self.logger = logging.getLogger(__name__)\n\n        Sink.__init__(self)\n\n        self.logger.info(\"Console initialised\")\n\n    def push(self, msg):\n        print(msg)\n\n    def high_push(self, msg):\n        print(msg)\n"
  },
  {
    "path": "tests/__init__.py",
    "content": ""
  },
  {
    "path": "tests/unit/__init__.py",
    "content": ""
  },
  {
    "path": "tests/unit/test_cli.py",
    "content": "\"\"\"\nUnit tests for the cli module.\n\"\"\"\n\nimport unittest\n\nfrom argparse import Namespace\nfrom contextlib import redirect_stdout, redirect_stderr\nfrom io import StringIO, TextIOWrapper\nfrom os import remove\nfrom os.path import isfile\n\nfrom probequest import __version__ as VERSION\nfrom probequest.cli import get_arg_parser\n\n\nclass TestArgParse(unittest.TestCase):\n    \"\"\"\n    Tests the argument parser.\n    \"\"\"\n\n    # pylint: disable=too-many-public-methods\n\n    output_test_file = \"probequest_test_output.txt\"\n\n    def setUp(self):\n        \"\"\"\n        Instanciates a new argument parser.\n        \"\"\"\n\n        self.arg_parser = get_arg_parser()\n\n    def tearDown(self):\n        \"\"\"\n        Removes test files if any.\n        \"\"\"\n\n        if isfile(self.output_test_file):\n            remove(self.output_test_file)\n\n    def test_without_parameters(self):\n        \"\"\"\n        Calls the argument parser with an emtpy input.\n        \"\"\"\n\n        with self.assertRaises(SystemExit) as error_code:\n            error_output = StringIO()\n\n            with redirect_stderr(error_output):\n                self.arg_parser.parse_args([])\n\n        self.assertEqual(error_code.exception.code, 2)\n\n    def test_short_help_option(self):\n        \"\"\"\n        Calls the argument parser with the '-h' option.\n        \"\"\"\n\n        with self.assertRaises(SystemExit) as error_code:\n            output = StringIO()\n\n            with redirect_stdout(output):\n                self.arg_parser.parse_args([\"-h\"])\n\n        self.assertEqual(error_code.exception.code, 0)\n\n    def test_long_help_option(self):\n        \"\"\"\n        Calls the argument parser with the '--help' option.\n        \"\"\"\n\n        with self.assertRaises(SystemExit) as error_code:\n            output = StringIO()\n\n            with redirect_stdout(output):\n                self.arg_parser.parse_args([\"--help\"])\n\n        self.assertEqual(error_code.exception.code, 0)\n\n    def test_version_option(self):\n        \"\"\"\n        Calls the argument parser with the '--version' option.\n        \"\"\"\n\n        with self.assertRaises(SystemExit) as error_code:\n            output = StringIO()\n\n            with redirect_stdout(output):\n                self.arg_parser.parse_args([\"--version\"])\n\n        self.assertEqual(error_code.exception.code, 0)\n        self.assertEqual(output.getvalue(), VERSION + \"\\n\")\n\n    def test_default_values(self):\n        \"\"\"\n        Calls the argument parser with an empty input and tests the default\n        values in the configuration namespace.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        with self.assertRaises(SystemExit) as error_code:\n            error_output = StringIO()\n\n            with redirect_stderr(error_output):\n                config = Namespace()\n                self.arg_parser.parse_args(\n                    [], namespace=config\n                )\n\n        self.assertEqual(error_code.exception.code, 2)\n\n        self.assertIsNone(config.interface)\n        self.assertIsNone(config.essid_filters)\n        self.assertIsNone(config.essid_regex)\n        self.assertFalse(config.ignore_case)\n        self.assertIsNone(config.mac_exclusions)\n        self.assertIsNone(config.mac_filters)\n        self.assertIsNone(config.output_file)\n        self.assertFalse(config.fake)\n        self.assertFalse(config.debug)\n\n    def test_interface_argument(self):\n        \"\"\"\n        Calls the argument parser with the 'interface' argument.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"wlan0\",\n        ], namespace=config)\n\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_without_interface_argument(self):\n        \"\"\"\n        Calls the argument parser with some options but not the required\n        interface argument.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        with self.assertRaises(SystemExit) as error_code:\n            error_output = StringIO()\n\n            with redirect_stderr(error_output):\n                config = Namespace()\n                self.arg_parser.parse_args([\n                    \"--debug\", \"--fake\",\n                ], namespace=config)\n\n        self.assertEqual(error_code.exception.code, 2)\n\n    def test_debug_option(self):\n        \"\"\"\n        Calls the argument parser with the '--debug' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--debug\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertTrue(config.debug)\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_fake_option(self):\n        \"\"\"\n        Calls the argument parser with the '--fake' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--fake\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertTrue(config.fake)\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_ignore_case_option(self):\n        \"\"\"\n        Calls the argument parser with the '--ignore-case' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--ignore-case\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertTrue(config.ignore_case)\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_short_output_option(self):\n        \"\"\"\n        Calls the argument parser with the '-o' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"-o\", self.output_test_file, \"wlan0\",\n        ], namespace=config)\n\n        self.assertIsInstance(config.output_file, TextIOWrapper)\n        config.output_file.close()\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_long_output_option(self):\n        \"\"\"\n        Calls the argument parser with the '--output' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--output\", self.output_test_file, \"wlan0\",\n        ], namespace=config)\n\n        self.assertIsInstance(config.output_file, TextIOWrapper)\n        config.output_file.close()\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_short_essid_option(self):\n        \"\"\"\n        Calls the argument parser with the '-e' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"-e\", \"essid_1\", \"essid_2\", \"essid_3\", \"--\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertListEqual(config.essid_filters, [\n            \"essid_1\", \"essid_2\", \"essid_3\"\n        ])\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_long_essid_option(self):\n        \"\"\"\n        Calls the argument parser with the '--essid' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--essid\", \"essid_1\", \"essid_2\", \"essid_3\", \"--\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertListEqual(config.essid_filters, [\n            \"essid_1\", \"essid_2\", \"essid_3\"\n        ])\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_short_regex_option(self):\n        \"\"\"\n        Calls the argument parser with the '-r' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"-r\", \"test_regex\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertEqual(config.essid_regex, \"test_regex\")\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_long_regex_option(self):\n        \"\"\"\n        Calls the argument parser with the '--regex' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--regex\", \"test_regex\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertEqual(config.essid_regex, \"test_regex\")\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_essid_regex_mutual_exclusivity(self):\n        \"\"\"\n        Calls the argument parser with both '--essid' and '--regex' options,\n        which must fail as they are in the same mutually exclusive group.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        with self.assertRaises(SystemExit) as error_code:\n            error_output = StringIO()\n\n            with redirect_stderr(error_output):\n                config = Namespace()\n                self.arg_parser.parse_args([\n                    \"--essid\", \"essid_1\",\n                    \"--regex\", \"test_regex\",\n                    \"wlan0\",\n                ], namespace=config)\n\n        self.assertEqual(error_code.exception.code, 2)\n\n    def test_exclude_option(self):\n        \"\"\"\n        Calls the argument parser with the '--exclude' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--exclude\", \"aa:bb:cc:dd:ee:ff\", \"ff:ee:dd:cc:bb:aa\",\n            \"--\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertListEqual(config.mac_exclusions, [\n            \"aa:bb:cc:dd:ee:ff\",\n            \"ff:ee:dd:cc:bb:aa\",\n        ])\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_short_station_option(self):\n        \"\"\"\n        Calls the argument parser with the '-s' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"-s\", \"aa:bb:cc:dd:ee:ff\", \"ff:ee:dd:cc:bb:aa\",\n            \"--\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertListEqual(config.mac_filters, [\n            \"aa:bb:cc:dd:ee:ff\",\n            \"ff:ee:dd:cc:bb:aa\",\n        ])\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_long_station_option(self):\n        \"\"\"\n        Calls the argument parser with the '--station' option.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        config = Namespace()\n        self.arg_parser.parse_args([\n            \"--station\", \"aa:bb:cc:dd:ee:ff\", \"ff:ee:dd:cc:bb:aa\",\n            \"--\", \"wlan0\",\n        ], namespace=config)\n\n        self.assertListEqual(config.mac_filters, [\n            \"aa:bb:cc:dd:ee:ff\",\n            \"ff:ee:dd:cc:bb:aa\",\n        ])\n        self.assertEqual(config.interface, \"wlan0\")\n\n    def test_exclude_station_mutual_exclusivity(self):\n        \"\"\"\n        Calls the argument parser with both '--exclude' and '--station'\n        options, which must fail as they are in the same mutually exclusive\n        group.\n        \"\"\"\n\n        # pylint: disable=no-member\n\n        with self.assertRaises(SystemExit) as error_code:\n            error_output = StringIO()\n\n            with redirect_stderr(error_output):\n                config = Namespace()\n                self.arg_parser.parse_args([\n                    \"--exclude\", \"aa:bb:cc:dd:ee:ff\",\n                    \"--station\", \"ff:ee:dd:cc:bb:aa\",\n                    \"wlan0\",\n                ], namespace=config)\n\n        self.assertEqual(error_code.exception.code, 2)\n"
  },
  {
    "path": "tests/unit/test_config.py",
    "content": "\"\"\"\nUnit tests for the configuration module.\n\"\"\"\n\nimport logging\nimport unittest\nfrom unittest.mock import patch\nfrom re import compile as rcompile, IGNORECASE\n\nfrom probequest.config import Config\nfrom probequest.exceptions import InterfaceDoesNotExistException\n\n\nclass TestConfig(unittest.TestCase):\n    \"\"\"\n    Unit tests for the 'Config' class.\n    \"\"\"\n\n    def setUp(self):\n        \"\"\"\n        Creates a fake package logger.\n        \"\"\"\n\n        self.logger = logging.getLogger(\"probequest\")\n        self.logger.setLevel(logging.DEBUG)\n\n    def test_default_values(self):\n        \"\"\"\n        Tests the default values.\n        \"\"\"\n\n        config = Config()\n\n        self.assertIsNone(config.interface)\n\n        self.assertIsNone(config.essid_filters)\n        self.assertIsNone(config.essid_regex)\n        self.assertFalse(config.ignore_case)\n\n        self.assertIsNone(config.mac_exclusions)\n        self.assertIsNone(config.mac_filters)\n\n        self.assertIsNone(config.output_file)\n\n        self.assertFalse(config.fake)\n        self.assertFalse(config.debug)\n\n        with self.assertLogs(self.logger, level=logging.DEBUG):\n            self.assertEqual(\n                config.frame_filter,\n                \"type mgt subtype probe-req\"\n            )\n\n    def test_non_existing_interface(self):\n        \"\"\"\n        Tests if an exception is well raised when setting a non-existing\n        network interface.\n        \"\"\"\n\n        with patch(\"probequest.config.get_if_list\", return_value=(\"wlan0\",\n                   \"wlan0mon\")):\n            config = Config()\n\n            with self.assertRaises(InterfaceDoesNotExistException):\n                config.interface = \"wlan1\"\n\n    def test_existing_interface(self):\n        \"\"\"\n        Tests with an existing network interface.\n        \"\"\"\n\n        # pylint: disable=no-self-use\n\n        with patch(\"probequest.config.get_if_list\", return_value=(\"wlan0\",\n                   \"wlan0mon\")):\n            config = Config()\n            config.interface = \"wlan0\"\n\n    def test_frame_filter_with_mac_filtering(self):\n        \"\"\"\n        Tests the frame filter when some MAC addresses need to be filtered.\n        \"\"\"\n\n        config = Config()\n        config.mac_filters = [\"a4:77:33:9a:73:5c\", \"b0:05:94:5d:5a:4d\"]\n\n        with self.assertLogs(self.logger, level=logging.DEBUG):\n            self.assertEqual(\n                config.frame_filter,\n                \"type mgt subtype probe-req\" +\n                \" and (ether src host a4:77:33:9a:73:5c\" +\n                \"|| ether src host b0:05:94:5d:5a:4d)\"\n            )\n\n    def test_frame_filter_with_mac_exclusion(self):\n        \"\"\"\n        Tests the frame filter when some MAC addresses need to be excluded.\n        \"\"\"\n\n        config = Config()\n        config.mac_exclusions = [\"a4:77:33:9a:73:5c\", \"b0:05:94:5d:5a:4d\"]\n\n        with self.assertLogs(self.logger, level=logging.DEBUG):\n            self.assertEqual(\n                config.frame_filter,\n                \"type mgt subtype probe-req\" +\n                \" and not (ether src host a4:77:33:9a:73:5c\" +\n                \"|| ether src host b0:05:94:5d:5a:4d)\"\n            )\n\n    def test_compiled_essid_regex_with_an_empty_regex(self):\n        \"\"\"\n        Tests 'compiled_essid_regex' with an empty regex.\n        \"\"\"\n\n        config = Config()\n        compiled_regex = config.compiled_essid_regex\n\n        self.assertEqual(compiled_regex, None)\n\n    def test_compiled_essid_regex_with_a_case_sensitive_regex(self):\n        \"\"\"\n        Tests 'compiled_essid_regex' with a case-sensitive regex.\n        \"\"\"\n\n        config = Config()\n        config.essid_regex = \"Free Wi-Fi\"\n\n        with self.assertLogs(self.logger, level=logging.DEBUG):\n            compiled_regex = config.compiled_essid_regex\n\n        self.assertEqual(compiled_regex, rcompile(config.essid_regex))\n\n    def test_compiled_essid_regex_with_a_case_insensitive_regex(self):\n        \"\"\"\n        Tests 'compiled_essid_regex' with a case-insensitive regex.\n        \"\"\"\n\n        config = Config()\n        config.essid_regex = \"Free Wi-Fi\"\n        config.ignore_case = True\n\n        with self.assertLogs(self.logger, level=logging.DEBUG):\n            compiled_regex = config.compiled_essid_regex\n\n        self.assertEqual(compiled_regex, rcompile(\n            config.essid_regex, IGNORECASE))\n"
  },
  {
    "path": "tests/unit/test_probe_request.py",
    "content": "\"\"\"\nUnit tests for the probe request module.\n\"\"\"\n\nimport unittest\nfrom netaddr.core import AddrFormatError\n\nfrom probequest.probe_request import ProbeRequest\n\n\nclass TestProbeRequest(unittest.TestCase):\n    \"\"\"\n    Unit tests for the 'ProbeRequest' class.\n    \"\"\"\n\n    def test_without_parameters(self):\n        \"\"\"\n        Initialises a 'ProbeRequest' object without any parameter.\n        \"\"\"\n\n        # pylint: disable=no-value-for-parameter\n\n        with self.assertRaises(TypeError):\n            _ = ProbeRequest()\n\n    def test_with_only_one_parameter(self):\n        \"\"\"\n        Initialises a 'ProbeRequest' object with only one parameter.\n        \"\"\"\n\n        # pylint: disable=no-value-for-parameter\n\n        timestamp = 1517872027.0\n\n        with self.assertRaises(TypeError):\n            _ = ProbeRequest(timestamp)\n\n    def test_with_only_two_parameters(self):\n        \"\"\"\n        Initialises a 'ProbeRequest' object with only two parameters.\n        \"\"\"\n\n        # pylint: disable=no-value-for-parameter\n\n        timestamp = 1517872027.0\n        s_mac = \"aa:bb:cc:dd:ee:ff\"\n\n        with self.assertRaises(TypeError):\n            _ = ProbeRequest(timestamp, s_mac)\n\n    def test_create_a_probe_request(self):\n        \"\"\"\n        Creates a new 'ProbeRequest' with all the required parameters.\n        \"\"\"\n\n        # pylint: disable=no-self-use\n\n        timestamp = 1517872027.0\n        s_mac = \"aa:bb:cc:dd:ee:ff\"\n        essid = \"Test ESSID\"\n\n        _ = ProbeRequest(timestamp, s_mac, essid)\n\n    def test_bad_mac_address(self):\n        \"\"\"\n        Initialises a 'ProbeRequest' object with a malformed MAC address.\n        \"\"\"\n\n        timestamp = 1517872027.0\n        s_mac = \"aa:bb:cc:dd:ee\"\n        essid = \"Test ESSID\"\n\n        with self.assertRaises(AddrFormatError):\n            probe_req = ProbeRequest(timestamp, s_mac, essid)\n            _ = probe_req.s_mac_oui\n\n    def test_print_a_probe_request(self):\n        \"\"\"\n        Initialises a 'ProbeRequest' object and prints it.\n        \"\"\"\n\n        timestamp = 1517872027.0\n        s_mac = \"aa:bb:cc:dd:ee:ff\"\n        essid = \"Test ESSID\"\n\n        probe_req = ProbeRequest(timestamp, s_mac, essid)\n\n        self.assertNotEqual(\n            str(probe_req).find(\"Mon, 05 Feb 2018 23:07:07\"),\n            -1\n        )\n        self.assertNotEqual(\n            str(probe_req).find(\n                \"aa:bb:cc:dd:ee:ff (Unknown OUI) -> Test ESSID\"\n            ),\n            -1\n        )\n"
  },
  {
    "path": "tests/unit/test_probe_request_parser.py",
    "content": "\"\"\"\nUnit tests for the probe request parser module.\n\"\"\"\n\nimport unittest\n\nfrom scapy.layers.dot11 import RadioTap, Dot11, Dot11ProbeReq, Dot11Elt\nfrom scapy.packet import fuzz\n\nfrom probequest.probe_request_parser import ProbeRequestParser\n\n\nclass TestProbeRequestParser(unittest.TestCase):\n    \"\"\"\n    Unit tests for the 'ProbeRequestParser' class.\n    \"\"\"\n\n    dot11_layer = Dot11(\n        addr1=\"ff:ff:ff:ff:ff:ff\",\n        addr2=\"aa:bb:cc:11:22:33\",\n        addr3=\"dd:ee:ff:11:22:33\",\n    )\n\n    def test_no_probe_request_layer(self):\n        \"\"\"\n        Creates a non-probe-request Wi-Fi packet and parses it with the\n        'ProbeRequestParser.parse()' function.\n        \"\"\"\n\n        with self.assertRaises(TypeError):\n            packet = RadioTap() / self.dot11_layer\n            ProbeRequestParser.parse(packet)\n\n    def test_empty_essid(self):\n        \"\"\"\n        Creates a probe request packet with an empty ESSID field and parses\n        it with the 'ProbeRequestParser.parse()' function.\n        \"\"\"\n\n        packet = RadioTap() \\\n            / self.dot11_layer \\\n            / Dot11ProbeReq() \\\n            / Dot11Elt(\n                info=\"\"\n            )\n\n        ProbeRequestParser.parse(packet)\n\n    def test_fuzz_packets(self):\n        \"\"\"\n        Parses 1000 randomly-generated probe requests with the\n        'ProbeRequestParser.parse()' function.\n        \"\"\"\n\n        # pylint: disable=no-self-use\n\n        with self.assertRaises(TypeError):\n            for _ in range(0, 1000):\n                packet = RadioTap()/fuzz(Dot11()/Dot11ProbeReq()/Dot11Elt())\n                ProbeRequestParser.parse(packet)\n"
  },
  {
    "path": "tests/unit/utils.py",
    "content": "\"\"\"\nCommon assets for the unit tests.\n\"\"\"\n\nfrom argparse import Namespace\n\n\ndef create_fake_config():\n    \"\"\"\n    Creates and returns a fake 'Config' object.\n    \"\"\"\n\n    config = Namespace()\n\n    config.interface = None\n\n    config.essid_filters = None\n    config.essid_regex = None\n    config.ignore_case = False\n\n    config.mac_exclusions = None\n    config.mac_filters = None\n\n    config.output_file = None\n\n    config.fake = False\n    config.debug = False\n\n    config.compiled_essid_regex = None\n    config.frame_filter = None\n\n    return config\n"
  },
  {
    "path": "tox.ini",
    "content": "# tox (https://tox.readthedocs.io/) is a tool for running tests\n# in multiple virtualenvs. This configuration file will run the\n# test suite on all supported python versions. To use it, \"pip install tox\"\n# and then run \"tox\" from this directory.\n\n[tox]\nenvlist = py39, py310, py311, py312, py313, flake8, pylint\nskip_missing_interpreters = true\nminversion = 3.0\nisolated_build = true\n\n[testenv]\ndescription = \"ProbeQuest's unit tests\"\ncommands =\n    {envpython} -m unittest discover -s tests\n\n[testenv:flake8]\ndescription = \"Check ProbeQuest's code style & quality\"\ndeps = flake8\ncommands =\n    {envpython} -m flake8 src tests\n\n[testenv:pylint]\ndescription = \"Check ProbeQuest for programming errors\"\ndeps =\n    pylint\n    setuptools\ncommands =\n    {envpython} -m pylint --rcfile={toxinidir}/pyproject.toml src tests\n\n[gh-actions]\ndescription = \"tox configuration when running on GitHub Actions\"\npython =\n    3.9: py39, flake8, pylint\n    3.10: py310, flake8, pylint\n    3.11: py311, flake8, pylint\n    3.12: py312, flake8, pylint\n    3.13: py313, flake8, pylint\n"
  }
]