fragattack: improvements to injection tests

This commit is contained in:
Mathy Vanhoef 2020-06-26 09:59:18 +04:00 committed by Mathy Vanhoef
parent 70d35173a2
commit be4d268a60
3 changed files with 14 additions and 60 deletions

56
README
View File

@ -1,56 +0,0 @@
wpa_supplicant and hostapd
--------------------------
Copyright (c) 2002-2019, Jouni Malinen <j@w1.fi> and contributors
All Rights Reserved.
These programs are licensed under the BSD license (the one with
advertisement clause removed).
If you are submitting changes to the project, please see CONTRIBUTIONS
file for more instructions.
This package may include either wpa_supplicant, hostapd, or both. See
README file respective subdirectories (wpa_supplicant/README or
hostapd/README) for more details.
Source code files were moved around in v0.6.x releases and compared to
earlier releases, the programs are now built by first going to a
subdirectory (wpa_supplicant or hostapd) and creating build
configuration (.config) and running 'make' there (for Linux/BSD/cygwin
builds).
License
-------
This software may be distributed, used, and modified under the terms of
BSD license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name(s) of the above-listed copyright holder(s) nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -1 +1 @@
Subproject commit 69c61780992dc66313e194f97958380ffc110643 Subproject commit 2d258c920b4f6b7234387e14d84cbefd8d9a5b5e

View File

@ -8,21 +8,31 @@ def main():
parser.add_argument('monitor', nargs='?', help="Interface to use to monitor for frames.") parser.add_argument('monitor', nargs='?', help="Interface to use to monitor for frames.")
options = parser.parse_args() options = parser.parse_args()
peermac = "00:11:22:33:44:55"
subprocess.check_output(["rfkill", "unblock", "wifi"]) subprocess.check_output(["rfkill", "unblock", "wifi"])
set_monitor_mode(options.inject) set_monitor_mode(options.inject)
if options.monitor: if options.monitor:
set_monitor_mode(options.monitor) set_monitor_mode(options.monitor)
if get_channel(options.inject) != get_channel(options.monitor): chan_inject = get_channel(options.inject)
chan_monitor = get_channel(options.monitor)
if chan_inject == None or chan_monitor == None:
log(WARNING, "Unable to verify if both devices are on the same channel")
elif chan_inject != chan_monitor:
log(ERROR, "Both devices are not on the same channel") log(ERROR, "Both devices are not on the same channel")
quit(1) quit(1)
peermac = get_mac_address(options.monitor)
else: else:
log(WARNING, "Only performing selftest. This can detect only injection issues caused by") log(WARNING, "Only performing selftest. This can detect only injection issues caused by")
log(WARNING, "the kernel. Many other issues cannot be detected in this self-test,so you") log(WARNING, "the kernel. Many other issues cannot be detected in this self-test, so you")
log(WARNING, "should not trust the output of the tests unless you know what you're doing.") log(WARNING, "should not trust the output of the tests unless you know what you're doing.")
log(STATUS, "Performing injection tests ...") log(STATUS, "Performing injection tests ...")
test_injection(options.inject, options.monitor, peermac="00:11:22:33:44:55") try:
test_injection(options.inject, options.monitor, peermac)
except OSError as ex:
log(ERROR, str(ex))
if __name__ == "__main__": if __name__ == "__main__":
main() main()