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

org.owasp.jbrofuzz.graph.utils.DBWalker 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.graph.utils;
import java.util.Enumeration;

import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;

import org.owasp.jbrofuzz.graph.FileSystemTreeNode;
import org.owasp.jbrofuzz.graph.GraphingPanel;
import org.owasp.jbrofuzz.io.StorageHandler;
import org.owasp.jbrofuzz.system.Logger;


public class DBWalker {

		private FileSystemTreeNode master;

		// private final File directory;
		private String[] sessionids = null;

		private final GraphingPanel gPanel;

		//

		private int fileCount, dirCount;

		public DBWalker(final GraphingPanel gPanel) {
			// sessionids = this.gPanel.getFrame().getJBroFuzz().getStorageHandler().readTableRow("Select sessionId from session");
			
			StorageHandler sh = new StorageHandler();
			sessionids = sh.readTableRow("Select sessionId from session");
			
			Logger.log("received: "  + sessionids.length + " sessionIds.", 3);
			
			master = new FileSystemTreeNode("DATABASE");
			
			for (int i = 0; i < sessionids.length; i++){
				master.add(new FileSystemTreeNode(sessionids[i]));
			}
			
			this.gPanel = gPanel;
			master.setAsDirectory();

			Logger.log("Constructor: DBWalker: SessionIds: " + sessionids, 3);
			fileCount = 0;
			dirCount = 0;

		}

		public FileSystemTreeNode getFileSystemTreeNode() {
			return master;
		}

		public int getMaximum() {

			if (sessionids != null) {
				return sessionids.length;
			}
			else{
				return 0;
			}

		}
		
		private void listAllFiles(final FileSystemTreeNode parent) {
			if (gPanel.isStoppedEnabled()) {
				return;
			}

			StorageHandler sh = new StorageHandler();
			sessionids = sh.readTableRow("Select sessionId from session");
			
			for (int i = 0; i < sessionids.length; i++){
				parent.add(new FileSystemTreeNode(sessionids[i]));
			}
			
			Logger.log("listAllFiles: SessionIds: " + sessionids, 3);
			dirCount = 1;
			fileCount = sessionids.length;
		}

		public void run() {

			listAllFiles(master);
			
			gPanel.toConsole("Total Files: " + fileCount);
			gPanel.toConsole("Total Directories: " + dirCount);

		}
	}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy