Tanium Hygiene Assessment Tool (THAT) plugin controller module.
tanium_hat.plugin.Plugin(plugin_name, plugin_mod, data_path, **kwargs)[source]¶Bases: object
Plugin class for THAT.
| Parameters: |
|---|
Notes
Helper methods provided for mode: analyze_data:
tanium_hat.plugin.Plugin.load_json_file() - loads a JSON file from config[data_path] and returns it as a python objecttanium_hat.plugin.Plugin.load_csv_as_df() - loads a CSV file from config[data_path] and returns it as a pandas dataframetanium_hat.plugin.Plugin.clean_df() - Clean a pandas dataframe of any rows that match values in columns and return the cleaned pandas dataframetanium_hat.plugin.Plugin.get_result() - Get a previously calculated result by name and return the resulttanium_hat.plugin.Plugin.force_int() - Force value to inttanium_hat.plugin.Plugin.force_float() - Force value to floattanium_hat.plugin.Plugin.resolve_dict_path() - Resolve path by string from a dictionary and return the resultMust call one of the following methods to start a given workflow for a mode:
tanium_hat.plugin.Plugin.get_tanium_data() for mode: get_tanium_datatanium_hat.plugin.Plugin.get_internet_data() for mode: get_internet_datatanium_hat.plugin.Plugin.analyze_data() for mode: analyze_dataLOG¶ERRORS¶list –
tanium_hat.plugin.Plugin.err_handler()EXCEPTIONS¶list –
tanium_hat.plugin.Plugin.err_handler()PKGS¶dict –
tanium_hat.plugin.Plugin.get_internet_data(), set at initGTD_RESULTS¶dict –
tanium_hat.plugin.Plugin.get_tanium_data() to store results.GID_RESULTS¶dict –
tanium_hat.plugin.Plugin.get_internet_data() to store results.ANALYZE_RESULTS¶dict –
tanium_hat.plugin.Plugin.analyze_data() to store resultsFILE_CACHE¶dict –
tanium_hat.plugin.Plugin.load_json_file() and tanium_hat.plugin.Plugin.load_csv_as_df() to cache file loadsanalyze_data(**kwargs)[source]¶Plugin mode entry point for analyze_data.
tanium_hat.plugin.Plugin.get_mode_defs() to get the attribute ANALYZE_DATA from tanium_hat.plugin.Plugin.PLUGIN_MODANALYZE_DATA and uses tanium_hat.plugin.Plugin.get_analyze_result() to execute the calculation and get the resultfunction_name in tanium_hat.plugin.Plugin.GID_RESULTS| Returns: | self.ANALYZE_RESULTS –
|
|---|---|
| Return type: | dict |
ask_question(handler, filename, **kwargs)[source]¶Ask question wrapper around PyTan to track timings, amongst other things.
filename in tanium_hat.plugin.Plugin.GTD_RESULTS| Parameters: |
|
|---|---|
| Returns: | ret –
|
| Return type: |
clean_column_value(df, col, val)[source]¶Clean a pandas dataframe of any rows that match value in a given column.
Helper method for use in analyze_data calculations.
| Parameters: |
|
|---|---|
| Returns: | ret –
|
| Return type: |
clean_df(df, **kwargs)[source]¶Clean a pandas dataframe of any rows that match values in columns.
Helper method for use in analyze_data calculations.
| Parameters: |
|
|---|---|
| Returns: | ret –
|
| Return type: |
err_handler(err_str, e=None)[source]¶Error handler.
tanium_kit.tools.orig_tb() to get the current exception string, if anytanium_hat.plugin.Plugin.EXCEPTIONStanium_hat.plugin.Plugin.ERRORS| Parameters: |
|---|
force_float(v, d=0.0)[source]¶Force value to float using tanium_hat.plugin.Plugin.force_val_wrap().
Helper method for use in analyze_data calculations.
| Parameters: | |
|---|---|
| Returns: | ret –
|
| Return type: |
force_int(v, d=0)[source]¶Force value to int using tanium_hat.plugin.Plugin.force_val_wrap().
Helper method for use in analyze_data calculations.
| Parameters: | |
|---|---|
| Returns: | ret –
|
| Return type: |
force_val_wrap(v, t, d=0)[source]¶Force value to type wrapper.
Helper method for use in analyze_data calculations.
| Parameters: | |
|---|---|
| Returns: | ret –
|
| Return type: |
get_analyze_result(name, exec_str)[source]¶Execute calculation and return result.
| Parameters: | |
|---|---|
| Returns: | result –
|
| Return type: |
get_function_result(wequests, mode_def, **kwargs)[source]¶Execute function from the plugin module and return result.
tanium_hat.plugin.Plugin.PKGS| Parameters: |
|
|---|---|
| Returns: | result –
|
| Return type: |
get_internet_data(wequests, **kwargs)[source]¶Plugin mode entry point for get_internet_data.
tanium_hat.plugin.Plugin.get_mode_defs() to get the attribute GET_INTERNET_DATA from tanium_hat.plugin.Plugin.PLUGIN_MODGET_INTERNET_DATA and uses tanium_hat.plugin.Plugin.get_function_result() to execute the function and get the resultfunction_name in tanium_hat.plugin.Plugin.GID_RESULTS| Parameters: | wequests (tanium_kit.wequests.Wequests) –
|
|---|---|
| Returns: | self.GID_RESULTS –
|
| Return type: | dict |
get_mode_defs(mode, attr_type)[source]¶Get a set of definitions for a given mode from the plugin module.
| Parameters: |
|
|---|---|
| Returns: | ret –
|
| Return type: |
get_order(default=1000)[source]¶Get the priority for this plugin.
| Parameters: | default (int, optional) –
|
|---|---|
| Returns: | ret –
|
| Return type: | int |
get_result(target)[source]¶Get a previously calculated result.
Helper method for use in analyze_data calculations.
| Parameters: | target (str) –
|
|---|---|
| Returns: | ret –
|
| Return type: | object |
get_tanium_data(handler, **kwargs)[source]¶Plugin mode entry point for get_tanium_data.
tanium_hat.plugin.Plugin.get_mode_defs() to get the attribute GET_TANIUM_DATA from tanium_hat.plugin.Plugin.PLUGIN_MODGET_TANIUM_DATA and uses tanium_hat.plugin.Plugin.ask_question() to ask the question| Parameters: | handler (pytan.handler.Handler) –
|
|---|---|
| Returns: | self.GTD_RESULTS –
|
| Return type: | dict |
load_csv_as_df(filename, **kwargs)[source]¶Load a CSV file as a pandas pandas.DataFrame.
Helper method for use in analyze_data calculations.
| Parameters: |
|
|---|---|
| Returns: | ret –
|
| Return type: |
load_json_file(filename, **kwargs)[source]¶Load a JSON file as a dict.
Helper method for use in analyze_data calculations.
| Parameters: |
|
|---|---|
| Returns: | ret |
| Return type: |
resolve_dict_path(path, source)[source]¶Resolve dict path from source using tanium_kit.tools.dict_path().
Helper method for use in analyze_data calculations.
| Parameters: | |
|---|---|
| Returns: | ret –
|
| Return type: |