dpt-shell icon indicating copy to clipboard operation
dpt-shell copied to clipboard

Huawei

Open freecode505 opened this issue 1 year ago • 6 comments

There is a problem with devices, Huawei or some antivirus the application protected with DPT detects them as viruses IMG_20240905_215712_776

https://github.com/user-attachments/assets/59a1f639-18ce-4172-ada2-b4d13648928c

mobile phone that uses a virus scanner avast

freecode505 avatar Sep 06 '24 03:09 freecode505

https://github.com/user-attachments/assets/69bb1133-2bdb-4c46-847f-d16c7623212a

Problem Android 10 emui 12

@luoyesiqiu

freecode505 avatar Sep 09 '24 11:09 freecode505

// Función para obtener el fabricante del dispositivo
const char *GetManufacturer() {
    static char manufacturer[PROP_VALUE_MAX];
    __system_property_get("ro.product.manufacturer", manufacturer);
    return manufacturer;
}

// Función para verificar si existe un archivo en la ruta especificada
bool FileExists(const char *path) {
    FILE *file = fopen(path, "r");
    if (file != nullptr) {
        fclose(file);
        return true;
    }
    return false;
}

// Función para obtener la ruta de la biblioteca ART dependiendo de la versión de Android
const char *GetArtLibPath() {
    const char *manufacturer = GetManufacturer();

    // Definimos una lista de rutas comunes
    static const char *commonPaths[] = {
        "/apex/com.android.art/lib/libart.so",
        "/apex/com.android.runtime/lib/libart.so",
        "/system/lib/libart.so",
        "/system/lib64/libart.so",
        "/vendor/lib/libart.so",
        "/vendor/lib64/libart.so"
    };

    // Si el SDK es menor que 29, usamos las rutas estándar en `/system`
    if (g_sdkLevel < 29) {
        const char *path = "/system/" LIB_DIR "/libart.so";
        if (FileExists(path)) {
            return path;
        }
    }
    // Si el SDK es 29 o mayor, comenzamos a revisar las rutas comunes
    else if (g_sdkLevel >= 29) {
        for (const char *path : commonPaths) {
            if (FileExists(path)) {
                return path;
            }
        }
    }

    // Rutas personalizadas basadas en fabricantes conocidos
    if (strcmp(manufacturer, "HUAWEI") == 0) {
        const char *path = "/huawei_custom_path/libart.so";
        if (FileExists(path)) {
            return path;
        }
    } else if (strcmp(manufacturer, "XIAOMI") == 0) {
        const char *path = "/xiaomi_custom_path/libart.so";
        if (FileExists(path)) {
            return path;
        }
    }

    // Intenta buscar en algunos directorios personalizados dinámicamente basados en el fabricante
    static char customPath[256];
    snprintf(customPath, sizeof(customPath), "/%s_custom_path/libart.so", manufacturer);
    if (FileExists(customPath)) {
        return customPath;
    }

    // Si no se encuentra ninguna ruta personalizada ni común, devuelve una ruta predeterminada segura
    return "/system/lib/libart.so"; // Fallback general
}

};

@luoyesiqiu @luoyesiqiu Here you can have an example remember to get the manufacturer of the device it is important for some this DIR may vary

freecode505 avatar Sep 09 '24 17:09 freecode505

I tried to use dpt-shell to process v2raysNG and install it on a Huawei phone, but the phone did not report a virus. It may vary from region to region. You can try changing the apk signature.

luoyesiqiu avatar Sep 11 '24 02:09 luoyesiqiu

I tried to use dpt-shell to process v2raysNG and install it on a Huawei phone, but the phone did not report a virus. It may vary from region to region. You can try changing the apk signature.

Well, a friend or a phone with antivirus mentioned this to me, avast, It doesn't matter, it would be good if you added the address of other manufacturers that are not included.

freecode505 avatar Sep 11 '24 02:09 freecode505

// Función para obtener el fabricante del dispositivo
const char *GetManufacturer() {
    static char manufacturer[PROP_VALUE_MAX];
    __system_property_get("ro.product.manufacturer", manufacturer);
    return manufacturer;
}

// Función para verificar si existe un archivo en la ruta especificada
bool FileExists(const char *path) {
    FILE *file = fopen(path, "r");
    if (file != nullptr) {
        fclose(file);
        return true;
    }
    return false;
}

// Función para obtener la ruta de la biblioteca ART dependiendo de la versión de Android
const char *GetArtLibPath() {
    const char *manufacturer = GetManufacturer();

    // Definimos una lista de rutas comunes
    static const char *commonPaths[] = {
        "/apex/com.android.art/lib/libart.so",
        "/apex/com.android.runtime/lib/libart.so",
        "/system/lib/libart.so",
        "/system/lib64/libart.so",
        "/vendor/lib/libart.so",
        "/vendor/lib64/libart.so"
    };

    // Si el SDK es menor que 29, usamos las rutas estándar en `/system`
    if (g_sdkLevel < 29) {
        const char *path = "/system/" LIB_DIR "/libart.so";
        if (FileExists(path)) {
            return path;
        }
    }
    // Si el SDK es 29 o mayor, comenzamos a revisar las rutas comunes
    else if (g_sdkLevel >= 29) {
        for (const char *path : commonPaths) {
            if (FileExists(path)) {
                return path;
            }
        }
    }

    // Rutas personalizadas basadas en fabricantes conocidos
    if (strcmp(manufacturer, "HUAWEI") == 0) {
        const char *path = "/huawei_custom_path/libart.so";
        if (FileExists(path)) {
            return path;
        }
    } else if (strcmp(manufacturer, "XIAOMI") == 0) {
        const char *path = "/xiaomi_custom_path/libart.so";
        if (FileExists(path)) {
            return path;
        }
    }

    // Intenta buscar en algunos directorios personalizados dinámicamente basados en el fabricante
    static char customPath[256];
    snprintf(customPath, sizeof(customPath), "/%s_custom_path/libart.so", manufacturer);
    if (FileExists(customPath)) {
        return customPath;
    }

    // Si no se encuentra ninguna ruta personalizada ni común, devuelve una ruta predeterminada segura
    return "/system/lib/libart.so"; // Fallback general
}

};

@luoyesiqiu @luoyesiqiu Here you can have an example remember to get the manufacturer of the device it is important for some this DIR may vary

As I showed here @luoyesiqiu

freecode505 avatar Sep 11 '24 02:09 freecode505

The existing libart.so path covers general scenarios. If a manufacturer customizes libart.so, specifying the path may not work.

luoyesiqiu avatar Sep 13 '24 22:09 luoyesiqiu