wiresock / proxifyre

ProxiFyre: SOCKS5 Proxifier for Windows
https://www.ntkernel.com
GNU Affero General Public License v3.0
216 stars 18 forks source link

is it possible to use a wildcard to catch everything? #29

Closed JadianRadiator closed 4 months ago

JadianRadiator commented 5 months ago

is it possible to use a wildcard to catch everything?

wiresock commented 5 months ago

The process name matching functionality is encapsulated in the match_app_name function as detailed below:

/**
 * @brief Matches an application name pattern against process details.
 *
 * This function determines whether the provided application name pattern is part of the process's path or name. 
 * It first checks if the pattern contains a path by searching for "/" or "\\". If a path is present, 
 * it matches the pattern against the process's path_name; otherwise, it matches against the process's name.
 * The matching process is case-insensitive.
 *
 * @param app The application name or pattern to match against the process details.
 * @param process The process details being matched against the application pattern.
 * @return True if the process details match the application pattern, False otherwise.
 */
static bool match_app_name(const std::wstring& app, const std::shared_ptr<iphelper::network_process>& process)
{
    return (app.find(L'\\') != std::wstring::npos || app.find(L'/') != std::wstring::npos)
        ? (to_upper(process->path_name).find(app) != std::wstring::npos)
        : (to_upper(process->name).find(app) != std::wstring::npos);
}

Passing an empty string to the app parameter might act as a wildcard, potentially matching any process. However, this behavior hasn't been explicitly tested.