Exemple #1
0
            public Task <PPosition> PreparePositionsAsync(PScan scanns)
            {
                var result = new PPosition()
                {
                    Positions = new PreparedPosition[this.parent.MaxShips * scanns.Scanns.Length]
                };

                return(Task.Run(() =>
                {
                    Parallel.For(0, result.Positions.Length, index =>
                    {
                        var i = index / scanns.Scanns.Length;
                        var j = index % scanns.Scanns.Length;
                        BigInteger value;
                        if (i < this.position.Length)
                        {
                            var cryptoNode = this.parent.prototypeLookup[this.position[i]].TrueNode;
                            value = cryptoNode.Scan.Position(scanns.Scanns[j].Value);
                        }
                        else
                        {
                            value = Generate.Random(this.parent.Prime);
                        }

                        //for (int j = 0; j < scanns.Scanns.Length; j++)
                        result.Positions[i * scanns.Scanns.Length + j] = new PreparedPosition()
                        {
                            Value = value, Index = j
                        };
                    });
                    return result;
                }));
            }
Exemple #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     Hotspot(null, null, false);
     sercher.Abort();
     PScan.Abort();
     Application.Exit();
 }
Exemple #3
0
            public Task <PScan> PrepareForPropeAsync(IEnumerable <Mapping.Node <TNode, TEdged> > ownPositions, IEnumerable <Mapping.Node <TNode, TEdged> > positionsToProbe)
            {
                (var blendFactor, var inverseBlendfactor) = Generate.InversableExponent(this.parent.Prime);
                this.position = ownPositions.ToArray();
                this.toProbe  = positionsToProbe.ToArray();
                var result = new PScan()
                {
                    Scanns = new PreparedScan[parent.MaxShips], BlendFactor = blendFactor
                };

                if (this.position.Length > this.parent.MaxShips)
                {
                    throw new ArgumentOutOfRangeException("To many Positions");
                }
                return(Task.Run(() =>
                {
                    Parallel.For(0, result.Scanns.Length, i =>
                    {
                        if (i < this.toProbe.Length)
                        {
                            var node = this.toProbe[i];
                            var cryptoNode = this.parent.prototypeLookup[node];
                            result.Scanns[i] = new PreparedScan()
                            {
                                Value = cryptoNode.TrueNode.Scan.Prepare(blendFactor, inverseBlendfactor)
                            };
                        }
                        else
                        {
                            result.Scanns[i] = new PreparedScan()
                            {
                                Value = Zelos.Common.Crypto.Generate.Random(parent.Prime)
                            }
                        };
                    });
                    return result;
                }));
            }
 private void InitializeApiObjects()
 {
     //New API needs to be instantiated here, in the same alphabetical order as above
     Acsrf             = new Acsrf(this);
     AjaxSpider        = new AjaxSpider(this);
     Alert             = new Generated.Alert(this);
     AlertFilter       = new AlertFilter(this);
     Ascan             = new Ascan(this);
     Authentication    = new Authentication(this);
     Authorization     = new Authorization(this);
     AutoUpdate        = new AutoUpdate(this);
     Brk               = new Break(this);
     Context           = new Context(this);
     Core              = new Core(this);
     ForcedUser        = new ForcedUser(this);
     HttpSessions      = new HttpSessions(this);
     ImportLogFiles    = new ImportLogFiles(this);
     ImportUrls        = new ImportUrls(this);
     LocalProxies      = new LocalProxies(this);
     OpenApi           = new OpenApi(this);
     Parameters        = new Params(this);
     Pnh               = new Pnh(this);
     PScan             = new PScan(this);
     Replacer          = new Replacer(this);
     Reveal            = new Reveal(this);
     RuleConfig        = new RuleConfig(this);
     Script            = new Script(this);
     Search            = new Search(this);
     Selenium          = new Selenium(this);
     SessionManagement = new SessionManagement(this);
     Soap              = new Soap(this);
     Spider            = new Spider(this);
     Stats             = new Stats(this);
     Users             = new Users(this);
     Websocket         = new Websocket(this);
 }