Пример #1
0
        /// <summary>
        /// Creates a new dns server instance
        /// </summary>
        /// <param name="bindAddress">The address, on which should be listend</param>
        /// <param name="udpListenerCount">The count of threads listings on udp, 0 to deactivate udp</param>
        /// <param name="tcpListenerCount">The count of threads listings on tcp, 0 to deactivate tcp</param>
        /// <param name="processQuery">Method, which process the queries and returns the response</param>
        public DnsServer(IPAddress bindAddress, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
        {
            _bindAddress = bindAddress;
            _processQueryDelegate = processQuery;

            _udpListenerCount = udpListenerCount;
            _tcpListenerCount = tcpListenerCount;
        }
Пример #2
0
        public ResponseResult <List <Role> > QueryProcessRoles([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <List <Role> > .Default();

            try
            {
                var wfService = new WorkflowService();
                var roleList  = wfService.GetRoleByProcess(query.ProcessGUID, query.Version).ToList();
                result = ResponseResult <List <Role> > .Success(roleList);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <List <Role> > .Error(ex.Message);
            }
            return(result);
        }
Пример #3
0
        public ResponseResult <ProcessEntity> GetProcess([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                var wfService = new WorkflowService();
                var entity    = wfService.GetProcessUsing(query.ProcessGUID);

                result = ResponseResult <ProcessEntity> .Success(entity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(LocalizeHelper.GetDesignerMessage("wf2xmlcontroller.queryprocess.error", ex.Message));
            }
            return(result);
        }
Пример #4
0
        public ResponseResult <List <Role> > QueryProcessRoleUserList([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <List <Role> > .Default();

            try
            {
                var wfService = new WorkflowService();
                var roleList  = wfService.GetRoleUserListByProcess(query.ProcessGUID, query.Version).ToList();
                result = ResponseResult <List <Role> > .Success(roleList, "成功获取流程定义的角色用户数据!");
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <List <Role> > .Error(string.Format(
                                                                  "获取流程定义的角色用户数据失败, 异常信息:{0}",
                                                                  ex.Message));
            }
            return(result);
        }
Пример #5
0
        public ResponseResult <ProcessEntity> GetProcess([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                var wfService = new WorkflowService();
                var entity    = wfService.GetProcess(query.ProcessGUID);

                result = ResponseResult <ProcessEntity> .Success(entity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(
                    string.Format("获取流程基本信息失败!{0}", ex.Message)
                    );
            }
            return(result);
        }
Пример #6
0
        public ResponseResult <ProcessEntity> GetProcessByVersion([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <ProcessEntity> .Default();

            try
            {
                var wfService = new WorkflowService();
                var entity    = wfService.GetProcessByVersion(query.ProcessGUID, query.Version);

                result = ResponseResult <ProcessEntity> .Success(entity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <ProcessEntity> .Error(
                    string.Format("An error occurred when reading process by version!{0}", ex.Message)
                    );
            }
            return(result);
        }
Пример #7
0
        public ResponseResult <List <ActivityEntity> > GetAllTaskActivityList([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <List <ActivityEntity> > .Default();

            try
            {
                var wfService = new WorkflowService();
                var entity    = wfService.GetAllTaskActivityList(query.ProcessGUID, query.Version).ToList();

                result = ResponseResult <List <ActivityEntity> > .Success(entity);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <List <ActivityEntity> > .Error(
                    string.Format("An error occurred when reading taskview list!{0}", ex.Message)
                    );
            }
            return(result);
        }
Пример #8
0
        public ResponseResult <List <Role> > QueryProcessRoles([FromBody] ProcessQuery query)
        {
            var result = ResponseResult <List <Role> > .Default();

            try
            {
                var wfService = new WorkflowService();
                var roleList  = wfService.GetRoleByProcess(query.ProcessGUID, query.Version).ToList();
                var roleQuery = (from r in roleList
                                 select new Role
                {
                    ID = r.ID,
                    RoleName = string.Format("{0}({1})", r.RoleName, r.RoleCode)
                });
                var list = roleQuery.ToList();
                result = ResponseResult <List <Role> > .Success(list);
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <List <Role> > .Error(ex.Message);
            }
            return(result);
        }
Пример #9
0
        static void Main(string[] args)
        {
            /*const string kernel32dump = "..\\..\\..\\..\\basicwindow32_kernel32.bin";
             * if (!File.Exists(kernel32dump))
             * {
             *  Console.WriteLine("Can't load file {0:s}", kernel32dump);
             *  return;
             * }
             * var kernel32mem = File.ReadAllBytes(kernel32dump);
             * var peFile = PeParser.ParseFromMem(kernel32mem);*/


            Process dummy = ProcessQuery.OpenProcessByName("BasicWindow32.exe");

            var dll = new InjectedDll("C:\\Users\\User\\source\\repos\\H4xbr1x\\H4xbr1xDemo\\hl1dll32.dll", dummy);

            dll.Inject();

            Console.ReadLine();

            Console.WriteLine("Unloading DLL");

            dll.UnInject();
        }
Пример #10
0
        public ResponseResult DeleteInstance([FromBody] ProcessQuery query)
        {
            var result    = ResponseResult.Default();
            var wfService = new WorkflowService();

            try
            {
                var isOK = wfService.DeleteInstanceInt(query.ProcessGUID, query.Version);

                if (isOK == true)
                {
                    result = ResponseResult.Success("已经成功删除!");
                }
                else
                {
                    result = ResponseResult.Error("删除失败,或者记录已经为空!");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(ex.Message);
            }
            return(result);
        }
Пример #11
0
        /// <summary>
        ///   Creates a new dns server instance
        /// </summary>
        /// <param name="bindEndPoint"> The endpoint, on which should be listend </param>
        /// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
        /// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
        /// <param name="processQuery"> Method, which process the queries and returns the response </param>
        public DnsServer(IPEndPoint bindEndPoint, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
        {
            _bindEndPoint         = bindEndPoint;
            _processQueryDelegate = processQuery;

            _udpListenerCount = udpListenerCount;
            _tcpListenerCount = tcpListenerCount;

            Timeout = 120000;
        }
Пример #12
0
 /// <summary>
 ///   Creates a new dns server instance
 /// </summary>
 /// <param name="bindAddress"> The address, on which should be listend </param>
 /// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
 /// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
 /// <param name="processQuery"> Method, which process the queries and returns the response </param>
 public DnsServer(IPAddress bindAddress, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
     : this(new IPEndPoint(bindAddress, _DNS_PORT), udpListenerCount, tcpListenerCount, processQuery)
 {
 }
Пример #13
0
 /// <summary>
 ///   Creates a new dns server instance which will listen on all available interfaces
 /// </summary>
 /// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
 /// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
 /// <param name="processQuery"> Method, which process the queries and returns the response </param>
 public DnsServer(int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
     : this(IPAddress.Any, udpListenerCount, tcpListenerCount, processQuery)
 {
 }
Пример #14
0
 public ProcessHandler(ProcessQuery processQuery, IGlobalStoreManager globalStore)
 {
     GlobalStore       = globalStore;
     this.processQuery = processQuery;
 }
 public ProcessesController(ProcessQuery processQuery, ProcessHandler processHandler)
 {
     this.processHandler = processHandler;
     this.processQuery   = processQuery;
 }
Пример #16
0
		/// <summary>
		///   Creates a new dns server instance which will listen on all available interfaces
		/// </summary>
		/// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
		/// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
		/// <param name="processQuery"> Method, which process the queries and returns the response </param>
		public DnsServer(int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
			: this(IPAddress.Any, udpListenerCount, tcpListenerCount, processQuery) {}
Пример #17
0
 public DBUpdateService(ElasticClientFactory clientFactory, IndexQuery indexQuery, IQueryFactory queryFactory,
                        ILoggerFactory loggerFactory, MetadataQuery metadataQuery, ServiceQuery serviceQuery, ProcessQuery processQuery,
                        ServiceManager serviceManager)
 {
     this.serviceManager = serviceManager;
     this.processQuery   = processQuery;
     this.serviceQuery   = serviceQuery;
     this.metadataQuery  = metadataQuery;
     this.queryFactory   = queryFactory;
     this.indexQuery     = indexQuery;
     this.clientFactory  = clientFactory;
     this.logger         = loggerFactory.CreateLogger <DBUpdateService>();
 }
Пример #18
0
        /// <summary>
        /// Creates a new DNS server instance.
        /// </summary>
        /// <param name="bindEndPoint">The endpoint, on which should be listend.</param>
        /// <param name="udpListenerCount">The count of threads listings on udp, 0 to deactivate udp.</param>
        /// <param name="tcpListenerCount">The count of threads listings on tcp, 0 to deactivate tcp.</param>
        /// <param name="processQuery">Method, which process the queries and returns the response.</param>
        public DnsServer(IPEndPoint bindEndPoint, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
        {
            this.bindEndPoint = bindEndPoint;
            this.processQueryDelegate = processQuery;

            this.udpListenerCount = udpListenerCount;
            this.tcpListenerCount = tcpListenerCount;

            this.Timeout = 120000;
        }
Пример #19
0
 public void Register <TMessage>(IMessageContextModelManager ctxModelManager, ProcessQuery processQuery)
 {
 }
Пример #20
0
        /// <summary>
        /// Creates a new dns server instance
        /// </summary>
        /// <param name="bindAddress">The address, on which should be listend</param>
        /// <param name="udpListenerCount">The count of threads listings on udp, 0 to deactivate udp</param>
        /// <param name="tcpListenerCount">The count of threads listings on tcp, 0 to deactivate tcp</param>
        /// <param name="processQuery">Method, which process the queries and returns the response</param>
        public DnsServer(IPAddress bindAddress, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
        {
            _bindAddress          = bindAddress;
            _processQueryDelegate = processQuery;

            _udpListenerCount = udpListenerCount;
            _tcpListenerCount = tcpListenerCount;
        }
Пример #21
0
 public void Register <TMessage>(LoadContextModel load, ProcessQuery processQuery, UpdateContextModel update)
 {
     _broadcast.Subscribe(update);
     _pipelines[typeof(TMessage)] = new QueryPipeline(load, processQuery);
 }
Пример #22
0
        public IHttpActionResult GetHandlings(string token, int page = 0, int total = 0, DateTime?dFrom = null, DateTime?dTo = null, string query = null, string length = null, string status = null)
        {
            if (token != null && token.Length > 0)
            {
                var tenants = db.JDE_Tenants.Where(t => t.TenantToken == token.Trim());
                if (tenants.Any())
                {
                    if (dFrom == null)
                    {
                        if (db.JDE_Handlings.Any())
                        {
                            dFrom = db.JDE_Handlings.Min(x => x.StartedOn).Value.AddDays(-1);
                        }
                        else
                        {
                            dFrom = new DateTime(2018, 1, 1);
                        }
                    }
                    if (dTo == null)
                    {
                        if (db.JDE_Handlings.Any())
                        {
                            dTo = db.JDE_Handlings.Max(x => x.StartedOn).Value.AddDays(1);
                        }
                        else
                        {
                            dTo = new DateTime(2030, 12, 31);
                        }
                    }

                    var items = (from h in db.JDE_Handlings
                                 join u in db.JDE_Users on h.UserId equals u.UserId
                                 join t in db.JDE_Tenants on h.TenantId equals t.TenantId
                                 join prs in db.JDE_Processes on h.ProcessId equals prs.ProcessId into processes
                                 from p in processes.DefaultIfEmpty()
                                 join at in db.JDE_ActionTypes on p.ActionTypeId equals at.ActionTypeId
                                 join pl in db.JDE_Places on p.PlaceId equals pl.PlaceId
                                 join s in db.JDE_Sets on pl.SetId equals s.SetId
                                 join a in db.JDE_Areas on pl.AreaId equals a.AreaId
                                 where h.TenantId == tenants.FirstOrDefault().TenantId&& h.StartedOn >= dFrom && h.StartedOn <= dTo
                                 orderby h.StartedOn descending
                                 select new Handling
                    {
                        HandlingId = h.HandlingId,
                        ProcessId = (int)h.ProcessId,
                        StartedOn = h.StartedOn,
                        FinishedOn = h.FinishedOn,
                        UserId = u.UserId,
                        UserName = u.Name + " " + u.Surname,
                        ActionTypeId = p.ActionTypeId,
                        ActionTypeName = at.Name,
                        IsActive = h.IsActive,
                        IsFrozen = h.IsFrozen,
                        IsCompleted = h.IsCompleted,
                        PlaceId = p.PlaceId,
                        PlaceName = pl.Name,
                        SetId = pl.SetId,
                        SetName = s.Name,
                        AreaId = pl.AreaId,
                        AreaName = a.Name,
                        Output = h.Output,
                        TenantId = p.TenantId,
                        TenantName = t.TenantName
                    });
                    if (items.Any())
                    {
                        if (query != null)
                        {
                            if (query.IndexOf("Length") >= 0 || query.IndexOf("Status") >= 0)
                            {
                                ProcessQuery pq = new ProcessQuery(query);
                                length = pq.Length;
                                status = pq.Status;
                                query  = pq.Query;
                            }
                            if (!string.IsNullOrEmpty(query))
                            {
                                items = items.Where(query);
                            }
                        }
                        if (!string.IsNullOrEmpty(length) || !string.IsNullOrEmpty(status))
                        {
                            List <IProcessable> nItems = items.ToList <IProcessable>();
                            if (!string.IsNullOrEmpty(length))
                            {
                                nItems = Static.Utilities.FilterByLength(nItems, length);
                            }
                            if (!string.IsNullOrEmpty(status))
                            {
                                nItems = Static.Utilities.FilterByStatus(nItems, status);
                            }

                            if (total == 0 && page > 0)
                            {
                                int pageSize = RuntimeSettings.PageSize;
                                var skip     = pageSize * (page - 1);
                                if (skip < nItems.Count())
                                {
                                    nItems = nItems.Skip(skip).Take(pageSize).ToList();
                                    return(Ok(nItems));
                                }
                                else
                                {
                                    return(NotFound());
                                }
                            }
                            else if (total > 0 && page == 0)
                            {
                                nItems = nItems.Take(total).ToList();
                                return(Ok(nItems));
                            }
                            else
                            {
                                return(Ok(nItems));
                            }
                        }
                        else
                        {
                            if (total == 0 && page > 0)
                            {
                                int pageSize = RuntimeSettings.PageSize;
                                var skip     = pageSize * (page - 1);
                                if (skip < items.Count())
                                {
                                    items = items.Skip(skip).Take(pageSize);
                                    return(Ok(items));
                                }
                                else
                                {
                                    return(NotFound());
                                }
                            }
                            else if (total > 0 && page == 0)
                            {
                                items = items.Take(total);
                                return(Ok(items));
                            }
                            else
                            {
                                return(Ok(items));
                            }
                        }
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(NotFound());
            }
        }
Пример #23
0
        public IActionResult Delete(string id, [FromServices] IServiceProvider serviceProvider, [FromServices] ProcessQuery processQuery)
        {
            var service = serviceQuery.Get(id);

            if (service == null)
            {
                return(new StatusCodeResult(StatusCodes.Status404NotFound));
            }

            switch (service.Type)
            {
            case (int)ServiceTypeEnum.Classifier:
                var classifierHandler = serviceProvider.GetService <ClassifierServiceHandler>();
                classifierHandler.Delete(service);
                serviceQuery.DeleteSettings <ClassifierSettingsElastic>(service.Id);
                break;

            case (int)ServiceTypeEnum.Prc:
                var prcHandler = serviceProvider.GetService <PrcServiceHandler>();
                prcHandler.Delete(service);
                serviceQuery.DeleteSettings <PrcSettingsElastic>(service.Id);
                break;

            case (int)ServiceTypeEnum.Search:
                var searchHandler = serviceProvider.GetService <SearchServiceHandler>();
                searchHandler.Delete(service);
                serviceQuery.DeleteSettings <SearchSettingsWrapperElastic>(service.Id);
                break;
            }

            serviceQuery.Delete(service);

            GlobalStore.ServiceAliases.Remove(service.Alias);

            if (service.ProcessIdList != null)
            {
                processQuery.Delete(service.ProcessIdList);
            }

            return(new StatusCodeResult(StatusCodes.Status200OK));
        }
Пример #24
0
		/// <summary>
		///   Creates a new dns server instance
		/// </summary>
		/// <param name="bindEndPoint"> The endpoint, on which should be listend </param>
		/// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
		/// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
		/// <param name="processQuery"> Method, which process the queries and returns the response </param>
		public DnsServer(IPEndPoint bindEndPoint, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
		{
			_bindEndPoint = bindEndPoint;
			_processQueryDelegate = processQuery;

			_udpListenerCount = udpListenerCount;
			_tcpListenerCount = tcpListenerCount;

			Timeout = 120000;
		}
Пример #25
0
		/// <summary>
		///   Creates a new dns server instance
		/// </summary>
		/// <param name="bindAddress"> The address, on which should be listend </param>
		/// <param name="udpListenerCount"> The count of threads listings on udp, 0 to deactivate udp </param>
		/// <param name="tcpListenerCount"> The count of threads listings on tcp, 0 to deactivate tcp </param>
		/// <param name="processQuery"> Method, which process the queries and returns the response </param>
		public DnsServer(IPAddress bindAddress, int udpListenerCount, int tcpListenerCount, ProcessQuery processQuery)
			: this(new IPEndPoint(bindAddress, _DNS_PORT), udpListenerCount, tcpListenerCount, processQuery) {}
Пример #26
0
 public QueryPipeline(LoadContextModel load, ProcessQuery process)
 {
     _load    = load;
     _process = process;
 }
        public static void Main(string[] args)
        {
            if (4 != args.Length || "'".Equals(args[3]) || !args[3].StartsWith("'") || !args[3].EndsWith("'"))
            {
                Console.WriteLine($"Usage: {System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name} <apidomain> <httpbasicauthstring> <realm> '<simplesearchexpression>'");
            }
            else
            {
                string apiDomain           = args[0];
                string httpBasicAuthString = args[1];
                string realm = args[2];
                string rawSearchExpression = args[3].Trim('\'');

                Uri upstreamServerUrl = new Uri($"https://{apiDomain}");

                using (CtmsRegistryClient registryClient = new CtmsRegistryClient(new OAuth2AuthorizationConnection(upstreamServerUrl, httpBasicAuthString)))
                {
                    const string      registeredLinkRelOrchestrationRoot = "orchestration:orchestration";
                    const string      orchestrationServiceType           = "avid.orchestration.ctc";
                    OrchestrationRoot orchestrationRootResource          = PlatformTools.PlatformToolsSDK.FindInRegistry <OrchestrationRoot>(registryClient, orchestrationServiceType, realm, registeredLinkRelOrchestrationRoot);

                    if (null != orchestrationRootResource)
                    {
                        const string registeredLinkRelOrchestrationProcessQuery = "orchestration:process-query";
                        Link         orchestrationProcessQueryLink = orchestrationRootResource.DiscoverLink(registeredLinkRelOrchestrationProcessQuery);
                        if (null != orchestrationProcessQueryLink)
                        {
                            UriTemplate orchestrationProcessQueryUriTemplate = new UriTemplate(orchestrationProcessQueryLink.Href);
                            orchestrationProcessQueryUriTemplate.SetParameter("offset", 0);
                            orchestrationProcessQueryUriTemplate.SetParameter("limit", 50);

                            string orchestrationProcessQueryUri = orchestrationProcessQueryUriTemplate.Resolve();

                            /// Create the process query:
                            string       queryExpression = $"<query version='1.0'><search><quick>{rawSearchExpression}</quick></search></query>";
                            JObject      query           = new JObject(new JProperty("query", queryExpression));
                            ProcessQuery result          = registryClient.SendHal <ProcessQuery>(HttpMethod.Post, new Uri(orchestrationProcessQueryUri), query);

                            int assetNo = 0;
                            int pageNo  = 0;
                            /// Page through the result:
                            StringBuilder sb = new StringBuilder();
                            do
                            {
                                sb.AppendLine($"Page#: {++pageNo}, search expression: '{rawSearchExpression}'");
                                foreach (Process processInstance in result.ResourceList)
                                {
                                    string id   = processInstance.Base.Id;
                                    string name = processInstance.Common.Name;

                                    sb.AppendLine($"ProcessItem#: {++assetNo}, id: {id}, name: '{name}'");
                                }

                                // If we have more results, follow the next link and get the next page:
                                result = registryClient.GetHalResource <ProcessQuery>(result.GetUri("next", Enumerable.Empty <EmbedResource>()));
                            }while (result != null);
                            Console.WriteLine(sb);
                        }
                        else
                        {
                            Console.WriteLine("ProcessQuery not supported.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Orchestration not supported.");
                    }
                }
                Console.WriteLine("End");
            }
        }
Пример #28
0
 public ServiceManager(ServiceQuery serviceQuery, IServiceProvider serviceProvider, ProcessQuery processQuery,
                       ProcessHandler processHandler, IGlobalStoreManager globalStore, DataSetService dataSetService,
                       ILogger <ServiceManager> logger, PrcServiceHandler prcServiceHandler, PrcIndexServiceHandler prcIndexServiceHandler)
 {
     this.prcIndexServiceHandler = prcIndexServiceHandler;
     this.prcServiceHandler      = prcServiceHandler;
     this.logger          = logger;
     this.dataSetService  = dataSetService;
     GlobalStore          = globalStore;
     this.processHandler  = processHandler;
     this.processQuery    = processQuery;
     this.serviceProvider = serviceProvider;
     this.serviceQuery    = serviceQuery;
 }