Skip to content

Commit

Permalink
2.24.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AirVPN committed Dec 10, 2024
1 parent aeaa7e5 commit df34423
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 18 deletions.
2 changes: 1 addition & 1 deletion repository/linux_debian/bundle/eddie-ui/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Eddie <[email protected]>
Priority: optional
Architecture: {@architecture}
Installed-Size: 8192
Depends: libc6 (>= 2.3.2), policykit-1, curl, libnotify-bin, openvpn, stunnel4, libcurl4, libsecret-tools, libayatana-appindicator3-1
Depends: libc6 (>= 2.3.2), pkexec | policykit-1, curl, libnotify-bin, openvpn, stunnel4, libcurl4, libsecret-tools, libayatana-appindicator3-1
Breaks: airvpn (<< 2.14.4)
Replaces: airvpn (<< 2.14.4)
Homepage: https://eddie.website/
Expand Down
2 changes: 1 addition & 1 deletion repository/linux_debian/bundle/eddie-ui2/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Eddie <[email protected]>
Priority: optional
Architecture: {@architecture}
Installed-Size: 8192
Depends: libc6 (>= 2.3.2), policykit-1, curl, libnotify-bin, openvpn, stunnel4, libcurl4, libsecret-tools, libayatana-appindicator3-1, mono-runtime-common
Depends: libc6 (>= 2.3.2), pkexec | policykit-1, curl, libnotify-bin, openvpn, stunnel4, libcurl4, libsecret-tools, libayatana-appindicator3-1, mono-runtime-common
Breaks: airvpn (<< 2.14.4)
Replaces: airvpn (<< 2.14.4)
Homepage: https://eddie.website/
Expand Down
2 changes: 1 addition & 1 deletion repository/windows_portable/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mkdir !VARTARGETDIR!
copy !VARSCRIPTDIR!\portable.txt !VARTARGETDIR!

IF "!VARPROJECT!"=="cli" (
cd "!VARSCRIPTDIR!\..\..\src\App.CLI.Windows\"
cd /d "!VARSCRIPTDIR!\..\..\src\App.CLI.Windows\"
dotnet publish App.CLI.Windows.net8.csproj --configuration Release --runtime !VARRID! --self-contained true -p:PublishTrimmed=true -p:EnableCompressionInSingleFile=true
copy !VARSCRIPTDIR!\..\..\src\App.CLI.Windows\bin\!VARCONFIG!\net8.0\!VARRID!\publish\* !VARTARGETDIR! || goto :error
copy !VARSCRIPTDIR!\..\..\src\App.CLI.Windows\bin\!VARCONFIG!\net8.0\!VARRID!\Eddie-CLI-Elevated.exe !VARTARGETDIR! || goto :error
Expand Down
9 changes: 6 additions & 3 deletions src/App.CLI.MacOS.Elevated/src/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,13 @@ void Impl::Do(const std::string& commandId, const std::string& command, std::map
}
else if (command == "wireguard-version")
{
std::string wgPath = FsLocateExecutable("wg"); // Expected in macOS .app bundle
std::string wgPath = FsLocateExecutable("wg", false, true); // Expected in macOS .app bundle
std::string version = ExecEx1(wgPath, "version").out;
version = StringReplaceAll(version, "wireguard-tools v", "");
version = StringReplaceAll(version, " - https://git.zx2c4.com/wireguard-tools/", "");
version = StringReplaceAll(version, "wireguard-tools", "");
version = StringTrim(version, "v ");
size_t afterPos = version.find(' ');
if(afterPos != std::string::npos)
version = version.substr(0, afterPos);
ReplyCommand(commandId, version);
}
else if (command == "wireguard")
Expand Down
2 changes: 2 additions & 0 deletions src/App.CLI.Windows.Elevated/include/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ class Impl :public IWindows
bool WfpRemovePending(const std::string& filterName, const std::string& xml);
const char* WfpGetLastError();
DWORD WfpGetLastErrorCode();

void CleanupCompatibility();
};

120 changes: 120 additions & 0 deletions src/App.CLI.Windows.Elevated/src/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ int Impl::Main()
ThrowException("Error in sockets initialization");
}

// CleanupCompatibility();

int result = IWindows::Main();

WSACleanup();
Expand Down Expand Up @@ -1074,4 +1076,122 @@ const char* Impl::WfpGetLastError()
DWORD Impl::WfpGetLastErrorCode()
{
return m_wfpLastErrorCode;
}

#include <shlobj.h> // Necessario per SHGetKnownFolderPath

// Note: not yet used
void Impl::CleanupCompatibility()
{
// Old NSIS Start Menu Folder
if (true)
{
HKEY hKey;
wchar_t bufferName[4096];
DWORD bufferNameSize = sizeof(bufferName);

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\WOW6432Node\\AirVPN", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
bool result = (RegQueryValueEx(hKey, L"Start Menu Folder", NULL, NULL, reinterpret_cast<BYTE*>(bufferName), &bufferNameSize) == ERROR_SUCCESS);
RegCloseKey(hKey);
if (result)
{
PWSTR path = NULL;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_CommonPrograms, 0, NULL, &path);
if (SUCCEEDED(hr))
{
std::wstring commonProgramsPath(path);
commonProgramsPath += L"\\";
commonProgramsPath += std::wstring(bufferName);
CoTaskMemFree(path);

WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile((commonProgramsPath + L"\\*.lnk").c_str(), &fd);
if (h != INVALID_HANDLE_VALUE)
{
do
{
DeleteFile((commonProgramsPath + L"\\" + fd.cFileName).c_str());
} while (FindNextFile(h, &fd));
FindClose(h);
}
h = FindFirstFile((commonProgramsPath + L"\\*").c_str(), &fd);
if (h != INVALID_HANDLE_VALUE)
{
bool empty = true;
do
{
if (wcscmp(fd.cFileName, L".") && wcscmp(fd.cFileName, L".."))
{
empty = false;
break;
}
} while (FindNextFile(h, &fd));
FindClose(h);
if (empty)
RemoveDirectory(commonProgramsPath.c_str());
}
}
}
}
}

// Old NSIS installer entry
if (true)
{
HKEY hKey;
wchar_t buffer[4096];
DWORD bufferSize = sizeof(buffer);

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AirVPN", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
bool result = (RegQueryValueEx(hKey, L"UninstallString", NULL, NULL, reinterpret_cast<BYTE*>(buffer), &bufferSize) == ERROR_SUCCESS);
RegCloseKey(hKey);
if (result)
{
// Delete NSIS uninstall.exe
std::wstring uninstallerExe(buffer);
std::string uninstallerExeUtf8 = StringWStringToUTF8(uninstallerExe);
uninstallerExeUtf8 = StringTrim(uninstallerExeUtf8, "\"");
FsFileDelete(uninstallerExeUtf8);

// Delete Program Entry
RegDeleteKeyEx(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AirVPN",
KEY_WOW64_32KEY,
0
);
}
}
}

// Old NSIS RegKey
if (true)
{
RegDeleteKeyEx(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\WOW6432Node\\AirVPN",
KEY_WOW64_32KEY,
0
);
}

// Old NSIS directory
if (false)
{
HKEY hKey;
wchar_t buffer[4096];
DWORD bufferSize = sizeof(buffer);

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\WOW6432Node\\AirVPN", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
bool result = (RegQueryValueEx(hKey, L"", NULL, NULL, reinterpret_cast<BYTE*>(buffer), &bufferSize) == ERROR_SUCCESS);
RegCloseKey(hKey);
if (result)
{
// TODO
}
}
}
}
2 changes: 1 addition & 1 deletion src/Lib.CLI.Elevated/include/ibase.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class IBase
{
private:
std::string m_elevatedVersion = "v1378";
int m_elevatedPortDefault = 9349;
int m_elevatedPortDefault = 9350;

std::string m_session_key;
std::mutex m_mutex_inout;
Expand Down
12 changes: 11 additions & 1 deletion src/Lib.CLI.Elevated/src/ibase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ void IBase::MainDo(const std::string& commandId, const std::string& command, std
if (clientVersion != m_elevatedVersion)
ThrowException("Unexpected version, elevated: " + m_elevatedVersion + ", client: " + clientVersion);

if (params.find("path") != params.end()) // 2.24.5
{
if (GetProcessPathCurrentDir() != params["path"])
{
// This occur for example if Eddie in installed and service active, but another portable is running.
// Basically this is not a problem, if ElevatedVersion above match.
// But Security Hashes Checks will fail.
ThrowException("Unexpected path mismatch, elevated: " + GetProcessPathCurrentDir() + ", client: " + params["path"]);
}
}

m_session_key = params["key"];
}
else
Expand Down Expand Up @@ -998,7 +1009,6 @@ std::string IBase::FsLocateExecutable(const std::string& name, const bool throwE
return "";
}


// --------------------------
// Utils string
// --------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/Lib.Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static class Constants
public static byte[] NotSecretPayload = Encoding.UTF8.GetBytes("4af85e84255b077ad890dba297e811b7d016add1");
public static string PasswordIfEmpty = "e6552ddf3ac5c8755a82870d91273a63eab0da1e";
public static string Thanks = "Clodo, PJ, reiandrea, ProMIND, Berserker, OpenSourcerer, zhang888, LZ1, giganerd, Uncle Hunto, go558a83nk, sheivoko, NaDre, pfSense_fan, x0wllaar, cmaves";
public static int VersionInt = 294;
public static string VersionDesc = "2.24.4"; // Used by deploy system also to generate filenames
public static int VersionInt = 295;
public static string VersionDesc = "2.24.5"; // Used by deploy system also to generate filenames
public static bool VersionBeta = false;
public static string Domain = "eddie.website";
public static string WebSite = "https://eddie.website";
Expand All @@ -39,7 +39,7 @@ public static class Constants
public static string DnsVpn = "10.4.0.1"; // < 2.9, TOCLEAN
public static DateTime dateForPastChecking = new DateTime(2014, 08, 26);
public static string ElevatedVersionExpected = "v1378";
public static int ElevatedServicePort = 9349;
public static int ElevatedServicePort = 9350;

// Feature activation at compilation-time
public static bool OurRoutesInWin7 = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Lib.Core/Elevated/ISocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected string Connect(int port)

m_sessionKey = RandomGenerator.GetHash();

DoCommandSync("session-key", "key", m_sessionKey, "version", Constants.ElevatedVersionExpected);
DoCommandSync("session-key", "key", m_sessionKey, "version", Constants.ElevatedVersionExpected, "path", Platform.Instance.GetApplicationPath());

if (m_failedReason != "")
return m_failedReason;
Expand Down
3 changes: 2 additions & 1 deletion src/Lib.Core/Jobs/Discover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ private Json DiscoverIpData(string ip, string layer)
httpRequest.Url = url;
httpRequest.IpLayer = layer;

string json = Engine.Instance.FetchUrl(httpRequest).GetBody();
HttpResponse httpResponse = Engine.Instance.FetchUrl(httpRequest);
string json = httpResponse.GetBody();
Json jDoc = Json.Parse(json);

NormalizeServiceResponse(jDoc);
Expand Down
2 changes: 1 addition & 1 deletion src/Lib.Core/ProfileOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public void EnsureDefaults()
SetDefault("areas.allowlist", "text", "", LanguageManager.GetText(LanguageItems.ManOptionAreasAllowlist));
SetDefault("areas.denylist", "text", "", LanguageManager.GetText(LanguageItems.ManOptionAreasDenylist));

SetDefault("discover.ip_webservice.list", "text", "https://ipleak.net/json/{@ip};https://freegeoip.net/json/{@ip};http://ip-api.com/json/{@ip}", LanguageManager.GetText(LanguageItems.ManOptionDiscoverIpWebserviceList));
SetDefault("discover.ip_webservice.list", "text", "https://eddie.website/ipinfo/{@ip};https://ipleak.net/json/{@ip};http://ip-api.com/json/{@ip}", LanguageManager.GetText(LanguageItems.ManOptionDiscoverIpWebserviceList));
SetDefaultInt("discover.interval", 60 * 60 * 24, LanguageManager.GetText(LanguageItems.ManOptionDiscoverInterval));
SetDefaultBool("discover.exit", true, LanguageManager.GetText(LanguageItems.ManOptionDiscoverExit));

Expand Down
6 changes: 5 additions & 1 deletion src/Lib.Platform.MacOS.Native/src/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ extern "C" {
//totalibytes += if2m->ifm_data.ifi_ibytes;
//totalobytes += if2m->ifm_data.ifi_obytes;

char ifname[IF_NAMESIZE];
if_indextoname(if2m->ifm_index, ifname);

if (nRecords > 0)
jsonStr += ",";
jsonStr += "{ \"id\":" + std::to_string(if2m->ifm_index) + ",\"rcv\":" + std::to_string(if2m->ifm_data.ifi_ibytes) + ",\"snd\":" + std::to_string(if2m->ifm_data.ifi_obytes) + " }";
jsonStr += "{ \"id\":\"" + std::string(ifname) + "\",\"rcv\":" + std::to_string(if2m->ifm_data.ifi_ibytes) + ",\"snd\":" + std::to_string(if2m->ifm_data.ifi_obytes) + " }";
nRecords++;
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/Lib.Platform.MacOS/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -919,14 +919,14 @@ public override Json GetRealtimeNetworkStats()
{
// Mono NetworkInterface::GetIPv4Statistics().BytesReceived always return 0 under OSX.

Json result = new Json();
result.EnsureArray();

int maxLen = 1024;
byte[] buf = new byte[maxLen];
NativeMethods.GetRealtimeNetworkStats(buf, maxLen);
string jNativeStr = System.Text.Encoding.ASCII.GetString(buf);

return Json.Parse(jNativeStr);

/* TOCLEAN
Json jNative = Json.Parse(jNativeStr);
// Expect the sequence is the same.
Expand All @@ -944,14 +944,19 @@ public override Json GetRealtimeNetworkStats()
Int64 snd = jNativeIf["snd"].ValueInt64;
Json jInterface = new Json();
jInterface["id"].Value = interfaces[i].Id;
jInterface["pazzoid"].Value = jNativeIf["idn"].ValueString;
jInterface["rcv"].Value = rcv;
jInterface["snd"].Value = snd;
result.Append(jInterface);
}
}
}
System.IO.File.WriteAllText("/tmp/pazzo2.json", result.ToJsonPretty());
// pazzo
return result;
*/
}

public override void OnNetworkInterfaceInfoBuild(NetworkInterface networkInterface, Json jNetworkInterface)
Expand Down

0 comments on commit df34423

Please sign in to comment.