minor formatting fixes
This commit is contained in:
parent
946a67f3ba
commit
e16fc35763
3 changed files with 18 additions and 7 deletions
src/main/kotlin
|
@ -1,10 +1,10 @@
|
|||
package burp
|
||||
|
||||
import burp.api.montoya.persistence.PersistenceContext
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
const val ITEM_STORE = "itemStore"
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ItemStore(ctx: PersistenceContext) {
|
|||
this.items = load()
|
||||
}
|
||||
|
||||
private fun load() : Items {
|
||||
private fun load(): Items {
|
||||
// loads and returns items from persistent storage
|
||||
var jsonStr = ctx.getString(ITEM_STORE) ?: "{}"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import burp.api.montoya.MontoyaApi
|
|||
import java.util.regex.Pattern
|
||||
import java.util.regex.PatternSyntaxException
|
||||
|
||||
data class Response (var matched: Boolean, var contents: String)
|
||||
data class Response(var matched: Boolean, var contents: String)
|
||||
|
||||
interface ReplaceStrategy {
|
||||
fun updateValue(request: String, match: String): Response
|
||||
|
@ -57,7 +57,7 @@ class HeaderStrategy : ReplaceStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
class Replacer (api: MontoyaApi, itemStore: ItemStore) {
|
||||
class Replacer(api: MontoyaApi, itemStore: ItemStore) {
|
||||
private val itemStore: ItemStore
|
||||
private val api: MontoyaApi
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Replacer (api: MontoyaApi, itemStore: ItemStore) {
|
|||
this.api = api
|
||||
}
|
||||
|
||||
fun handleRequest(request: String) : String {
|
||||
fun handleRequest(request: String): String {
|
||||
// replaces values if necessary
|
||||
var needsSync = false
|
||||
var updatedRequest = request
|
||||
|
|
|
@ -26,7 +26,16 @@ private fun reloadValuesTable(items: Items) {
|
|||
dtm.dataVector.removeAllElements()
|
||||
|
||||
items.forEach {
|
||||
dtm.addRow(arrayOf(it.value.enabled, it.key, it.value.match, it.value.lastMatch, it.value.matchCount, it.value.replaceCount))
|
||||
dtm.addRow(
|
||||
arrayOf(
|
||||
it.value.enabled,
|
||||
it.key,
|
||||
it.value.match,
|
||||
it.value.lastMatch,
|
||||
it.value.matchCount,
|
||||
it.value.replaceCount
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
dtm.fireTableDataChanged()
|
||||
|
@ -204,10 +213,12 @@ class UI(api: MontoyaApi, itemStore: ItemStore) : JPanel() {
|
|||
valueRemove.isEnabled = false
|
||||
valueEdit.isEnabled = false
|
||||
}
|
||||
|
||||
1 -> {
|
||||
valueRemove.isEnabled = true
|
||||
valueEdit.isEnabled = true
|
||||
}
|
||||
|
||||
else -> {
|
||||
valueRemove.isEnabled = true
|
||||
valueEdit.isEnabled = false
|
||||
|
@ -333,7 +344,7 @@ class UI(api: MontoyaApi, itemStore: ItemStore) : JPanel() {
|
|||
|
||||
class AddEditDialog(owner: Window?, api: MontoyaApi, index: Int, itemStore: ItemStore) : JDialog(owner) {
|
||||
private val headerTypeHint = "Matches header names and replaces values "
|
||||
private val regexTypeHint = "Uses regex for matches (named group: val)"
|
||||
private val regexTypeHint = "Uses regex for matches (named group: val)"
|
||||
private var index: Int
|
||||
private val itemStore: ItemStore
|
||||
|
||||
|
|
Loading…
Reference in a new issue