コード例 #1
0
ファイル: Platform.cs プロジェクト: whitevirus/Eddie
        public virtual List <string> GetEnvironmentPaths()
        {
            string        envPath = Environment.GetEnvironmentVariable("PATH");
            List <string> paths   = UtilsString.StringToList(envPath, EnvPathSep, true, true, true, true);

            return(paths);
        }
コード例 #2
0
ファイル: OvpnBuilder.cs プロジェクト: gcmcom/Eddie
        public void NormalizeRelativePathDirective(string name, string basePath)
        {
            List <Directive> list = GetDirectiveList(name);

            if (list != null)
            {
                foreach (Directive d in list)
                {
                    string body = d.Text.Trim();
                    if (body == "")
                    {
                        continue;
                    }
                    List <string> fields = UtilsString.StringToList(body, " ");
                    if (fields.Count < 1)
                    {
                        return;
                    }
                    string path = fields[0];
                    fields.RemoveAt(0);
                    if ((path.StartsWith("\"")) && (path.EndsWith("\"")))
                    {
                        path = path.Substring(1, path.Length - 2);
                    }
                    path   = Platform.Instance.FileGetAbsolutePath(path, basePath);
                    d.Text = EncodePath(path) + " " + String.Join(" ", fields.ToArray());
                    d.Text = d.Text.Trim();
                }
            }
        }
コード例 #3
0
ファイル: SystemShell.cs プロジェクト: gcmcom/Eddie
        // Called for user events
        public static void ShellUserEvent(string path, string arguments, bool waitEnd)
        {
            List <string> args = UtilsString.StringToList(arguments, " ", true, true, false, false);

            Shell(path, args.ToArray(), waitEnd);
        }
コード例 #4
0
        public IpAddresses GetIpsWhiteListOutgoing(bool includeIpUsedByClient)
        {
            IpAddresses result = new IpAddresses();

            // Custom
            {
                string list = Engine.Instance.Storage.Get("netlock.allowed_ips");
                list = list.Replace("\u2028", ",");                 // macOS Hack  // TOCLEAN
                List <string> hosts = UtilsString.StringToList(list);
                foreach (string host in hosts)
                {
                    string host2      = host;
                    int    posComment = host2.IndexOf("#");
                    if (posComment != -1)
                    {
                        host2 = host2.Substring(0, posComment).Trim();
                    }

                    result.Add(host2);
                }
            }

            // Routes Out
            {
                string   routes  = Engine.Instance.Storage.Get("routes.custom");
                string[] routes2 = routes.Split(';');
                foreach (string route in routes2)
                {
                    string[] routeEntries = route.Split(',');
                    if (routeEntries.Length < 2)
                    {
                        continue;
                    }

                    string host   = routeEntries[0];
                    string action = routeEntries[1];

                    if (action == "out")
                    {
                        result.Add(host);
                    }
                }
            }

            // DNS
            if (Engine.Instance.Storage.GetBool("netlock.allow_dns"))
            {
                result.Add(Platform.Instance.DetectDNS());
            }

            if (includeIpUsedByClient)
            {
                // Providers
                foreach (Provider provider in Engine.Instance.ProvidersManager.Providers)
                {
                    result.Add(provider.GetNetworkLockAllowedIps());
                }

                // Servers
                lock (Engine.Instance.Connections)
                {
                    Dictionary <string, ConnectionInfo> servers = new Dictionary <string, ConnectionInfo>(Engine.Instance.Connections);

                    foreach (ConnectionInfo infoServer in servers.Values)
                    {
                        result.Add(infoServer.IpsEntry);
                    }
                }
            }

            return(result);
        }