Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,9 @@ import subprocess
|
|
4 |
import shutil
|
5 |
|
6 |
# Function to process APK file
|
7 |
-
def process_apk(input_path,
|
8 |
# Run apk-mitm command
|
9 |
-
command = f"apk-mitm {input_path} -o {
|
10 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
11 |
return result
|
12 |
|
@@ -26,18 +26,22 @@ if uploaded_file is not None:
|
|
26 |
with open(input_path, "wb") as f:
|
27 |
f.write(uploaded_file.read())
|
28 |
|
29 |
-
# Define output
|
30 |
-
|
31 |
|
32 |
# Process APK
|
33 |
st.write("Processing APK...")
|
34 |
-
result = process_apk(input_path,
|
35 |
|
36 |
if result.returncode == 0:
|
37 |
st.success("APK processed successfully!")
|
38 |
st.write("Processing result:")
|
39 |
st.text(result.stdout)
|
40 |
|
|
|
|
|
|
|
|
|
41 |
# Check if the processed APK file exists
|
42 |
if os.path.exists(output_path):
|
43 |
st.write(f"Processed APK file found at: {output_path}")
|
|
|
4 |
import shutil
|
5 |
|
6 |
# Function to process APK file
|
7 |
+
def process_apk(input_path, output_dir):
|
8 |
# Run apk-mitm command
|
9 |
+
command = f"apk-mitm {input_path} -o {output_dir}"
|
10 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
11 |
return result
|
12 |
|
|
|
26 |
with open(input_path, "wb") as f:
|
27 |
f.write(uploaded_file.read())
|
28 |
|
29 |
+
# Define output directory for the patched APK
|
30 |
+
output_dir = upload_dir
|
31 |
|
32 |
# Process APK
|
33 |
st.write("Processing APK...")
|
34 |
+
result = process_apk(input_path, output_dir)
|
35 |
|
36 |
if result.returncode == 0:
|
37 |
st.success("APK processed successfully!")
|
38 |
st.write("Processing result:")
|
39 |
st.text(result.stdout)
|
40 |
|
41 |
+
# Extract the patched APK file name from the stdout
|
42 |
+
output_file_name = result.stdout.split("Patched file: ")[-1].strip()
|
43 |
+
output_path = os.path.join(output_dir, output_file_name)
|
44 |
+
|
45 |
# Check if the processed APK file exists
|
46 |
if os.path.exists(output_path):
|
47 |
st.write(f"Processed APK file found at: {output_path}")
|