public bool RemoveDenyIp(List <string> ipList)
        {
            if (ipList.Count == 0)
            {
                return(false);
            }

            var iptoblock = new StringBuilder();
            var komma     = "";

            foreach (var ip in ipList)
            {
                iptoblock.Append($"{komma}\"{ip}\"");
                komma = ",";
            }
            var proc = new FuncProcessor <GetResponse <AutoblockIpDate> >("/entry.cgi", _session.sid, new
            {
                api        = "SYNO.Core.Security.AutoBlock.Rules",
                version    = 1,
                block_days = 0,
                overwrite  = "true",
                ip         = $"[ {iptoblock} ]",
                method     = "delete",
                type       = "deny"
            });
            var retval = proc.Run();

            return(retval.success);
        }
Example #2
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor  = new DocProcessor(this);

            Enums    = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, doc_processor,
                                              Delegates, Enums, Profile, Version);
        }
        public GetResponse <Office365ListTasks> GetOffice365_ListTasks()
        {
            var proc = new FuncProcessor <GetResponse <Office365ListTasks> >("/entry.cgi", _session.sid, new
            {
                api     = "SYNO.ActiveBackupOffice365",
                version = 1,
                method  = "list_tasks"
            });

            return(proc.Run());
        }
        public GetResponse <CloudSyncSessList> GetSessList(Int64 connId)
        {
            var proc = new FuncProcessor <GetResponse <CloudSyncSessList> >("/entry.cgi", _session.sid, new
            {
                api           = "SYNO.CloudSync",
                version       = 1,
                method        = "list_sess",
                connection_id = connId
            });

            return(proc.Run());
        }
        /// <summary>
        /// Get list with blocked IP addresses
        /// </summary>
        /// <param name="_limit"></param>
        /// <returns></returns>
        public GetResponse <AutoblockIpDate> GetBlockedList(Int64 _limit = 250)
        {
            var proc = new FuncProcessor <GetResponse <AutoblockIpDate> >("/entry.cgi", _session.sid, new
            {
                api     = "SYNO.Core.Security.AutoBlock.Rules",
                version = 1,
                method  = "list",
                limit   = _limit,
                type    = "deny"
            });

            return(proc.Run());
        }
        public GetResponse <BusinessListActivityLog> GetBusiness_ActivityLog(Int64 _offset = 0, Int64 _limit = 200)
        {
            var proc = new FuncProcessor <GetResponse <BusinessListActivityLog> >("/entry.cgi", _session.sid, new
            {
                api     = "SYNO.ActiveBackup.Log",
                version = 1,
                method  = "list_log",
                offset  = _offset,
                limit   = _limit
            });

            return(proc.Run());
        }
        public GetResponse <Office365ListGeneralLog> GetOffice365_GeneralLog(Int64 _offset = 0, Int64 _limit = 200)
        {
            var proc = new FuncProcessor <GetResponse <Office365ListGeneralLog> >("/entry.cgi", _session.sid, new
            {
                api     = "SYNO.ActiveBackupOffice365",
                version = 1,
                method  = "get_general_log",
                offset  = _offset,
                limit   = _limit
            });

            return(proc.Run());
        }
Example #8
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            HashSet <string> extensions = new HashSet <string>();

            foreach (var(name, list) in Delegates)
            {
                var @delegate = list[0];
                if (string.IsNullOrEmpty(@delegate.Category) == false)
                {
                    foreach (var part in @delegate.Category.Split('|'))
                    {
                        extensions.Add(part);
                    }
                }
            }

            foreach (var(name, @enum) in Enums)
            {
                var match = Utilities.Extensions.Match(name);
                if (match.Index == 0 && match.Length != 0)
                {
                    extensions.Add(name);
                }
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor  = new DocProcessor(this);

            Enums    = enum_processor.Process(Enums, Profile, extensions);
            Wrappers = func_processor.Process(enum_processor, doc_processor, Delegates, Enums, Profile, Version);
        }
        public CloudSyncData GetConnList()
        {
            var proc = new FuncProcessor <GetResponse <CloudSyncData> >("/entry.cgi", _session.sid, new
            {
                api      = "SYNO.CloudSync",
                version  = 1,
                method   = "list_conn",
                node     = "module_root",
                group_by = "group_by_user",
                is_tray  = false
            });
            var obj = proc.Run();

            return(obj.data as CloudSyncData);
        }
        public GetResponse <DataTaskList> GetTaskList()
        {
            var proc = new FuncProcessor <GetResponse <DataTaskList> >("/entry.cgi", _session.sid, new
            {
                api        = "SYNO.Backup.Task",
                version    = 1,
                method     = "list",
                node       = "module_root",
                sort_by    = "name",
                additional = ""
                             // DSM uses this to request extra data in 1 query.
                             //"[\"last_bkp_time\",\"last_bkp_result\",\"get_source\",\"is_modified\",\"progress_title_type\"]"
            });

            return(proc.Run());
        }
        public GetResponse <Office365ListTaskLog> GetOffice365_TaskLog(DateTime startTime, DateTime endTime, Int64 _offset = 0, Int64 _limit = 10000)
        {
            var proc = new FuncProcessor <GetResponse <Office365ListTaskLog> >("/entry.cgi", _session.sid, new
            {
                api                  = "SYNO.ActiveBackupOffice365",
                version              = 1,
                method               = "list_task_logs",
                job_type             = 0,
                start_run_time       = GetUnixDateTimeSeconds(startTime),
                end_run_time         = GetUnixDateTimeSeconds(endTime),
                transfered_size_from = 0,
                offset               = _offset,
                limit                = _limit
            });

            return(proc.Run());
        }
Example #12
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            SpecReader.ReadEnums(overrides, Enums, Profile, Version);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);

            Enums    = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile, Version);
        }
        public GetResponse <ListVersionInfoList> GetVersions(Int64 taskId, string targetId, Int64 repoId, int _offset = 0, Int64 _limit = 50)
        {
            var proc = new FuncProcessor <GetResponse <ListVersionInfoList> >("/entry.cgi", _session.sid, new
            {
                api          = "SYNO.Backup.Version",
                version      = 2,
                method       = "list",
                offset       = _offset,
                limit        = _limit,
                filter_name  = "available",
                task_id      = taskId,
                repo_id      = repoId,
                target_id    = targetId,
                additional   = "[\"version_operate_property\"]",
                account_meta = "{\"scheduleRule\":\"unlimited\",\"versionDelete\":\"enable\",\"versionLock\":\"enable\",\"versionRotation\":\"custom\",\"statisticsDisplay\":\"all\",\"spaceUsage\":\"target\",\"quota\":0,\"expireTime\":0,\"planGroup\":\"\",\"planPeriod\":\"\",\"account\":\"\",\"isFresh\":false}"
            });

            return(proc.Run());
        }
        public GetResponse <BusinessListInfoList> GetBusiness_InfoList(DateTime startTime, DateTime endTime)
        {
            // did not wanted to include/use a library for json conversion
            var openTag    = "{";
            var closeTag   = "}";
            var jsonFilter = $"{openTag}\"time_start\":{GetUnixDateTimeSeconds(startTime)},\"time_end\":{GetUnixDateTimeSeconds(endTime)}{closeTag}";

            //var x = new { time_start = GetUnixDateTimeSeconds(startTime), time_end = GetUnixDateTimeSeconds(endTime) };
            //var jsonFilter = JsonConvert.SerializeObject(x);

            var proc = new FuncProcessor <GetResponse <BusinessListInfoList> >("/entry.cgi", _session.sid, new
            {
                api     = "SYNO.ActiveBackup.Overview",
                version = 1,
                method  = "list_result_status_summary",
                filter  = jsonFilter
            });

            return(proc.Run());
        }
        /* Not working - version list is not filled
         *
         * public GetResponse<BusinessTaskData2> GetBusiness_TaskList(int TaskId, int _offset=0, int _limit=50)
         * {
         *  // did not wanted to include/use a library for json conversion
         *  var openTag = "{";
         *  var closeTag = "}";
         *  var jsonFilter = $"{openTag}\"offset\":{_offset},\"limit\":{_limit},\"task_id\":{TaskId},\"data_formats\":[1,4]{closeTag}";
         *
         *  var proc = new FuncProcessor<GetResponse<BusinessTaskData2>>("/entry.cgi", _session.sid, new
         *  {
         *      api = "SYNO.ActiveBackup.Task",
         *      version = 1,
         *      method = "list",
         *      offset = _offset,
         *      limit = _limit,
         *      load_status = "true",
         *      load_result = "true",
         *      load_devices = "true",
         *      load_verify_status = "false",
         *      filter = jsonFilter
         *  });
         *  return proc.Run();
         * }
         *
         */



        public GetResponse <BusinessTaskData2> GetBusiness_TaskList(Enum_ActiveBackup_BackupType backupType)
        {
            // did not wanted to include/use a library for json conversion
            var openTag    = "{";
            var closeTag   = "}";
            var jsonFilter = $"{openTag}\"backup_type\":{(int)backupType}{closeTag}";

            var proc = new FuncProcessor <GetResponse <BusinessTaskData2> >("/entry.cgi", _session.sid, new
            {
                api          = "SYNO.ActiveBackup.Task",
                version      = 1,
                method       = "list",
                load_status  = "true",
                load_result  = "true",
                load_devices = "true",
                filter       = jsonFilter
            });

            return(proc.Run());
        }
Example #16
0
        public virtual void Process()
        {
            string overrides = Path.Combine(Settings.InputPath, Settings.OverridesFile);
            
            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            SpecReader.ReadEnums(overrides, Enums, Profile, Version);
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);

            Enums = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile, Version);
        }
Example #17
0
        public virtual void Process()
        {
            var overrides = Settings.OverridesFiles.SelectMany(GetFiles);

            GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
            CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));

            // Read enum signatures
            SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadEnums(file, Enums, Profile, Version);
            }

            // Read delegate signatures
            SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
            foreach (var file in overrides)
            {
                SpecReader.ReadDelegates(file, Delegates, Profile, Version);
            }

            var enum_processor = new EnumProcessor(this, overrides);
            var func_processor = new FuncProcessor(this, overrides);
            var doc_processor = new DocProcessor(this);

            Enums = enum_processor.Process(Enums, Profile);
            Wrappers = func_processor.Process(enum_processor, doc_processor,
                Delegates, Enums, Profile, Version);
        }