Skip to content

Commit

Permalink
Refactor birdout.py script to improve file handling and add user prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
jooapa committed Feb 3, 2024
1 parent 031e274 commit a59673d
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions birdout.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
import os, sys, subprocess
import py7zr

files = sys.argv[1:]
arg_files = sys.argv[1:]
files = []
# counting the number of directories

org_path = os.path.dirname(os.path.realpath(__file__))
# get directory of first file
path_to_go = os.path.dirname(files[0])
path_to_current_lua_file = os.path.dirname(arg_files[0])

if len(files) == 0:
if len(arg_files) == 0:
print("Usage: birdout.py <file.lua> <file.lua> ...")
print("You can also pass a directory as an argument to decrypt all .lua files in it.")
sys.exit(1)


for file in files:
for file in arg_files:
# if directory
if os.path.isdir(file):
# loop through all files in directory and if extension is .lua, add to list
for root, dirs, files in os.walk(file):
for file in files:
for root, dirs, arg_files in os.walk(file):
for file in arg_files:
if file.endswith(".lua"):
file = os.path.join(root, file)
print("File: " + file)

if not os.path.isfile(file):
print("File not found: " + file)
# remove file from list
files.remove(file)
else:
files.append(file)

if len(files) == 0:
print("No valid files found!")
sys.exit(1)

# go to directory of first file
os.chdir(path_to_go)
os.chdir(path_to_current_lua_file)
# remove the path from files
files = [os.path.basename(file) for file in files]

print("\nAngry Birds Lua Decryptor, works on for decrypting Angry Birds Lua files.")
print("For Encrypting Luad files back, Chech README.md")
print("nöf nöf!")

print("\nDecrypting files: " + str(files))

inp = input('''
CHOOSE Angry Birds Game:
Expand Down Expand Up @@ -116,4 +113,4 @@ def decrypt_file(hex, file):
for file in files:
decrypt_file(hex, file)

print("nöf nöf!")
print("nöf nöf! Done!")

0 comments on commit a59673d

Please sign in to comment.