예제 #1
0
파일: Utils.cs 프로젝트: hungud/kiddos
        public KiddosPocketEntity parseKiddosPocketStrXml(String kiddosPocketStrXml)
        {
            KiddosPocketEntity seedPocket = new KiddosPocketEntity();

            try
            {
                using (XmlReader reader = XmlReader.Create(new StringReader(kiddosPocketStrXml)))
                {
                    List <SeedEntity> seedLst = new List <SeedEntity>();
                    SeedEntity        seed    = null;
                    while (reader.Read())
                    {
                        if (reader.Name == "seed")
                        {
                            switch (reader.NodeType)
                            {
                            case XmlNodeType.Element:
                                seed          = new SeedEntity();
                                seed.method   = reader.GetAttribute("method");
                                seed.address  = reader.GetAttribute("address");
                                seed.domain   = reader.GetAttribute("domain");
                                seed.ip       = reader.GetAttribute("ip");
                                seed.mac      = reader.GetAttribute("mac");
                                seed.protocol = reader.GetAttribute("protocol");
                                try
                                {
                                    seed.randn = Int32.Parse(reader.GetAttribute("randn"));
                                }
                                catch (Exception)
                                {
                                    seed.randn = -1;
                                }

                                try
                                {
                                    seed.rands = Int32.Parse(reader.GetAttribute("rands"));
                                }
                                catch (Exception)
                                {
                                    seed.randn = -1;
                                }

                                seedLst.Add(seed);
                                break;
                            }
                        }
                    }


                    seedPocket.seedLst = seedLst;
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(seedPocket);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int nThreads = 0;
            int nTimes   = 0;

            try
            {
                nThreads = Int32.Parse(nThreadsTextBox.Text);
            }
            catch (Exception)
            { }

            try
            {
                nTimes = Int32.Parse(timesTextBox.Text);
            }
            catch (Exception)
            { }

            if (checkUiInput(urlsTextBox.Text, interfacesComboBox.SelectedIndex, nThreads, nTimes, ipSpoofCheckBox.Checked))
            {
                plantBt.Enabled = false;
                KiddieZooStatus = true;

                ClockThreadImpl clockImpl = new ClockThreadImpl(clockLabel, urlsTextBox.Text);
                Thread          clock     = new Thread(new ThreadStart(clockImpl.run));
                clock.Start();

                KiddosPocketEntity kde = Manager.Instance.getKiddosPocketEntityFromKiddosTrollerUrlStr(urlsTextBox.Text);

                List <SeedEntity> seedLst = kde.seedLst;

                for (int i = 0; i < seedLst.Count; i++)
                {
                    logTextBox.Text = seedLst[i].address;

                    for (int j = 0; j < nThreads; j++)
                    {
                        if (ipSpoofCheckBox.Checked)
                        {
                            runThreadSpoof(seedLst[i], j, nTimes, logTextBox, activeThreadsLabel, srLabel, urLabel, rdL, udL, interfacesComboBox.SelectedIndex, plantBt);
                        }
                        else
                        {
                            runThreadNoSpoof(seedLst[i], j, nTimes, logTextBox, activeThreadsLabel, srLabel, urLabel, rdL, udL, plantBt);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Error: Missing data. Check the input fields!");
            }
        }