Ejemplo n.º 1
0
 private void populateTableWithMethodSignatureAndActionObjectId(String sDbId, String sVulnId,
                                                                String sActionObjectId)
 {
     OunceMySql.populateDataGridViewWithLddbData("rec", sDbId, "vuln_id", sVulnId, dgvLddb_rec);
     OunceMySql.populateDataGridViewWithLddbData("actionobjects", sDbId, "vuln_id", sVulnId, dgvLddb_actionobjects);
     if (dgvLddb_actionobjects.Rows.Count == 0)
     {
         //  if there are no actionObjects for this entry force the update (for example the case with taint propagators
         updateTablesWithRelatedActionObjectId();
     }
 }
        public void test_connectToDatabase()
        {
            Services_OunceV6.startService_MySql();
            // check that the connection is working
            Assert.That(OunceMySql.isConnectionOpen());

            // load config and recheck connectoin
            MySqlConfig.setMySqlConnectionDetailsFromAppConfig();
            Assert.That(OunceMySql.refreshDbConnection());
            Assert.That(OunceMySql.isConnectionOpen());
            // set up a bad pwd
            OunceMySql.MySqlLoginUsername = "******";
            Assert.That(false == OunceMySql.refreshDbConnection());

            // reload config and recheck connection
            MySqlConfig.setMySqlConnectionDetailsFromAppConfig();
            Assert.That(OunceMySql.refreshDbConnection());
        }
 public void testMySqlDetails(IStep step)
 {
     // run tasks on separate thread
     O2Thread.mtaThread(
         () => {
         step.append_Line("Trying to connect and loging to MySql server \r\n");
         if (OunceMySql.isConnectionOpen())
         {
             step.append_Line("ALL OK: Sucessfully connected to MySql database");
         }
         else
         {
             step.append_Line("ERROR!: It was not possible to connected to MySql database, check Log Viewer for error details");
         }
         step.append_Line("");
         step.append_Line("Test completed");
     });
 }
        public void showMySqlDetails(IStep step)
        {
            var message = String.Format("The Current MySql connection details are: {0} {0}" +
                                        "    Server IP: {2} {0}" +
                                        "    Server Port: {2} {0}" +
                                        "    UserName: {3} {0}" +
                                        "    Password: {4} {0}" +
                                        "{0} {0}" +
                                        "Connection String: {5}",
                                        Environment.NewLine,
                                        OunceMySql.MySqlServerIP,
                                        OunceMySql.MySqlServerPort,
                                        OunceMySql.MySqlLoginUsername,
                                        OunceMySql.MySqlLoginPassword,
                                        OunceMySql.getLddbConnectionString());

            step.set_Text(message);
        }
Ejemplo n.º 5
0
        private void updateTablesWithRelatedActionObjectId()
        {
            foreach (String sTableName in dLddbDataGridViews.Keys)
            {
                switch (sTableName)
                {
                case "stored_writeable_alias_info":
                case "taint_info":
                case "writes_through_info":
                    OunceMySql.populateDataGridViewWithLddbData(sTableName, lbCurrentMethodDbId.Text, "vuln_id",
                                                                lbSelectedMethodVulnId.Text,
                                                                dLddbDataGridViews[sTableName]);
                    break;

                case "actionobjects":
                case "rec":
                    break;

                case "validation_descriptor":
                    OunceMySql.populateDataGridViewWithLddbData(sTableName, lbCurrentMethodDbId.Text, "record_id",
                                                                lbSelectedMethodVulnId.Text,
                                                                dLddbDataGridViews[sTableName]);
                    break;

                default:
                    if (lbSelectedActionObjectId.Text != "")
                    {
                        populateDataGridViewWithTableMapppingToActionObjectId(sTableName,
                                                                              lbSelectedActionObjectId.Text);
                    }
                    else
                    {
                        dLddbDataGridViews[sTableName].Columns.Clear();
                    }
                    //               populateDataGridViewWithTableMapppingToActionObjectId(sTableName, "-1");            // query with no results
                    break;
                }
            }
        }
 public void refreshDgbWithExistingCallbacks()
 {
     OunceMySql.populateDataGridView_ExistentCallbacks(dgvCallbacksInLddbDatabase);
 }
Ejemplo n.º 7
0
 private void populateDataGridViewWithTableMapppingToActionObjectId(String sTableToSee, String sActionObjectId)
 {
     OunceMySql.populateDataGridViewWithLddbData(sTableToSee, "", "ao_id", sActionObjectId,
                                                 dLddbDataGridViews[sTableToSee]);
 }