Add files via upload

This commit is contained in:
KittyNeverDies 2023-06-03 16:50:03 +00:00 committed by GitHub
parent 70c09e8093
commit 721bc0b3f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 111 additions and 0 deletions

1
bucket/__init__.py Normal file
View File

@ -0,0 +1 @@
from .main import launch

20
bucket/main.py Normal file
View File

@ -0,0 +1,20 @@
import os
from bucket.modes import launch_protect, get_logs
def launch(args):
print("__________ __ __ _____ _________ \n"
"\______ \__ __ ____ | | __ _____/ |_ / _ \ \_ ___ \ \n"
" | | _/ | \_/ ___\| |/ // __ \ __\ / /_\ \/ \ \/ \n"
" | | \ | /\ \___| <\ ___/| | / | \ \____\n"
" |______ /____/ \___ >__|_ \\___ >__| \____|__ /\______ /\n"
" \/ \/ \/ \/ \/ \/ \n")
if args.apppath or not args.logspath or not os.path.isfile(args.apppath):
print("BAC | Protecting / Logging application required!")
return
if args.protect:
if not args.logspath or not os.path.isfile(args.logspath):
print("BAC | For protecting, logs file required!")
launch_protect(args)
elif not args.protect:
get_logs(args)

2
bucket/modes/__init__.py Normal file
View File

@ -0,0 +1,2 @@
from .generate_log import get_logs
from .protect_app import launch_protect

View File

@ -0,0 +1,19 @@
import os
import time
from subprocess import check_output
from bucket.utils import clean_path, prepare_strings, kill_proc
def get_logs(args):
target = clean_path(args.apppath)
os.popen(args.apppath)
print("BAC | Launched app, waiting 5 seconds before making log.")
time.sleep(5)
out = check_output(f"listdlls {target}", shell=True)
strings_list = prepare_strings(out)
file = open(args.logspath, "w")
file.write(str(len(strings_list)))
file.close()
kill_proc(target)
exit()

View File

@ -0,0 +1,28 @@
import os
import time
from subprocess import check_output
from bucket.utils import clean_path, prepare_strings, kill_proc, is_launched
def protect(target, original_strings):
launched = True
while launched:
launched = is_launched(target)
time.sleep(5)
out = check_output(f"listdlls {target}", shell=True)
new_strings = prepare_strings(out)
if original_strings != len(new_strings):
print("BAC | Injection detected! Closing app...")
kill_proc(target)
exit()
def launch_protect(args):
target = clean_path(args.apppath)
with open(args.logspath) as f:
original_strings = f.read()
if not is_launched(target):
os.popen(args.apppath)
time.sleep(5)
protect(target, original_strings)

3
bucket/utils/__init__.py Normal file
View File

@ -0,0 +1,3 @@
from .edit import prepare_strings, clean_path
from .kill import kill_proc
from .launched import is_launched

22
bucket/utils/edit.py Normal file
View File

@ -0,0 +1,22 @@
def prepare_strings(out):
temp = ""
split = str(list(str(out)))
final_result = []
for char in range(0, len(split)-3):
if split[char] != "\\" and split[char + 1] != "r" or split[char] == "\\" and split[char + 1] != "r":
temp += split[char]
else:
final_result.append(temp)
temp = ""
return final_result
def clean_path(path) -> str:
result = ""
for char in path:
if char != "/":
result += char
else:
result = ""
return result

8
bucket/utils/kill.py Normal file
View File

@ -0,0 +1,8 @@
import psutil
def kill_proc(target) -> None:
for targets in psutil.process_iter():
if targets.name() == target:
targets.kill()

8
bucket/utils/launched.py Normal file
View File

@ -0,0 +1,8 @@
import psutil
def is_launched(target) -> bool:
for targets in psutil.process_iter():
if targets.name() == target:
return True
return False