Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Repeat and Disk Path can be getted from config #18

Open
KFKMan opened this issue Dec 6, 2023 · 1 comment
Open

Code Repeat and Disk Path can be getted from config #18

KFKMan opened this issue Dec 6, 2023 · 1 comment

Comments

@KFKMan
Copy link

KFKMan commented Dec 6, 2023

if (Config == "XMode: Mini")
                {
                    if (Environment.Is64BitProcess)
                    {
                        DllPath = @"C:\MiniNoMoreCookies_x64.dll";
                    }
                    else
                    {
                        DllPath = @"C:\MiniNoMoreCookies.dll";
                    }
                }
                else if (Config == "XMode: Disabled")
                {
                    if (Environment.Is64BitProcess)
                    {
                        DllPath = @"C:\NoMoreCookies_x64.dll";
                    }
                    else
                    {
                        DllPath = @"C:\NoMoreCookies.dll";
                    }
                }
                else if (Config == "XMode: Enabled")
                {
                    if (Environment.Is64BitProcess)
                    {
                        DllPath = @"C:\XNoMoreCookies.dll";
                    }
                    else
                    {
                        DllPath = @"C:\XNoMoreCookies_x64.dll";
                    }
                }
std::wstring UserPath(L"C:\\Users\\");
std::wstring EdgePath;
std::wstring BravePath;
std::wstring ChromePath;
std::wstring FirefoxPath;
std::wstring YandexPath;
std::wstring OperaPath;
std::wstring WaterfoxPath;
std::wstring VivaldiPath;
BOOL Startup()
{
    wchar_t Username[50];
    DWORD UsernameLen = 50 - 1;
    if (GetUserNameW(Username, &UsernameLen))
    {
        UserPath = L"\\??\\C:\\Users\\";
        UserPath.append(Username);
        UserPath.append(L"\\");
        EdgePath = UserPath.c_str();
        EdgePath.append(L"AppData\\Local\\Microsoft\\Edge\\User Data");
        BravePath = UserPath.c_str();
        BravePath.append(L"AppData\\Local\\BraveSoftware\\Brave-Browser\\User Data");
        ChromePath = UserPath.c_str();
        ChromePath.append(L"AppData\\Local\\Google\\Chrome\\User Data");
        FirefoxPath = UserPath.c_str();
        FirefoxPath.append(L"AppData\\Roaming\\Mozilla\\Firefox\\Profiles");
        YandexPath = UserPath.c_str();
        YandexPath.append(L"AppData\\Local\\Yandex\\YandexBrowser\\User Data");
        OperaPath = UserPath.c_str();
        OperaPath.append(L"AppData\\Roaming\\Opera Software\\Opera Stable");
        WaterfoxPath = UserPath.c_str();
        WaterfoxPath.append(L"AppData\\Roaming\\Waterfox\\Profiles");
        VivaldiPath = UserPath.c_str();
        VivaldiPath.append(L"AppData\\Local\\Vivaldi\\User Data");
        return true;
    }
    else
    {
        return false;
    }
}

This codes using hard coded disk label, C:\ can be getted from config. Users maybe not using C: disk label or it's can be secured etc if any of them, your app will not work.


const char* Browsers[] = { "msedge.exe", "firefox.exe", "vivaldi.exe", "chrome.exe", "brave.exe", "browser.exe", "opera.exe", "waterfox.exe" };
const wchar_t* Browsers[] = { L"msedge.exe", L"firefox.exe", L"vivaldi.exe", L"chrome.exe", L"brave.exe", L"browser.exe", L"opera.exe", L"waterfox.exe" };

const wchar_t* Browsers[] this list is duplicated (created with same name on two place)

const wchar_t* Publishers[] = { L"mozilla", L"microsoft", L"brave", L"waterfox", L"yandex", L"opera", L"vivaldi" };

This lists can be getted from embedded source or a another header file like a consts.h.

BOOL IsBlacklistedApp(wchar_t* FileNamez)
{
    if (Signed2)
    {
        BOOL IsBlacklistedPublisher = FALSE;
        std::wstring Publisher(GetPublisherName(FileNamez));
        if (Publisher.c_str() != NULL)
        {
            const wchar_t* PublisherName = Publisher.c_str();
            const wchar_t* Publishers[] = { L"python", L"oracle" };
            int Size3 = sizeof(Publishers) / sizeof(Publishers[0]);
            wchar_t LowercasePublisher[100];
            wcscpy_s(LowercasePublisher, 256, PublisherName);
            for (int i = 0; LowercasePublisher[i] != L'\0'; i++)
                LowercasePublisher[i] = towlower(LowercasePublisher[i]);
            for (int i = 0; i < Size3; i++)
            {
                if (wcsstr(LowercasePublisher, Publishers[i]) != NULL)
                {
                    IsBlacklistedPublisher = TRUE;
                    break;
                }
            }
        }
        return IsBlacklistedPublisher && Signed2;
    }
    return false;
}

i don't understand that can you explain this to me?

switch (arg)
                    {
                        case "--ignore-updates":
                            Settings.CheckUpdates = false;
                            break;
                        case "--ignore-warnings":
                            Settings.ShowWarnings = false;
                            break;
                        //this setting is turned off by default for security reasons, you can enable it by editing the code
                        /*
                        case "--direct-uninstall":
                            if (!Settings.DirectInstall)
                                Settings.DirectUninstall = true;
                            break;
                        */
                        case "--show-browsers":
                            Settings.ShowBrowsers = true;
                            break;
                        case "--no-output":
                            Settings.ShowOutput = false;
                            break;
                    }

You can use library for that. C# has a lot of library for parsing args.

Environment.CurrentDirectory + "\\Components\\MiniNoMoreCookies_x64.dll";

You can use Path.Combine on there

            string MiniNoMoreCookiesx64 = Environment.CurrentDirectory + "\\Components\\MiniNoMoreCookies_x64.dll";
            string MiniNoMoreCookiesx86 = Environment.CurrentDirectory + "\\Components\\MiniNoMoreCookies.dll";
            string NoMoreCookiesx64 = Environment.CurrentDirectory + "\\Components\\NoMoreCookies_x64.dll";
            string NoMoreCookiesx86 = Environment.CurrentDirectory + "\\Components\\NoMoreCookies.dll";
            string XNoMoreCookiesx64 = Environment.CurrentDirectory + "\\Components\\XNoMoreCookies_x64.dll";
            string XNoMoreCookiesx86 = Environment.CurrentDirectory + "\\Components\\XNoMoreCookies.dll";

And you can use function to fix code repeating.

This variables is duplicated too is defined in 2 places (public static void Install(string Option, bool SecureBoot) and public static bool IsComponentsAvailable(string Option)). You can use class for getting this variables.

You can use ILogger (Microsoft.Extensions.Logging) interface for logging. You can use Serilog it's very easy logger with ILogger interface support.

static double Version = 2.3;

You can get Version info from AssemblyInfo.

@AdvDebug
Copy link
Owner

AdvDebug commented Dec 7, 2023

Thanks for your issue, i will fix/improve most of what you mentioned, for the "C" drive label i'm aware of this issue but honestly forgot to fix that in the last update.

for the part that you don't understand it's basically blacklisting python and java as they are signed binaries but they can execute code that is programmed by other people (if you know what i mean) so if the normal mode is used it will blacklist java and python as they are signed but at the same time have the possibility of executing malicious code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants