예제 #1
0
파일: Form1.cs 프로젝트: gene71/CR.Core
        private void InitCRScanProject()
        {
            //create the project directory if it doesnt exist
            if (!Directory.Exists(projectDir))
            {
                Directory.CreateDirectory(projectDir);
            }

            FileLister fl    = new FileLister();
            var        files = fl.GetFiles(projectDir);

            if (files.Count == 0)
            {
                crScanproj            = new CRScanProject();
                crScanproj.CreateDate = DateTime.Now;
            }
            else
            {
                //add files to drop down
                foreach (var f in files)
                {
                    recentProjectToolStripMenuItem.DropDownItems.Add(f, null,
                                                                     new EventHandler(recentMenuItem_Click));
                }
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: gene71/CR.Core
 private void recentMenuItem_Click(object sender, EventArgs e)
 {
     crScanproj = CRScanProject.Load(sender.ToString());
     //set TextBoxes
     textBox2.Text = crScanproj.ReportDirectory;
     textBox1.Text = crScanproj.ScanDirectory;
     textBox3.Text = crScanproj.ProjectName;
 }
예제 #3
0
파일: CRScaner.cs 프로젝트: gene71/CR.Core
        public void Scan(CRScanProject crScanProj)
        {
            try
            {
                CRFac         crfac = new CRFac();
                List <CRFile> files = crfac.BuildCRFiles(crScanProj.ScanDirectory);
                fileReport(crScanProj.ReportDirectory, files, crScanProj.ProjectName);

                VulRecFac vrf = new VulRecFac();
                vulReport(crScanProj.ReportDirectory, vrf.GetVul(files), crScanProj.ProjectName);
            }
            catch (Exception ex)
            {
                throw new CRScanException(ex.Message);
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: gene71/CR.Core
        private void button3_Click(object sender, EventArgs e)
        {
            if (crScanproj == null)
            {
                crScanproj = new CRScanProject();
            }

            if (textBox1.Text == "")
            {
                MessageBox.Show("Enter a directory to scan", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (textBox2.Text == "")
            {
                MessageBox.Show("Enter a directory for report", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (textBox3.Text == "")
            {
                MessageBox.Show("Enter a name for the scan", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            //do the scan
            Cursor.Current             = Cursors.WaitCursor;
            crScanproj.ProjectName     = textBox3.Text;//make the object if null
            crScanproj.ScanDirectory   = textBox1.Text;
            crScanproj.ReportDirectory = textBox2.Text;
            crScanproj.Save(projectDir + "\\" + crScanproj.ProjectName + ".xml");
            CRScaner crs = new CRScaner();

            crs.Scan(crScanproj);
            Cursor.Current = Cursors.Default;
            MessageBox.Show("Scan Complete", "Info",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
            Process.Start("explorer.exe", textBox2.Text);
            Application.Exit();
        }