use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class AuthenticationHelper method addAuthMessageToHistory.
public static void addAuthMessageToHistory(HttpMessage msg) {
// Add message to history
try {
final HistoryReference ref = new HistoryReference(Model.getSingleton().getSession(), HistoryReference.TYPE_AUTHENTICATION, msg);
ref.addTag(HISTORY_TAG_AUTHENTICATION);
if (View.isInitialised()) {
final ExtensionHistory extHistory = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.class);
if (extHistory != null) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
extHistory.addHistory(ref);
}
});
}
}
} catch (Exception ex) {
log.error("Cannot add authentication message to History tab.", ex);
}
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class SearchResultsTable method getSelectedHistoryReferences.
@Override
public List<HistoryReference> getSelectedHistoryReferences() {
final int[] selectedRows = getSelectedRows();
if (selectedRows.length == 0) {
return Collections.emptyList();
}
ArrayList<HistoryReference> uniqueHistoryReferences = new ArrayList<>(selectedRows.length);
SortedSet<Integer> historyReferenceIdsAdded = new TreeSet<>();
for (int selectedRow : selectedRows) {
HistoryReference historyReference = getHistoryReferenceAtViewRow(selectedRow);
if (historyReference != null) {
Integer id = Integer.valueOf(historyReference.getHistoryId());
if (!historyReferenceIdsAdded.contains(id)) {
historyReferenceIdsAdded.add(id);
uniqueHistoryReferences.add(historyReference);
}
}
}
uniqueHistoryReferences.trimToSize();
return uniqueHistoryReferences;
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class SearchResultsTableModel method createSearchResultTableEntry.
private static SearchResultTableEntry createSearchResultTableEntry(SearchResult sr, SearchResultTableEntry previousResult) {
HistoryReference hRef = sr.getMessage().getHistoryRef();
Integer historyId = null;
String uri = null;
String stringFound = null;
if (previousResult != null) {
Integer previousId = previousResult.getHistoryId();
if (previousId.intValue() == hRef.getHistoryId()) {
historyId = previousId;
}
if (previousResult.getStringFound().equals(sr.getStringFound())) {
stringFound = previousResult.getStringFound();
}
uri = sr.getMessage().getRequestHeader().getURI().toString();
if (previousResult.getUri().equals(uri)) {
uri = previousResult.getUri();
}
}
if (historyId == null) {
historyId = Integer.valueOf(hRef.getHistoryId());
}
if (stringFound == null) {
stringFound = sr.getStringFound();
}
if (uri == null) {
uri = sr.getMessage().getRequestHeader().getURI().toString();
}
return new SearchResultTableEntry(hRef, historyId, hRef.getMethod(), uri, stringFound, sr);
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class ExtensionHistory method getHistoryReference.
public HistoryReference getHistoryReference(int historyId) {
HistoryReference href = historyTableModel.getHistoryReference(historyId);
if (href != null) {
return href;
}
href = (HistoryReference) historyIdToRef.get(historyId);
if (href == null) {
try {
href = new HistoryReference(historyId);
if (href.getHistoryType() != HistoryReference.TYPE_SCANNER_TEMPORARY) {
addToMap(href);
}
} catch (Exception e) {
return null;
}
}
return href;
}
use of org.parosproxy.paros.model.HistoryReference in project zaproxy by zaproxy.
the class PopupMenuEmbeddedBrowser method initialize.
/**
* This method initializes this
*/
private void initialize() {
this.setText(Constant.messages.getString("history.browser.popup"));
this.setActionCommand("");
this.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
HistoryReference ref = null;
if (lastInvoker == null) {
return;
}
if (lastInvoker.getName().equalsIgnoreCase("ListLog")) {
ref = extension.getSelectedHistoryReference();
showBrowser(ref);
} else if (lastInvoker.getName().equals("treeSite")) {
JTree tree = (JTree) lastInvoker;
SiteNode node = (SiteNode) tree.getLastSelectedPathComponent();
ref = node.getHistoryReference();
showBrowser(ref);
}
}
});
}
Aggregations