From 12d02af9b6cac9bf49d425299050c89528d49ac1 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Mon, 27 Sep 2021 16:26:44 -0600 Subject: [PATCH] sta_scan_test.py : fixed imports tip_station_powersave.py : added --help lf_qa.py : fixed comments in help Signed-off-by: Chuck SmileyRekiere --- py-scripts/sta_scan_test.py | 17 +++++++++-------- py-scripts/tip_station_powersave.py | 21 +++++++++++++++++++++ py-scripts/tools/lf_qa.py | 2 +- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/py-scripts/sta_scan_test.py b/py-scripts/sta_scan_test.py index e9a9a86c..6b5d3f0a 100755 --- a/py-scripts/sta_scan_test.py +++ b/py-scripts/sta_scan_test.py @@ -14,22 +14,23 @@ License: Free to distribute and modify. LANforge systems must be licensed. import sys import os +import importlib if sys.version_info[0] != 3: print("This script requires Python 3") exit(1) -if 'py-json' not in sys.path: -sys.path.append(os.path.join(os.path.abspath('..'), 'py-json')) - -if 'py-dashboard' not in sys.path: -sys.path.append(os.path.join(os.path.abspath('..'), 'py-dashboard')) - import argparse -from LANforge import LFUtils -from realm import Realm import time +sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) + +lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base") +LFCliBase = lfcli_base.LFCliBase +realm = importlib.import_module("py-json.realm") +Realm = realm.Realm +LFUtils = importlib.import_module("py-json.LANforge.LFUtils") + class StaScan(Realm): def __init__(self, diff --git a/py-scripts/tip_station_powersave.py b/py-scripts/tip_station_powersave.py index 1401372e..40038802 100755 --- a/py-scripts/tip_station_powersave.py +++ b/py-scripts/tip_station_powersave.py @@ -5,6 +5,7 @@ import importlib import pprint import time import datetime +import argparse if sys.version_info[0] != 3: print("This script requires Python 3") @@ -380,6 +381,26 @@ class TIPStationPowersave(LFCliBase): self.sta_powersave_disabled_profile.cleanup(desired_stations=self.normal_sta_list) def main(): + + parser = argparse.ArgumentParser( + prog='tip_station_powersave.py', + formatter_class=argparse.RawTextHelpFormatter, + epilog='''\ + tip_station_powersave.py + + ''', + description='''\ +This script uses filters from realm's PacketFilter class to filter pcap output for specific packets. +Currently it uses a filter for association packets using wlan.fc.type_subtype<=3. It is also using a filter +for QOS Null packets using wlan.fc.type_subtype==44. Both filters are also looking for the existence of +either the station MAC or the AP MAC in wlan.addr +These are returned as an array of lines from the output in the format +$subtype $mac_addresses $wlan.fc.pwrmgt + +#Currently, this test can only be applied to UDP connections + ''') + args = parser.parse_args() + lfjson_host = "localhost" lfjson_port = 8080 #station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=4, padding_number_=10000) diff --git a/py-scripts/tools/lf_qa.py b/py-scripts/tools/lf_qa.py index 84058b9f..fa0464bb 100755 --- a/py-scripts/tools/lf_qa.py +++ b/py-scripts/tools/lf_qa.py @@ -464,7 +464,7 @@ class csv_sqlite_dash(): def main(): parser = argparse.ArgumentParser( - prog='kpi_csv_sq.py', + prog='lf_qa.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ read kpi.csv into sqlite database , save png of history and preset on dashboard