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