All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.owasp.jbrofuzz.db.DBAdaptorFactory Maven / Gradle / Ivy

Go to download

JBroFuzz is a stateless web application fuzzer for requests being made over HTTP and/or HTTPS. Its purpose is to provide a single, portable application that offers stable web protocol fuzzing capabilities. As a tool, it emerged from the needs of penetration testing.

There is a newer version: 2.5.1
Show newest version
package org.owasp.jbrofuzz.db;

import java.io.File;

import org.owasp.jbrofuzz.JBroFuzz;
import org.owasp.jbrofuzz.system.Logger;
import org.owasp.jbrofuzz.version.JBroFuzzPrefs;

public class DBAdaptorFactory {
	private static DBAdaptor dbAdaptor;
	
	/**
	 * create DBAdaptor and choose dbHanlder based on prefence settings at time of creation
	 * @author [email protected]
	 * @since version 2.5
	 * @return DBApaptor -> Implements mehtod store(SessionDTO session);
	 */
	public static DBAdaptor getInstance(){
		if (JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[11].getId(), "").toLowerCase().trim().equals("couchdb")){
			if (dbAdaptor == null){
				dbAdaptor= new DBAdaptor(new CouchDBHandler());
			}
		}
		else{
			if (dbAdaptor == null){
				SQLiteHandler sqlH = new SQLiteHandler();
				try{
					String fileName = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[12].getId(), "") + ".db";
					File test = new File(fileName);
					if (!test.exists()){
						sqlH.setUpDB();
					}
					else{
						Logger.log("DB exists", 0);
					}
				}
				catch(Exception e){
					e.printStackTrace();
				}
				dbAdaptor = new DBAdaptor(sqlH);
			}
		}
		return dbAdaptor;
	}
	
	
	/**
	 *  set internal DBAdaptor to null - so next the db will be choosen based on the actual preference settings at time of creation
	 *  @author [email protected]
	 *  @since version 2.5
	 */
	public void resetDBAdaptor(){
		dbAdaptor = null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy