Example #1
0
        //后台执行仿真任务
        private void SimulationFormBgw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker          = sender as BackgroundWorker;
            TaskCommunicate  taskCommunicate = new TaskCommunicate(socketPort);

            taskCommunicate.communicate(worker, socketPort);
        }
Example #2
0
        //后台执行取证任务,弃用
        private void forensicFormBgw_DoWork(object sender, DoWorkEventArgs e)
        {
            string           filePath      = this.filePathText.Text;
            string           selectedItems = optionsOnEmulatorList.SelectedItems[0].Text;
            string           methodName    = MethodMapping(selectedItems);
            string           deviceName    = deviceNameText.Text;
            BackgroundWorker worker        = sender as BackgroundWorker;


            for (socketPort = 60000; socketPort < 65535; socketPort++)
            {
                if (!PortInUse(socketPort))
                {
                    break;
                }
            }

            if (socketPort == 65535)
            {
                MessageBox.Show("进度回传无可用端口!");
                return;
            }

            TaskCommunicate taskCommunicate = new TaskCommunicate(socketPort);


            Thread extrationThread = new Thread(new ParameterizedThreadStart(callCmd));

            extrationThread.Start("java -cp" + " " + @appiumProject_jarPath + " " + methodName + " " + @filePath + " " + "127.0.0.1 " + socketPort + " " + deviceName + " " + appiumPort);

            attachmentList = new List <string>();
            taskCommunicate.communicate(worker, socketPort);
        }
Example #3
0
        //开始取证按钮
        private void startForensicBtn_Click(object sender, EventArgs e)
        {
            string filePath = this.filePathText.Text;

            if ("".Equals(filePath))
            {
                MessageBox.Show("未选择取证数据保存路径!");
                return;
            }
            if (optionsOnEmulatorList.SelectedItems.Count > 1 || (optionsOnEmulatorList.SelectedItems.Count >= 1 && optionsOnPhoneList.SelectedItems.Count >= 1) || optionsOnPhoneList.SelectedItems.Count > 1)
            {
                MessageBox.Show("每次只能取证一个APP!");
                return;
            }
            if (optionsOnEmulatorList.SelectedItems.Count == 0 && optionsOnPhoneList.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择取证APP!");
                return;
            }

            if ("".Equals(deviceNameText.Text))
            {
                MessageBox.Show("未填写目标设备udid!");
                return;
            }

            string selectedItem = null;

            if (optionsOnEmulatorList.SelectedItems.Count == 1)
            {
                selectedItem = optionsOnEmulatorList.SelectedItems[0].Text;
            }
            else
            {
                selectedItem = optionsOnPhoneList.SelectedItems[0].Text;
            }

            downloadFileAppName = selectedItem;
            string methodName = MethodMapping(selectedItem);

            if (methodName == null)
            {
                MessageBox.Show("未找到该APP的取证函数!");
                return;
            }

            Random rd = new Random();

            appiumPort = rd.Next(4723, 65534);
            int num = 0;

            while (PortInUse(appiumPort))
            {
                if (num == 30)
                {
                    break;
                }
                appiumPort = rd.Next(4723, 65534);
                num++;
            }
            if (num == 30)
            {
                MessageBox.Show("appium无可用端口");
                return;
            }
            appiumPorts.Add(appiumPort);

            callCmd("appium -a 127.0.0.1 -p " + appiumPort);


            BackgroundWorker bgw = new BackgroundWorker();

            bgw.WorkerReportsProgress = true;
            bgw.DoWork += delegate
            {
                string deviceName = deviceNameText.Text;

                for (socketPort = 60000; socketPort < 65535; socketPort++)
                {
                    if (!PortInUse(socketPort))
                    {
                        break;
                    }
                }

                if (socketPort == 65535)
                {
                    MessageBox.Show("进度回传无可用端口!");
                    return;
                }

                TaskCommunicate taskCommunicate = new TaskCommunicate(socketPort);

                Thread extrationThread = new Thread(new ParameterizedThreadStart(callCmd));
                extrationThread.Start("java -cp" + " " + @appiumProject_jarPath + " " + methodName + " " + @filePath + " " + "127.0.0.1 " + socketPort + " " + deviceName + " " + appiumPort);

                attachmentList = new List <string>();
                taskCommunicate.communicate(bgw, socketPort);
            };

            bgw.RunWorkerAsync();
            ProgressBarForm progressBarForm = new ProgressBarForm(bgw);

            progressBarForm.setAppiumPort(appiumPort);
            progressBarForm.Show(this);
        }
Example #4
0
        //从本地文件仿真按钮
        private void simulationFromFile_Click(object sender, EventArgs e)
        {
            string selectADBText          = this.selectADBText.Text;
            string selectFileSavePathText = this.selectFileSavePathText.Text;
            string devicePort             = this.devicePortText.Text;

            if (optionsOnEmulatorList.SelectedItems.Count > 1 || (optionsOnEmulatorList.SelectedItems.Count >= 1 && optionsOnPhoneList.SelectedItems.Count >= 1) || optionsOnPhoneList.SelectedItems.Count > 1)
            {
                MessageBox.Show("每次只能仿真一个APP!");
                return;
            }
            if (optionsOnEmulatorList.SelectedItems.Count == 0 && optionsOnPhoneList.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择仿真APP!");
                return;
            }

            if (optionsOnPhoneList.SelectedItems.Count == 1)
            {
                MessageBox.Show("该APP无法从手机仿真到模拟器上!");
                return;
            }

            if ("".Equals(selectADBText))
            {
                MessageBox.Show("未选择ADB路径!");
                return;
            }
            if ("".Equals(selectFileSavePathText))
            {
                MessageBox.Show("未选择仿真数据保存路径!");
                return;
            }

            string selectAPP = optionsOnEmulatorList.SelectedItems[0].Text;

            if ("".Equals(devicePort))
            {
                MessageBox.Show("未填写设备端口");
                return;
            }

/*            this.SimulationFormBgw.RunWorkerAsync();
 *          ProgressBarForm progressBarForm = new ProgressBarForm(this.SimulationFormBgw);
 *
 *          progressBarForm.Show(this);*/

            //////////////////////////////////////
            BackgroundWorker bgw = new BackgroundWorker();

            bgw.WorkerReportsProgress = true;
            bgw.DoWork += delegate
            {
                string deviceName = deviceNameText.Text;

                for (socketPort = 60000; socketPort < 65535; socketPort++)
                {
                    if (!PortInUse(socketPort))
                    {
                        break;
                    }
                }

                if (socketPort == 65535)
                {
                    MessageBox.Show("进度回传无可用端口!");
                    return;
                }

                TaskCommunicate taskCommunicate = new TaskCommunicate(socketPort);

                Thread extrationThread = new Thread(new ParameterizedThreadStart(callCmd));
                extrationThread.Start("java -jar" + " " + @simulationFromFile_jarPath + " " + selectAPP + " " + selectADBText + " " + selectFileSavePathText + " " + devicePort + " " + socketPort);

                taskCommunicate.communicate(bgw, socketPort);
            };

            bgw.RunWorkerAsync();
            ProgressBarForm progressBarForm = new ProgressBarForm(bgw);

            progressBarForm.Show(this);
        }