示例#1
0
        public void EndTask(TaskFOCA t)
        {
            Invoke(new MethodInvoker(delegate
            {
                realizadas.BeginUpdate();
                realizadas.Items.Add(t.id.ToString(), "[" + t.id + "] " + t, 75);
                realizadas.EndUpdate();

                ejecucion.BeginUpdate();
                ejecucion.Items.RemoveByKey(t.id.ToString());
                ejecucion.EndUpdate();


                realizadas.Columns[0].Text = @"Finished tasks (" + realizadas.Items.Count + ")";
                ejecucion.Columns[0].Text  = @"Running tasks (" + ejecucion.Items.Count + ")";

                if (!bAutoScroll)
                {
                    return;
                }
                if (realizadas.Items.Count > 0)
                {
                    realizadas.EnsureVisible(realizadas.Items.Count - 1);
                }
            }));
        }
示例#2
0
        public void StartTask(TaskFOCA t)
        {
            Invoke(new MethodInvoker(delegate
            {
                ejecucion.BeginUpdate();
                ejecucion.Items.Add(t.id.ToString(), "[" + t.id + "] " + t, 75);
                ejecucion.EndUpdate();

                pendientes.BeginUpdate();
                pendientes.Items.RemoveByKey(t.id.ToString());
                pendientes.EndUpdate();

                ejecucion.Columns[0].Text  = @"Running tasks (" + ejecucion.Items.Count + @")";
                pendientes.Columns[0].Text = @"Queued tasks (" + pendientes.Items.Count + @")";

                if (!bAutoScroll)
                {
                    return;
                }
                if (ejecucion.Items.Count > 0)
                {
                    ejecucion.EnsureVisible(ejecucion.Items.Count - 1);
                }
            }));
        }
示例#3
0
        private void AddIpListAsync(object lstIpsObject)
        {
            var    lstIps = (List <string>)lstIpsObject;
            Thread tNewIp;


            object[] paramsAddNewIp;

            foreach (string ipNR in lstIps)
            {
                paramsAddNewIp = new object[] { ipNR, "Netrange", Program.cfgCurrent.MaxRecursion };
                tNewIp         = new Thread(AddIpAsync);
                TaskFOCA taskFoca = new TaskFOCA(tNewIp, paramsAddNewIp, "Add new IP [" + ipNR + "]");
                tasker.AddTask(taskFoca);
            }
        }
示例#4
0
        public void AddNewTask(TaskFOCA t)
        {
            Invoke(new MethodInvoker(delegate
            {
                pendientes.BeginUpdate();
                pendientes.Items.Add(t.id.ToString(), "[" + t.id + "] " + t, 75);
                pendientes.EndUpdate();

                pendientes.Columns[0].Text = @"Queued tasks (" + pendientes.Items.Count + @")";

                if (!bAutoScroll)
                {
                    return;
                }
                if (pendientes.Items.Count > 0)
                {
                    pendientes.EnsureVisible(pendientes.Items.Count - 1);
                }
            }));
        }
示例#5
0
        /// <summary>
        ///     Identifies a call and performs it
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FocaCall(object sender, EventArgs e)
        {
            var iObject = (ImportObject)sender;

            switch (iObject.operation)
            {
            case Import.Operation.AssociationDomainIp:
            {
                AddAssociationDomainIp((AssociationDomainIP)iObject.o);
            }
            break;

            case Import.Operation.AddDomain:
            {
                AddDomain(iObject.o.ToString());
            }
            break;

            case Import.Operation.AddIp:
            {
                AddIp(iObject.o.ToString());
            }
            break;

            case Import.Operation.AddUrl:
            {
                var url   = iObject.o.ToString();
                var error = false;
                try
                {
                    var uri    = new Uri(url);
                    var domain = Program.data.GetDomain(uri.Host);
                    if (domain == null)
                    {
                        Program.data.AddDomain(uri.Host, "Plugins", Program.cfgCurrent.MaxRecursion,
                                               Program.cfgCurrent);
                    }
                    else
                    {
                        domain = Program.data.GetDomain(uri.Host);
                        if (domain == null)
                        {
                            error = true;
                        }
                    }
                }
                catch
                {
                    error = true;
                }

                if (!error)
                {
                    var tAddUrl    = new Thread(AddUrlAsync);
                    var taskAddUrl = new TaskFOCA(tAddUrl, iObject.o, "[Plugin] Add url: " + url);
                    Program.data.tasker.AddTask(taskAddUrl);
                }
            }
            break;

            case Import.Operation.AddContextMenu:
            {
                switch (iObject.o)
                {
                case Global global:
                    lstContextGlobal.Add(global);
                    break;

                case ShowDomainsDomainItemMenu showDomainsDomainItem:
                    lstContextShowDomainsDomainItemMenu.Add(showDomainsDomainItem);
                    break;

                case ShowDomainsDomainMenu showDomainsDomainMenu:
                    lstContextShowDomainsDomainMenu.Add(showDomainsDomainMenu);
                    break;

                case ShowDomainsDomainRelatedDomainsItemMenu showDomainsDomainRelatedDomainsItemMenu:
                    lstContextShowDomainsDomainRelatedDomainsItemMenu.Add(showDomainsDomainRelatedDomainsItemMenu);
                    break;

                case ShowDomainsDomainRelatedDomainsMenu showDomainsDomainRelatedDomainsMenu:
                    lstContextShowDomainsDomainRelatedDomainsMenu.Add(showDomainsDomainRelatedDomainsMenu);
                    break;

                case ShowDomainsMenu showDomainsMenu:
                    lstContextShowDomainsMenu.Add(showDomainsMenu);
                    break;

                case ShowMetadataMenu showMetadataMenu:
                    lstContextShowMetadataMenu.Add(showMetadataMenu);
                    break;

                case ShowNetworkClientsItemMenu showNetworkClientsItemMenu:
                    lstContextShowNetworkClientsItemMenu.Add(showNetworkClientsItemMenu);
                    break;

                case ShowNetworkClientsMenu showNetworkClientsMenu:
                    lstContextShowNetworkClientsMenu.Add(showNetworkClientsMenu);
                    break;

                case ShowNetworkIpRangeMenu showNetworkIpRangeMenu:
                    lstContextShowNetworkIpRangeMenu.Add(showNetworkIpRangeMenu);
                    break;

                case ShowNetworkMenu showNetworkMenu:
                    lstContextShowNetworkMenu.Add(showNetworkMenu);
                    break;

                case ShowNetworkServersItemMenu showNetworkServersItemMenu:
                    lstContextShowNetworkServersItemMenu.Add(showNetworkServersItemMenu);
                    break;

                case ShowNetworkServersMenu showNetworkServersMenu:
                    lstContextShowNetworkServersMenu.Add(showNetworkServersMenu);
                    break;

                case ShowNetworkUnlocatedItemMenu showNetworkUnlocatedItemMenu:
                    lstContextShowNetworkUnlocatedItemMenu.Add(showNetworkUnlocatedItemMenu);
                    break;

                case ShowNetworkUnlocatedMenu showNetworkUnlocatedMenu:
                    lstContextShowNetworkUnlocatedMenu.Add(showNetworkUnlocatedMenu);
                    break;

                case ShowProjectMenu showProjectMenu:
                    lstContextShowProjectMenu.Add(showProjectMenu);
                    break;
                }
            }
            break;
            }
        }