Skip to content

Commit

Permalink
added filter + folder fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDexter0us committed Nov 26, 2021
1 parent d78ddde commit 4f94fd7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.dexter0us'
version '0.5.0'
version '0.7.0'

repositories {
mavenCentral()
Expand Down
27 changes: 22 additions & 5 deletions src/main/kotlin/com/dexter0us/scavenger/BurpHistoryParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.*

class BurpHistoryParser {

fun historyParser(index: Int, fileLocation: String, fileName: String): ProcessResult {
fun historyParser(index: Int, fileLocation: String, fileName: String, filter: Boolean): ProcessResult {
val channel = Channel<Int>()
val job = GlobalScope.launch(Dispatchers.Default) {

Expand Down Expand Up @@ -78,14 +78,14 @@ class BurpHistoryParser {
}

when (index) {
0 -> run { writeFile(fileLocation, fileName, paramList) }
1 -> run { writeFile(fileLocation, fileName, jsonKeyList) }
2 -> run { writeFile(fileLocation, fileName, ((endpointList + jsList) as MutableSet<String>)) }
0 -> run { writeFile(fileLocation, fileName, filterList(paramList, filter) ) }
1 -> run { writeFile(fileLocation, fileName, filterList(jsonKeyList, filter)) }
2 -> run { writeFile(fileLocation, fileName, filterList(((endpointList + jsList) as MutableSet<String>), filter)) }
3 -> run {
writeFile(
fileLocation,
fileName,
((paramList + endpointList + jsList + jsonKeyList) as MutableSet<String>)
filterList(((paramList + endpointList + jsList + jsonKeyList) as MutableSet<String>), filter)
)
}
}
Expand All @@ -101,6 +101,23 @@ class BurpHistoryParser {
FileUtils.writeLines(File(absoluteFilePath), wordlist, true)
console("Saved!!!")
}

private fun filterList(set: MutableSet<String>, bool: Boolean): MutableSet<String> {
if (bool){
set.removeIf {
it.lowercase().endsWith("svg")
|| it.lowercase().endsWith("png")
|| it.lowercase().endsWith("jpg")
|| it.lowercase().endsWith("jpeg")
|| it.lowercase().endsWith("gif")
|| it.lowercase().endsWith("ttf")
|| it.lowercase().endsWith("woff")
|| it.lowercase().endsWith("woff2")
}
return set
}
return set
}
}


2 changes: 1 addition & 1 deletion src/main/kotlin/com/dexter0us/scavenger/Extension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import javax.swing.*
open class Extension : IBurpExtender, IExtensionStateListener {
companion object{
const val pluginName = "Scavenger"
const val version = "0.5.0"
const val version = "0.7.0"
}

private var scavUnload = false
Expand Down
26 changes: 21 additions & 5 deletions src/main/kotlin/com/dexter0us/scavenger/ui/ScavengerUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {
"Combine All Three Lists"
)
private var listCBox = JComboBox(listType)
private var checkBox = JCheckBox()
private var fileLocation = JTextField()
private val fileNameTB = JTextField()
private val progressBar = JProgressBar()
Expand Down Expand Up @@ -94,6 +95,11 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {
selectFolder = JButton("Select Folder...")
selectFolder.addActionListener(this)

checkBox.apply {
text = "Exclude words with svg, png, jpg, ttf, woff extension."
isFocusable = false
isEnabled = false
}

val saveImage = loadImage("save.png")
when {
Expand Down Expand Up @@ -183,6 +189,8 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {
add(fileLocation, "growx, split 2, h 30!")
add(selectFolder, "wrap, span, h 30!")
add(JSeparator(SwingConstants.HORIZONTAL), "")
add(checkBox, "span, left, wrap")
add(JSeparator(SwingConstants.HORIZONTAL), "")
add(saveFile, "span, center, w 125!, h 30!")
add(progressBar, "span, center, growx, h 20!")

Expand Down Expand Up @@ -210,15 +218,20 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {

defaultCloseOperation = DISPOSE_ON_CLOSE
isResizable = false
setSize(600, 530)
setSize(600, 550)
isVisible = true
}
}


override fun actionPerformed(e: ActionEvent?) {
when (e?.source) {
listCBox -> fileNameTB.text = projectName(listCBox.selectedIndex)
listCBox -> {
fileNameTB.text = projectName(listCBox.selectedIndex)
if (listCBox.selectedIndex == 2 || listCBox.selectedIndex ==3){
checkBox.isEnabled = true
}
}
selectFolder -> folderSelector()
saveFile -> {
progressBar.value = 0
Expand All @@ -227,7 +240,7 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {
GlobalScope.launch(Dispatchers.Swing) {
currJob?.cancel()

val processResult = BurpHistoryParser().historyParser(listCBox.selectedIndex, fileLocation.text, fileNameTB.text)
val processResult = BurpHistoryParser().historyParser(listCBox.selectedIndex, fileLocation.text, fileNameTB.text, checkBox.isSelected)
currJob = processResult.job
for (y in processResult.resultChannel) {
progressBar.maximum = historySize - 5
Expand Down Expand Up @@ -268,9 +281,12 @@ class ScavengerUI : JFrame("Scavenger"), ActionListener {
dialogTitle = "Select Folder"
fileSelectionMode = JFileChooser.DIRECTORIES_ONLY
isAcceptAllFileFilterUsed = false
val response = showOpenDialog(null)

if (showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
fileLocation.text = File(currentDirectory.absolutePath).toString()
if (response == JFileChooser.APPROVE_OPTION) {
fileLocation.text = File(selectedFile.absolutePath).toString()
} else {
fileLocation.text = currentDirectory.toString()
}
}
}
Expand Down

0 comments on commit 4f94fd7

Please sign in to comment.