Skip to content

Commit

Permalink
恢复默认端口和整理代码符合低版本语法糖
Browse files Browse the repository at this point in the history
  • Loading branch information
c0ny1 committed Feb 3, 2023
1 parent b1ef2a1 commit a113685
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 60 deletions.
37 changes: 26 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion passive-scan-client.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.gv7.tools.burpextend</groupId>
<artifactId>passive-scan-client</artifactId>
<version>0.1</version>
<version>0.3.1</version>

<dependencies>
<!-- https://mvnrepository.com/artifact/net.portswigger.burp.extender/burp-extender-api -->
Expand Down Expand Up @@ -41,8 +41,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>1.7</source>
<target>1.7</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
Expand Down
88 changes: 45 additions & 43 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import javax.swing.table.TableColumnModel;

// 插件入口
public class BurpExtender implements IBurpExtender,ITab,IProxyListener, IContextMenuFactory {
public class BurpExtender implements IBurpExtender,ITab,IProxyListener {
public final static String extensionName = "Passive Scan Client";
public final static String version ="0.3.1";
public static IBurpExtenderCallbacks callbacks;
Expand All @@ -34,7 +34,7 @@ public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
this.stderr = new PrintWriter(callbacks.getStderr(),true);

// 注册菜单拓展
callbacks.registerContextMenuFactory(this::createMenuItems);
callbacks.registerContextMenuFactory(new Send2PSCMenu());
callbacks.setExtensionName(extensionName + " " + version);
BurpExtender.this.gui = new GUI();
SwingUtilities.invokeLater(new Runnable() {
Expand Down Expand Up @@ -64,46 +64,6 @@ public void run() {
});
}

// 实现右键,需要先注册菜单拓展
@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
final IHttpRequestResponse[] messages = invocation.getSelectedMessages();
JMenuItem i1 = new JMenuItem("Send to PassiveScanner");
i1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (final IHttpRequestResponse message : messages) {
executorService.submit(new Runnable() {
@Override
public void run() {
synchronized (log) {
int row = log.size();
String method = helpers.analyzeRequest(message).getMethod();
byte[] req = message.getRequest();

String req_str = new String(req);
//向代理转发请求
Map<String, String> mapResult = null;
try {
mapResult = HttpAndHttpsProxy.Proxy(message);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
log.add(new LogEntry(row + 1,
callbacks.saveBuffersToTempFiles(message), helpers.analyzeRequest(message).getUrl(),
method,
mapResult)
);
GUI.logTable.getHttpLogTableModel().fireTableRowsInserted(row, row);
}
}
});
}
}
});
return Arrays.asList(i1);
}

//
// 实现ITab
//
Expand Down Expand Up @@ -154,7 +114,6 @@ public void run() {
try {
mapResult = HttpAndHttpsProxy.Proxy(resrsp);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Expand All @@ -169,4 +128,47 @@ public void run() {
});
}
}


// 实现右键,需要先注册菜单拓展
public class Send2PSCMenu implements IContextMenuFactory{
@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
final IHttpRequestResponse[] messages = invocation.getSelectedMessages();
JMenuItem i1 = new JMenuItem("Send to Passive Scan Client");
i1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (final IHttpRequestResponse message : messages) {
executorService.submit(new Runnable() {
@Override
public void run() {
synchronized (log) {
int row = log.size();
String method = helpers.analyzeRequest(message).getMethod();
byte[] req = message.getRequest();

String req_str = new String(req);
//向代理转发请求
Map<String, String> mapResult = null;
try {
mapResult = HttpAndHttpsProxy.Proxy(message);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
log.add(new LogEntry(row + 1,
callbacks.saveBuffersToTempFiles(message), helpers.analyzeRequest(message).getUrl(),
method,
mapResult)
);
GUI.logTable.getHttpLogTableModel().fireTableRowsInserted(row, row);
}
}
});
}
}
});
return Arrays.asList(i1);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/burp/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class Config {
public static boolean IS_RUNNING = false;
public static String PROXY_HOST = "127.0.0.1";
public static Integer PROXY_PORT = 7777;
public static Integer PROXY_PORT = 1664;
public static String PROXY_USERNAME = null;
public static String PROXY_PASSWORD = null;
public static Integer PROXY_TIMEOUT = 5000;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/burp/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public GUI() {
ConfigPanel.add(lbPort, gbc_lbPort);

tfPort = new JTextField();
tfPort.setText("7777");
tfPort.setText("1664");
tfPort.setColumns(10);
GridBagConstraints gbc_tfPort = new GridBagConstraints();
gbc_tfPort.fill = 2;
Expand Down

0 comments on commit a113685

Please sign in to comment.