Пример #1
0
 public String[] executeQuery(String sql) {
   if (dbHandler.getClass().getName().equals(CouchDBHandler.class)) {
     Logger.log("TODO: reading form CouchDB", 3);
   } else {
     SQLiteHandler sqlH = (SQLiteHandler) dbHandler;
     Connection conn =
         sqlH.getConnection(JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), ""));
     return sqlH.executeQuery(conn, sql);
   }
   return null;
 }
Пример #2
0
  /**
   * @author [email protected]
   * @since version 2.5
   * @param fileName
   * @return MessageContainer - content read from db
   */
  public Vector<MessageContainer> read(String fileName, String sessionId, JBroFuzzWindow mWindow) {
    Vector<MessageContainer> mcv = new Vector<MessageContainer>();

    if (dbHandler.getClass().getName().equals(CouchDBHandler.class)) {
      Logger.log("TODO: reading from CouchDB", 0);
    } else {
      SQLiteHandler sqlH = (SQLiteHandler) dbHandler;
      String dbName = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "");
      Connection conn = sqlH.getConnection(dbName);

      mcv = sqlH.read(conn, sessionId, fileName, mWindow.getPanelFuzzing());
    }
    return mcv;
  }
Пример #3
0
  /**
   * @author [email protected]
   * @param session SessionDTO - containing sessionData to be stored
   * @return returnCode int - 0 == OK | 1 == failed.
   */
  public int store(MessageContainer outputMessage, String sessionName) {
    String dbName = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "");
    int returnCode = 0;

    if (dbHandler.getClass().getName().equals(CouchDBHandler.class)) {
      Logger.log("Storing to CouchDB", 0);
      CouchDBMapper couchMapper = new CouchDBMapper();
      JSONObject document = couchMapper.toCouch2(outputMessage);
      returnCode = ((CouchDBHandler) dbHandler).store(dbName, "", document);
    } else {
      SQLiteHandler sqlH = (SQLiteHandler) dbHandler;
      try {
        Connection conn = sqlH.getConnection(dbName);
        if (conn == null) Logger.log("Connection = null", 0);
        returnCode = sqlH.store(outputMessage, conn, sessionName);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    return returnCode;
  }