2025-06-25 18:08:46 +08:00
|
|
|
#ifndef CONFIG_H
|
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
namespace Config {
|
|
|
|
|
|
|
|
|
|
struct SoFile {
|
|
|
|
|
std::string name;
|
|
|
|
|
std::string storedPath;
|
|
|
|
|
std::string originalPath;
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-26 19:59:33 +08:00
|
|
|
enum class InjectionMethod {
|
|
|
|
|
STANDARD = 0,
|
|
|
|
|
RIRU = 1,
|
|
|
|
|
CUSTOM_LINKER = 2
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-27 16:15:38 +08:00
|
|
|
struct GadgetConfig {
|
|
|
|
|
std::string address = "0.0.0.0";
|
|
|
|
|
int port = 27042;
|
|
|
|
|
std::string onPortConflict = "fail";
|
|
|
|
|
std::string onLoad = "wait";
|
|
|
|
|
std::string gadgetName = "libgadget.so";
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-25 18:08:46 +08:00
|
|
|
struct AppConfig {
|
|
|
|
|
bool enabled = false;
|
2025-06-26 19:59:33 +08:00
|
|
|
InjectionMethod injectionMethod = InjectionMethod::STANDARD;
|
2025-06-25 18:08:46 +08:00
|
|
|
std::vector<SoFile> soFiles;
|
2025-06-27 16:15:38 +08:00
|
|
|
GadgetConfig* gadgetConfig = nullptr;
|
2025-06-25 18:08:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ModuleConfig {
|
|
|
|
|
bool enabled = true;
|
|
|
|
|
bool hideInjection = false;
|
2025-06-27 15:29:55 +08:00
|
|
|
int injectionDelay = 2; // Default 2 seconds
|
2025-06-25 18:08:46 +08:00
|
|
|
std::unordered_map<std::string, AppConfig> perAppConfig;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Read configuration from file
|
|
|
|
|
ModuleConfig readConfig();
|
|
|
|
|
|
|
|
|
|
// Check if app is enabled for injection
|
|
|
|
|
bool isAppEnabled(const std::string& packageName);
|
|
|
|
|
|
|
|
|
|
// Get SO files for specific app
|
|
|
|
|
std::vector<SoFile> getAppSoFiles(const std::string& packageName);
|
|
|
|
|
|
|
|
|
|
// Get hide injection setting
|
|
|
|
|
bool shouldHideInjection();
|
2025-06-26 19:59:33 +08:00
|
|
|
|
|
|
|
|
// Get injection method for specific app
|
|
|
|
|
InjectionMethod getAppInjectionMethod(const std::string& packageName);
|
2025-06-27 15:29:55 +08:00
|
|
|
|
|
|
|
|
// Get injection delay in seconds
|
|
|
|
|
int getInjectionDelay();
|
2025-06-25 18:08:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // CONFIG_H
|