public void refreshTable(Map<String, Domain> domains , boolean showOnlyVulnerable) { defaultModel.setRowCount(0); for(Map.Entry<String, Domain> d: domains.entrySet()) { for (Map.Entry<String, Software> s: d.getValue().getSoftware().entrySet()) { if (showOnlyVulnerable && s.getValue().getVulnerabilities().size() <= 0) { continue; } defaultModel.addRow(new Object[] { d.getKey(), s.getValue().getName(), s.getValue().getVersion(), Utils.getMaxScore(s.getValue().getVulnerabilities()), //TODO move maxScore field to model Utils.getVulnersList(s.getValue().getVulnerabilities()) }); } } }
void setHost(String host, int port) { try { url = new URL(url.getProtocol(), host, port, url.getPath()); } catch (MalformedURLException ex) { ex.printStackTrace(new PrintWriter(BurpExtender.callbacks.getStderr())); } request = Utils.changeHost(request, host, port); clearStatus(); }
void changeTarget(String oldHost, int oldPort, String newHost, int newPort) { try { JSONArray items = json.getJSONArray("items"); for(int i = 0; i < items.length(); i++) { JSONObject item = items.getJSONObject(i); if(item.getString("url").contains(String.format("://%s:%d", oldHost, oldPort))) { URL url = new URL(item.getString("url")); URL newUrl = new URL(url.getProtocol(), newHost, newPort, url.getFile()); item.put("url", newUrl.toString()); byte[] request = item.getString("request").getBytes(); request = Utils.changeHost(request, newHost, newPort); item.put("request", new String(request)); } } } catch (JSONException | MalformedURLException e) { e.printStackTrace(new PrintWriter(BurpExtender.callbacks.getStderr())); } } }
@Override public void onScannerSuccess(Set<Vulnerability> vulnerabilities) { // update cache domains.get(domainName) .getPaths() .put(path, vulnerabilities); // update gui component tabComponent.getPathsTable().getDefaultModel().addRow(new Object[]{ domainName, path, Utils.getMaxScore(vulnerabilities), Utils.getVulnersList(vulnerabilities) }); // add Burp issue callbacks.addScanIssue(new PathIssue( baseRequestResponse, helpers, callbacks, path, vulnerabilities )); } });