Skip to content

Commit b5ab143

Browse files
committed
first
0 parents  commit b5ab143

File tree

8 files changed

+496
-0
lines changed

8 files changed

+496
-0
lines changed

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# BlueStacks Root GUI
2+
3+
This is an AIO application designed to simplify the configuration part of my original tutorial on how to [root BlueStacks](https://github.com/RobThePCGuy/Root-Bluestacks-with-Kitsune-Mask/) with Kitsune Mask. If you want to do things manually, then the original repo is where you go. This tool will allow you to toggle root access and read/write (R/W) modes for BlueStacks instances. It provides an intuitive interface for managing these settings without manually editing configuration files.
4+
5+
## Features
6+
7+
- Reads Windows Registry to auto-detect the right directories and lists them individually for you to pick.
8+
- Toggles root access (`Root: On/Off`) for individual instances.
9+
- Toggles file system read/write access (`R/W: On/Off`) for individual instances.
10+
- Updates the current status of root and R/W modes dynamically in the GUI.
11+
12+
## Installation
13+
14+
1. **Download the Executable**:
15+
- Download the latest `.exe` file from the [Releases](https://github.com/RobThePCGuy/BlueStacks-Root-GUI/releases) section.
16+
17+
2. **Run the App**:
18+
- Double-click the `.exe` file to open the GUI.
19+
- No installation is required.
20+
21+
3. **Requirements**:
22+
- Ensure BlueStacks is installed on your system.
23+
- The app detects BlueStacks configuration and instance files automatically.
24+
25+
---
26+
27+
## Usage Instructions
28+
29+
1. Open the app by running the `.exe` file.
30+
2. The app will automatically detect available BlueStacks instances and display them in the GUI.
31+
3. Select an instance by checking its corresponding checkbox.
32+
4. Use the following buttons:
33+
- **Toggle Root**: Toggles root access (`On`/`Off`) for the selected instance.
34+
- **Toggle R/W**: Toggles read/write mode (`On`/`Off`) for the selected instance.
35+
5. Observe the status updates (`Root: On/Off` and `R/W: On/Off`) next to each instance.
36+
6. Close the app when finished.
37+
38+
---
39+
40+
## Requirements
41+
42+
- **BlueStacks**: The app is designed to work with BlueStacks Android Emulator.
43+
- **Windows**: This app runs on Windows systems.
44+
45+
---
46+
47+
## Troubleshooting
48+
49+
### Common Issues
50+
51+
1. **Error: Configuration file not found**:
52+
- Ensure BlueStacks is installed and running.
53+
- Verify that the `bluestacks.conf` file exists in the expected directory.
54+
55+
2. **Status not updating**:
56+
- Restart the app to refresh instance detection.
57+
- Ensure the `.bstk` files are not locked by another process.
58+
59+
3. **Permissions error**:
60+
- Run the app as an administrator to ensure it can modify the necessary files.
61+
62+
---
63+
64+
## Development
65+
66+
### For Developers
67+
68+
1. Clone the repository:
69+
```bash
70+
git clone https://github.com/your-repo-name.git
71+
cd your-repo-name
72+
```
73+
74+
2. Install dependencies:
75+
```bash
76+
pip install -r requirements.txt
77+
```
78+
79+
3. Run the app:
80+
```bash
81+
python main.py
82+
```
83+
84+
4. Build the `.exe` file:
85+
```bash
86+
pyinstaller --onefile --windowed main.py
87+
```
88+
89+
---
90+
91+
## Contributions
92+
93+
Contributions are welcome! Feel free to open an issue or submit a pull request.

config_handler.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
def modify_config_file(config_path, setting, new_value):
2+
"""Modifies a setting in the BlueStacks configuration file.
3+
4+
Args:
5+
config_path: The full path to the bluestacks.conf file.
6+
setting: The name of the setting to modify (e.g., "bst.feature.rooting").
7+
new_value: The new value for the setting (e.g., "1" or "0").
8+
"""
9+
try:
10+
with open(config_path, "r") as f:
11+
lines = f.readlines()
12+
13+
with open(config_path, "w") as f:
14+
for line in lines:
15+
if line.startswith(setting + "="):
16+
f.write(f"{setting}=\"{new_value}\"\n")
17+
else:
18+
f.write(line)
19+
except FileNotFoundError:
20+
print(f"Error: Configuration file not found at {config_path}")
21+
except Exception as e:
22+
print(f"Error modifying configuration file: {e}")
23+
24+
def is_root_enabled(config_path, instance_name):
25+
"""Checks if root access is enabled for a specific instance in the configuration file."""
26+
try:
27+
with open(config_path, "r") as f:
28+
for line in f:
29+
if line.startswith(f"bst.instance.{instance_name}.enable_root_access="):
30+
return line.strip().endswith("=\"1\"")
31+
return False # Default to False if the setting is not found
32+
except FileNotFoundError:
33+
print(f"Error: Configuration file not found at {config_path}")
34+
return False
35+
except Exception as e:
36+
print(f"Error reading configuration file: {e}")
37+
return False

instance_handler.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
from docx import Document
2+
import os
3+
4+
def modify_instance_files(instance_path, file_names, new_type):
5+
"""Modifies the type of specified files within an instance's .bstk files.
6+
7+
Args:
8+
instance_path: The path to the instance directory (e.g., ...\Engine\Rvc64).
9+
file_names: A list of file names to modify (e.g., ["fastboot.vdi", "Root.vhd"]).
10+
new_type: The new type to set (e.g., "Normal" or "Readonly").
11+
"""
12+
for bstk_file_name in ["Android.bstk.in", f"{os.path.basename(instance_path)}.bstk"]:
13+
bstk_file_path = os.path.join(instance_path, bstk_file_name)
14+
15+
try:
16+
with open(bstk_file_path, "r") as file:
17+
content = file.readlines()
18+
19+
modified = False
20+
with open(bstk_file_path, "w") as file:
21+
for line in content:
22+
for file_name in file_names:
23+
if file_name in line:
24+
line = line.replace("Readonly", new_type).replace("Normal", new_type)
25+
modified = True
26+
file.write(line)
27+
28+
if modified:
29+
print(f"Modified file: {bstk_file_path}")
30+
else:
31+
print(f"No changes made to file: {bstk_file_path}")
32+
33+
except FileNotFoundError:
34+
print(f"Error: Instance file not found at {bstk_file_path}")
35+
except Exception as e:
36+
print(f"Error modifying instance file: {e}")
37+
38+
def is_instance_readonly(instance_path):
39+
"""Checks if the instance files are set to Readonly.
40+
41+
Args:
42+
instance_path: The path to the instance directory.
43+
44+
Returns:
45+
True if the instance files are in Readonly mode, False otherwise.
46+
"""
47+
for bstk_file_name in ["Android.bstk.in", f"{os.path.basename(instance_path)}.bstk"]:
48+
bstk_file_path = os.path.join(instance_path, bstk_file_name)
49+
50+
try:
51+
with open(bstk_file_path, "r") as file:
52+
for line in file:
53+
if "Readonly" in line:
54+
return True
55+
return False
56+
except FileNotFoundError:
57+
print(f"Error: Instance file not found at {bstk_file_path}")
58+
return False
59+
except Exception as e:
60+
print(f"Error reading instance file: {e}")
61+
return False

kitsune_handler.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import subprocess
2+
import time
3+
4+
def install_and_configure_kitsune(apk_path, instance_name):
5+
"""Attempts to install Kitsune Mask and perform the initial configuration.
6+
HIGHLY CONCEPTUAL - Requires significant research and adaptation.
7+
8+
Args:
9+
apk_path: Path to the Kitsune Mask APK.
10+
instance_name: The name of the BlueStacks instance.
11+
"""
12+
try:
13+
# 1. Install the APK using ADB
14+
adb_command = f"adb -s {instance_name} install {apk_path}"
15+
subprocess.run(adb_command, shell=True, check=True)
16+
17+
# 2. Launch Kitsune Mask (you need to find the correct package and activity name)
18+
adb_command = f"adb -s {instance_name} shell monkey -p com.example.kitsune 1" # Replace com.example.kitsune
19+
subprocess.run(adb_command, shell=True, check=True)
20+
21+
time.sleep(5) # Wait for the app to launch
22+
23+
# 3. Simulate UI interactions using ADB shell input (VERY brittle)
24+
# You'll need to use 'adb shell input tap X Y' commands, where X and Y
25+
# are coordinates on the screen. These coordinates will be VERY specific to
26+
# the device/resolution and will likely break easily.
27+
#
28+
# This sequence is EXTREMELY hypothetical and needs to be replaced with real
29+
# coordinates captured from a running emulator.
30+
adb_command = f"adb -s {instance_name} shell input tap 100 200" # Tap "Install" (example)
31+
subprocess.run(adb_command, shell=True, check=True)
32+
time.sleep(2)
33+
adb_command = f"adb -s {instance_name} shell input tap 300 400" # Tap "Direct Install to System" (example)
34+
subprocess.run(adb_command, shell=True, check=True)
35+
time.sleep(10) # Wait for installation
36+
37+
except Exception as e:
38+
print(f"Error automating Kitsune Mask: {e}")

main.ico

110 KB
Binary file not shown.

0 commit comments

Comments
 (0)