MCPcopy Index your code
hub / github.com/XF-FS/APIKit / ContextMenu

Class ContextMenu

src/main/java/burp/ContextMenu.java:23–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21import javax.swing.JMenuItem;
22
23public class ContextMenu
24 implements IContextMenuFactory {
25 private static final HashSet<Byte> availableToolFlag = new HashSet();
26
27 static {
28 availableToolFlag.add((byte) 6);
29 availableToolFlag.add((byte) 0);
30 availableToolFlag.add((byte) 2);
31 }
32
33 @Override
34 public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
35 if (availableToolFlag.contains(invocation.getInvocationContext())) {
36 ArrayList<JMenuItem> menuItemList = new ArrayList<JMenuItem>();
37 JMenuItem AutoAPIScan = new JMenuItem("Do Auto API Scan");
38 JMenuItem TargetAPIScan2 = new JMenuItem("Do Target API Scan");
39 AutoAPIScan.addActionListener(new ContextMenuActionListener(invocation));
40 TargetAPIScan2.addActionListener(new ActionListener() {
41
42 @Override
43 public void actionPerformed(ActionEvent arg0) {
44 try {
45 TargetAPIConfigPanel panel = new TargetAPIConfigPanel();
46 BurpExtender.getCallbacks().customizeUiComponent(panel);
47 panel.setVisible(true);
48 } catch (Exception e) {
49 e.printStackTrace(BurpExtender.getStderr());
50 }
51 }
52 });
53 menuItemList.add(AutoAPIScan);
54 menuItemList.add(TargetAPIScan2);
55 return menuItemList;
56 }
57 return null;
58 }
59
60 static class ContextMenuActionListener
61 implements ActionListener {
62 IContextMenuInvocation invocation;
63
64 public ContextMenuActionListener(IContextMenuInvocation invocation) {
65 this.invocation = invocation;
66 }
67
68 @Override
69 public void actionPerformed(ActionEvent actionEvent) {
70 CompletableFuture.supplyAsync(() -> {
71 IHttpRequestResponse[] httpRequestResponses;
72 final PassiveScanner passiveScanner = BurpExtender.getPassiveScanner();
73 for (final IHttpRequestResponse httpRequestResponse : httpRequestResponses = this.invocation.getSelectedMessages()) {
74 new Thread(new Runnable() {
75
76 @Override
77 public void run() {
78 ArrayList<ApiType> apiTypes = passiveScanner.getApiScanner().detect(httpRequestResponse, false);
79 passiveScanner.parseApiDocument(apiTypes, null);
80 }

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected