Search in sources :

Example 16 with CDatabase

use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.

the class CMain method main.

/**
   * Program entry function.
   *
   * @param args Command line parameters that were passed to the program.
   */
public static void main(final String[] args) {
    // ATTENTION: IF YOU'RE NOT READING THE CONFIG FILE FIRST YOU'RE PROBABLY DOING SOMETHING WRONG.
    CSettingsDirectoryCreator.createSettingsDirectory();
    final boolean firstStart = !CConfigurationFileCreator.setupConfigurationFile();
    BuildVersionInformation.loadBuildVersionInformation();
    // ESCA-JAVA0266:
    // ATTENTION: DO NOT MOVE THE LINE BELOW ABOVE THE CONFIG FILE STUFF
    // Don't remove this line, it actually works from inside JAR files
    System.out.printf("Starting %s%n", Constants.PROJECT_NAME_VERSION_BUILD);
    CGraphPanelExtender.extend();
    GuiInitializer.initialize();
    if (firstStart) {
        final CDatabase newDatabase = new CDatabase("Click and configure me", "org.postgresql.Driver", "localhost", "new_database", "user", "password", "identity", false, false);
        CDatabaseManager.instance().addDatabase(newDatabase);
    }
    prepareDatabaseConnections();
    final PluginRegistry pluginRegistry = new PluginRegistry();
    final String startPath = FileUtils.findLocalRootPath(CMain.class);
    Constants.startPath = startPath;
    NaviLogger.info("Defaulting startup path to %s", startPath);
    final CDatabaseManager databaseManager = CDatabaseManager.instance();
    final PluginInterface pluginInterface = PluginInterface.instance(startPath, databaseManager, pluginRegistry);
    final CProjectMainFrame window = new CProjectMainFrame(databaseManager, ConfigManager.instance(), firstStart);
    pluginInterface.setMainWindow(new MainWindow(window));
    pluginInterface.reloadPlugins();
    final CommandlineOptions options = CommandlineParser.parseCommandLine(args);
    if (options.getBatchPlugin() != null) {
        CBatchPluginExecuter.execute(options.getBatchPlugin(), pluginRegistry);
    }
    window.setVisible(true);
    GuiHelper.applyWindowFix(window);
}
Also used : CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) PluginRegistry(com.google.security.zynamics.binnavi.Plugins.PluginRegistry) PluginInterface(com.google.security.zynamics.binnavi.API.plugins.PluginInterface) MainWindow(com.google.security.zynamics.binnavi.API.gui.MainWindow) CDatabaseManager(com.google.security.zynamics.binnavi.Database.CDatabaseManager) CProjectMainFrame(com.google.security.zynamics.binnavi.Gui.MainWindow.CProjectMainFrame) CommandlineOptions(com.google.security.zynamics.binnavi.Startup.CommandlineOptions)

Example 17 with CDatabase

use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.

the class CPostgreSQLZyGraphTest2 method setUp.

@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, FileReadException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, CPartialLoadException, LoadCancelledException, MaybeNullException {
    ConfigManager.instance().read();
    final ZyGraphViewSettings settings = ConfigManager.instance().getDefaultFlowGraphSettings();
    settings.getProximitySettings().setProximityBrowsingActivationThreshold(50);
    settings.getProximitySettings().setProximityBrowsingChildren(2);
    settings.getProximitySettings().setProximityBrowsingParents(2);
    ConfigManager.instance().updateFlowgraphSettings(settings);
    final String[] parts = CConfigLoader.loadPostgreSQL();
    m_database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
    m_database2 = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
    m_database.connect();
    m_database.load();
    m_module = m_database.getContent().getModules().get(0);
    m_module.load();
    final INaviFunction function = m_module.getContent().getFunctionContainer().getFunction("sub_1002B87");
    m_view = (IFlowgraphView) m_module.getContent().getViewContainer().getView(function);
    m_view.load();
    m_graph = CGraphBuilder.buildGraph(m_view);
}
Also used : CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) Before(org.junit.Before)

Example 18 with CDatabase

use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.

the class CPostgreSQLDatabaseTest method setUp.

@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, LoadCancelledException {
    final String[] parts = CConfigLoader.loadPostgreSQL();
    m_database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_import", parts[1], parts[2], parts[3], false, false);
    m_database.connect();
    m_database.load();
}
Also used : CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) Before(org.junit.Before)

Example 19 with CDatabase

use of com.google.security.zynamics.binnavi.Database.CDatabase in project binnavi by google.

the class CPostgreSQLReilViewCreatorTest method setUp.

@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, LoadCancelledException {
    final String[] parts = CConfigLoader.loadPostgreSQL();
    m_database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_import", parts[1], parts[2], parts[3], false, false);
    m_database.connect();
    m_database.load();
}
Also used : CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) Before(org.junit.Before)

Aggregations

CDatabase (com.google.security.zynamics.binnavi.Database.CDatabase)19 Before (org.junit.Before)13 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)3 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)2 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)2 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)2 CDatabaseManager (com.google.security.zynamics.binnavi.Database.CDatabaseManager)2 SQLProvider (com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider)2 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)2 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)2 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 Tree (com.google.security.zynamics.zylib.types.trees.Tree)2 Field (java.lang.reflect.Field)2 Function (com.google.security.zynamics.binnavi.API.disassembly.Function)1 Instruction (com.google.security.zynamics.binnavi.API.disassembly.Instruction)1 View (com.google.security.zynamics.binnavi.API.disassembly.View)1 ViewContainer (com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)1 MainWindow (com.google.security.zynamics.binnavi.API.gui.MainWindow)1 PluginInterface (com.google.security.zynamics.binnavi.API.plugins.PluginInterface)1