1
1
package burp
2
2
3
- import kotlinx.coroutines.Dispatchers
4
- import kotlinx.coroutines.GlobalScope
5
- import kotlinx.coroutines.launch
6
- import kotlinx.coroutines.swing.Swing
7
3
import java.awt.FlowLayout
8
4
import javax.swing.*
9
5
@@ -27,10 +23,7 @@ class BookmarkOptions(
27
23
clearButton.addActionListener { clearBookmarks() }
28
24
searchBar.addActionListener { searchBookmarks() }
29
25
searchButton.addActionListener { searchBookmarks() }
30
- resetButton.addActionListener {
31
- searchBar.text = " "
32
- resetSearch()
33
- }
26
+ resetButton.addActionListener { resetSearch() }
34
27
searchPanel.add(searchLabel)
35
28
searchPanel.add(searchBar)
36
29
searchPanel.add(searchButton)
@@ -43,44 +36,34 @@ class BookmarkOptions(
43
36
}
44
37
45
38
private fun loadHighlightedRequests () {
46
- GlobalScope .launch {
47
- val bookmarks = bookmarksPanel.bookmarks
48
- val highlightedProxyHistory = callbacks.proxyHistory.filter { it.highlight != null }
49
- val bookmarkRequests = bookmarks.map { callbacks.helpers.bytesToString(it.requestResponse.request) }
50
- val bookmarksToAdd = highlightedProxyHistory
51
- .filter { ! bookmarkRequests.contains(callbacks.helpers.bytesToString(it.request)) }.toTypedArray()
52
- launch(Dispatchers .Swing ) {
53
- bookmarksPanel.addBookmark(bookmarksToAdd)
54
- bookmarksPanel.model.filteredBookmarks()
55
- }
56
- }
39
+ val bookmarks = bookmarksPanel.bookmarks
40
+ val highlightedProxyHistory = callbacks.proxyHistory.filter { it.highlight != null }
41
+ val bookmarkRequests = bookmarks.map { callbacks.helpers.bytesToString(it.requestResponse.request) }
42
+ val bookmarksToAdd = highlightedProxyHistory
43
+ .filter { ! bookmarkRequests.contains(callbacks.helpers.bytesToString(it.request)) }.toTypedArray()
44
+ bookmarksPanel.addBookmark(bookmarksToAdd)
57
45
}
58
46
59
47
private fun searchBookmarks () {
60
48
val searchText = searchBar.text
61
49
val bookmarks = this .bookmarksPanel.bookmarks
62
50
if (searchText.isNotEmpty()) {
63
- GlobalScope .launch {
64
- val filteredBookmarks = bookmarks
65
- .filter {
66
- callbacks.helpers.bytesToString(it.requestResponse.request).contains(searchText) ||
67
- callbacks.helpers.bytesToString(it.requestResponse.response).contains(searchText)
68
- }.toMutableList()
69
- launch(Dispatchers .Swing ) {
70
- bookmarksPanel.model.filteredBookmarks(filteredBookmarks)
71
- }
72
- }
73
- } else {
74
- bookmarksPanel.model.filteredBookmarks()
51
+ val filteredBookmarks = bookmarks
52
+ .filter {
53
+ callbacks.helpers.bytesToString(it.requestResponse.request).contains(searchText) ||
54
+ callbacks.helpers.bytesToString(it.requestResponse.response).contains(searchText)
55
+ }.toMutableList()
56
+ bookmarksPanel.model.refreshBookmarks(filteredBookmarks)
75
57
}
76
58
}
77
59
78
60
private fun resetSearch () {
79
- bookmarksPanel.model.filteredBookmarks()
61
+ searchBar.text = " "
62
+ bookmarksPanel.model.refreshBookmarks()
80
63
}
81
64
82
65
private fun clearBookmarks () {
83
66
bookmarksPanel.model.bookmarks.clear()
84
- bookmarksPanel.model.filteredBookmarks ()
67
+ bookmarksPanel.model.refreshBookmarks ()
85
68
}
86
69
}
0 commit comments