Cleanup
This commit is contained in:
+6
-2
@@ -230,8 +230,12 @@ def menu_prepare_to_enforce():
|
|||||||
if not os.path.exists(f"parquet\\condensed_executions_{first_policy}_{second_policy}.parquet"):
|
if not os.path.exists(f"parquet\\condensed_executions_{first_policy}_{second_policy}.parquet"):
|
||||||
utils.hashfunctions.condenseExecutions(first_policy,second_policy)
|
utils.hashfunctions.condenseExecutions(first_policy,second_policy)
|
||||||
|
|
||||||
if os.path.exists(f"parquet\\hashes_rep_unknown_{first_policy}_{second_policy}.parquet") & os.path.exists(f"parquet\\hashes_rep_good_{first_policy}_{second_policy}.parquet") & os.path.exists(f"parquet\\hashes_rep_bad_{first_policy}_{second_policy}.parquet"):
|
if (
|
||||||
utils.hashfunctions.divideSortedHashExecutions(first_policy,second_policy,pups)
|
os.path.exists(f"parquet\\hashes_rep_unknown_{first_policy}_{second_policy}.parquet") and
|
||||||
|
os.path.exists(f"parquet\\hashes_rep_good_{first_policy}_{second_policy}.parquet") and
|
||||||
|
os.path.exists(f"parquet\\hashes_rep_bad_{first_policy}_{second_policy}.parquet") and
|
||||||
|
not os.path.exists(f"needs_approved\\hashes_rep_unknown_{first_policy}_{second_policy}.csv")
|
||||||
|
):utils.hashfunctions.divideSortedHashExecutions(first_policy,second_policy,pups)
|
||||||
|
|
||||||
elif choice == "3":
|
elif choice == "3":
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import requests
|
|
||||||
import dotenv
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import utils.pretty as ct
|
|
||||||
|
|
||||||
url = 'https://172.17.22.240:3129'
|
|
||||||
policiesnames = []
|
|
||||||
policyids=[]
|
|
||||||
dotenv.load_dotenv()
|
|
||||||
endpoint = url + '/v1/application'
|
|
||||||
print(ct.colorText("[+] Grabbing All Allowlists", "cyan"))
|
|
||||||
payload = {}
|
|
||||||
headers = {
|
|
||||||
"X-APIKey": os.getenv('APIKEY')
|
|
||||||
}
|
|
||||||
response = requests.request("POST", endpoint, headers=headers, data=payload, verify=False)
|
|
||||||
parse_text = json.loads(response.text)
|
|
||||||
for index, list in enumerate(parse_text['response']['applications'], start=1):
|
|
||||||
if index >= 38:
|
|
||||||
print(list)
|
|
||||||
#Need else and catch for upper bound
|
|
||||||
@@ -1,9 +1,29 @@
|
|||||||
import json
|
# Copyright (C) 2025 James Brotosky, Brandon Wickline
|
||||||
import requests
|
#
|
||||||
import os
|
# This program is free software: you can redistribute it and/or modify
|
||||||
import pandas as pd
|
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Local Imports
|
||||||
import utils.pretty as ct
|
import utils.pretty as ct
|
||||||
|
|
||||||
|
#Standard Libary Imports:
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
#3rd Party Imports:
|
||||||
|
import pandas as pd
|
||||||
|
import requests
|
||||||
|
|
||||||
def findAgentID(url):
|
def findAgentID(url):
|
||||||
|
|
||||||
@@ -101,11 +121,7 @@ def getPolicyName(url, groupid):
|
|||||||
data = pd.DataFrame(result["response"]["groups"])
|
data = pd.DataFrame(result["response"]["groups"])
|
||||||
name = data.loc[data['groupid'] == f"{groupid}", 'name'].values[0]
|
name = data.loc[data['groupid'] == f"{groupid}", 'name'].values[0]
|
||||||
return name
|
return name
|
||||||
import datetime
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import utils.pretty as ct
|
|
||||||
|
|
||||||
def devicehistory(url, outputjson: bool):
|
def devicehistory(url, outputjson: bool):
|
||||||
endpoint = url + '/v1/getexechistory'
|
endpoint = url + '/v1/getexechistory'
|
||||||
|
|||||||
+10
-4
@@ -12,15 +12,21 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Local Imports
|
||||||
|
import utils.hashfunctions as hashf
|
||||||
|
import utils.pathfunctions as pathf
|
||||||
|
import utils.pretty as ct
|
||||||
|
from AirlockTools import tryToReadCSV
|
||||||
|
|
||||||
|
#Standard Libary Imports:
|
||||||
import gc
|
import gc
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
#3rd Party Imports:
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import requests
|
import requests
|
||||||
import utils.pathfunctions as pathf
|
|
||||||
import utils.hashfunctions as hashf
|
|
||||||
import utils.pretty as ct
|
|
||||||
from AirlockTools import tryToReadCSV
|
|
||||||
|
|
||||||
def aggregateHashes(executions_json) -> pd.DataFrame:
|
def aggregateHashes(executions_json) -> pd.DataFrame:
|
||||||
"""
|
"""
|
||||||
|
|||||||
+27
-7
@@ -1,15 +1,35 @@
|
|||||||
import json
|
# Copyright (C) 2025 James Brotosky, Brandon Wickline
|
||||||
import requests
|
#
|
||||||
import os
|
# This program is free software: you can redistribute it and/or modify
|
||||||
import pandas as pd
|
# it under the terms of the GNU Affero General Public License as published
|
||||||
import utils.pretty as ct
|
# by the Free Software Foundation, either version 3 of the License, or
|
||||||
import math
|
# (at your option) any later version.
|
||||||
import time
|
#
|
||||||
|
# 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 Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Local Imports
|
||||||
import utils.clientfunctions as clientf
|
import utils.clientfunctions as clientf
|
||||||
import utils.pathfunctions as pathf
|
import utils.pathfunctions as pathf
|
||||||
import utils.policyfunctions as policyf
|
import utils.policyfunctions as policyf
|
||||||
|
import utils.pretty as ct
|
||||||
from utils.perstscheduler import register_function, run_once_job, recurring_job, reload_jobs, start_scheduler, find_and_prioritize_jobs_by_pid
|
from utils.perstscheduler import register_function, run_once_job, recurring_job, reload_jobs, start_scheduler, find_and_prioritize_jobs_by_pid
|
||||||
|
|
||||||
|
#Standard Libary Imports:
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
#3rd Party Imports:
|
||||||
|
import pandas as pd
|
||||||
|
import requests
|
||||||
|
|
||||||
def getActiveOTP(url):
|
def getActiveOTP(url):
|
||||||
|
|
||||||
endpoint = url + f'/v1/otp/usage'
|
endpoint = url + f'/v1/otp/usage'
|
||||||
|
|||||||
+10
-5
@@ -12,15 +12,20 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
import ast
|
|
||||||
import gc
|
#Local Imports
|
||||||
import os
|
|
||||||
import pandas as pd
|
|
||||||
import re
|
|
||||||
import utils.pathfunctions as pathf
|
import utils.pathfunctions as pathf
|
||||||
import utils.pretty as ct
|
import utils.pretty as ct
|
||||||
from AirlockTools import tryToReadCSV
|
from AirlockTools import tryToReadCSV
|
||||||
|
|
||||||
|
#Standard Libary Imports:
|
||||||
|
import ast
|
||||||
|
import gc
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
#3rd Party Imports:
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
def split_filepaths_grouped(df, col="filename", group_parts=4, min_parts=4):
|
def split_filepaths_grouped(df, col="filename", group_parts=4, min_parts=4):
|
||||||
def clean_split(path):
|
def clean_split(path):
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
import schedule
|
#Standard Libary Imports:
|
||||||
import time
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
from typing import Callable, Any, List, Dict
|
from typing import Callable, Any, List, Dict
|
||||||
|
|
||||||
|
#3rd Party Imports:
|
||||||
|
import schedule
|
||||||
|
|
||||||
# File where all jobs are persisted
|
# File where all jobs are persisted
|
||||||
JOBS_FILE = "scheduling\\jobs.json"
|
JOBS_FILE = "scheduling\\jobs.json"
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -12,23 +12,22 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Local Imports
|
||||||
|
import utils.pretty as ct
|
||||||
|
#Standard Libary Imports:
|
||||||
|
import datetime
|
||||||
import gc
|
import gc
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pandas as pd
|
|
||||||
import re
|
import re
|
||||||
import requests
|
|
||||||
import utils.pretty as ct
|
|
||||||
import datetime
|
|
||||||
import requests
|
|
||||||
import ijson
|
|
||||||
from bson import ObjectId
|
|
||||||
import datetime
|
|
||||||
import tqdm
|
|
||||||
import sys
|
import sys
|
||||||
|
#3rd Party Imports:
|
||||||
|
import ijson
|
||||||
|
import pandas as pd
|
||||||
|
import requests
|
||||||
|
import tqdm
|
||||||
|
from bson import ObjectId
|
||||||
|
|
||||||
def addHash(url, policy, hash):
|
def addHash(url, policy, hash):
|
||||||
print(f"Adding the following: {hash} \n to {policy}:")
|
print(f"Adding the following: {hash} \n to {policy}:")
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Standard Libary Imports:
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def colorText(text: str, color: str) -> str:
|
def colorText(text: str, color: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user