Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
S9MF authored Apr 30, 2021
1 parent 75bbc79 commit 6085cbb
Show file tree
Hide file tree
Showing 10 changed files with 700 additions and 0 deletions.
Binary file added out/artifacts/sql_sup/sql-sup.jar
Binary file not shown.
91 changes: 91 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>burp</groupId>
<artifactId>sql-sup</artifactId>
<version>1.0-SNAPSHOT</version>

<name>sql-sup</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.portswigger.burp.extender/burp-extender-api -->
<dependency>
<groupId>net.portswigger.burp.extender</groupId>
<artifactId>burp-extender-api</artifactId>
<version>1.7.22</version>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions sql-sup.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
33 changes: 33 additions & 0 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package burp;

import java.io.PrintWriter;

public class BurpExtender implements IBurpExtender {

public static IBurpExtenderCallbacks callbacks;
public static IExtensionHelpers helpers;
private String extensionName = "sql-sup(辅助)";
private String version ="0.1";
public static PrintWriter out;

@Override
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
this.callbacks = callbacks;
this.helpers = callbacks.getHelpers();
callbacks.setExtensionName(String.format("%s %s",extensionName,version));
out = new PrintWriter(callbacks.getStdout(), true);
callbacks.registerContextMenuFactory(new Menu());
callbacks.registerIntruderPayloadGeneratorFactory(new PayloadGenera());
out.println(getBanner());
}

public String getBanner(){
String bannerInfo =
"[+] ##############################################\n"
+ "[+] " + extensionName + " v" + version +"\n"
+ "[+] anthor: S9MF\n"
+ "[+] github: https://github.com/S9MF/sql-sup\n"
+ "[+] ##############################################";
return bannerInfo;
}
}
94 changes: 94 additions & 0 deletions src/main/java/burp/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package burp;

public class Config {
private static Integer params_len = 1;
private static Integer key_len = 1;
private static Integer value_len = 1;
private static Integer number_len = 1;
private static Integer fuzz_number = 1;
private static String filePath;

public static String getFilePath() {
String val = BurpExtender.callbacks.loadExtensionSetting("filePath");
try {
return String.valueOf(val);
}catch (Exception e) {
return Config.filePath;
}
}

public static void setFilePath(String filePath) {
BurpExtender.callbacks.saveExtensionSetting("filePath", String.valueOf(filePath));
Config.filePath = filePath;
}

public static Integer getFuzz_number() {
String val = BurpExtender.callbacks.loadExtensionSetting("fuzz_number");
try {
return Integer.valueOf(val);
}catch (Exception e) {
return Config.fuzz_number;
}
}

public static void setFuzz_number(Integer fuzz_number) {
BurpExtender.callbacks.saveExtensionSetting("fuzz_number", String.valueOf(fuzz_number));
Config.fuzz_number = fuzz_number;
}

public static Integer getParams_len() {
String val = BurpExtender.callbacks.loadExtensionSetting("params_len");
try {
return Integer.valueOf(val);
}catch (Exception e) {
return Config.params_len;
}
}

public static void setParams_len(Integer params_len) {
BurpExtender.callbacks.saveExtensionSetting("params_len", String.valueOf(params_len));
Config.params_len = params_len;
}

public static Integer getKey_len() {
String val = BurpExtender.callbacks.loadExtensionSetting("key_len");
try {
return Integer.valueOf(val);
}catch (Exception e) {
return Config.key_len;
}
}

public static void setKey_len(Integer key_len) {
BurpExtender.callbacks.saveExtensionSetting("key_len", String.valueOf(key_len));
Config.key_len = key_len;
}

public static Integer getValue_len() {
String val = BurpExtender.callbacks.loadExtensionSetting("value_len");
try {
return Integer.valueOf(val);
}catch (Exception e) {
return Config.value_len;
}
}

public static void setValue_len(Integer value_len) {
BurpExtender.callbacks.saveExtensionSetting("value_len", String.valueOf(value_len));
Config.value_len = value_len;
}

public static Integer getNumber_len() {
String val = BurpExtender.callbacks.loadExtensionSetting("number_len");
try {
return Integer.valueOf(val);
}catch (Exception e) {
return Config.number_len;
}
}

public static void setNumber_len(Integer number_len) {
BurpExtender.callbacks.saveExtensionSetting("number_len", String.valueOf(number_len));
Config.number_len = number_len;
}
}
158 changes: 158 additions & 0 deletions src/main/java/burp/ConfigDlg.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package burp;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

public class ConfigDlg extends JDialog {
//定义组件
private final JPanel mainPanel = new JPanel();
private final JPanel toPanel = new JPanel();
private final JPanel centerPanel = new JPanel();
private final JPanel bottomPanel = new JPanel();;
private final JSpinner spNum = new JSpinner(new SpinnerNumberModel(1,1,200,1));
private final JSpinner spKey = new JSpinner(new SpinnerNumberModel(1,1,200,1));
private final JSpinner spValue = new JSpinner(new SpinnerNumberModel(1,1,200,1));
private final JSpinner spNumber = new JSpinner(new SpinnerNumberModel(1,1,600,1));
private final JSpinner spFuzzNumber = new JSpinner(new SpinnerNumberModel(1,1,20,1));
private final JLabel kbText = new JLabel("byte字节");
private final JLabel filePathText = new JLabel();
private final JButton btCancel = new JButton("Cancel");
private final JButton btSave = new JButton("Save");
private final JButton bCalc = new JButton("Calc");
private final JButton bSelect = new JButton("浏览");

public ConfigDlg() {
initGUI();
initEvent();
initValue();
this.setTitle("SQLSup Config");
}
//初始化组件
private void initGUI() {
toPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
toPanel.add(new JLabel("参数个数:"));
toPanel.add(spNum);
toPanel.add(new JLabel("(1-200)"));
toPanel.add(new JLabel(" key value:"));
toPanel.add(spKey);
toPanel.add(new JLabel("-"));
toPanel.add(spValue);
toPanel.add(new JLabel("(1-200)"));
toPanel.add(new JLabel(" number:"));
toPanel.add(spNumber);
toPanel.add(new JLabel("(1-600)"));
toPanel.add(kbText);

centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
centerPanel.add(new JLabel("Fuzz个数:"));
centerPanel.add(spFuzzNumber);
centerPanel.add(new JLabel("(1-20)"));
centerPanel.add(bSelect);
centerPanel.add(filePathText);


bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
bottomPanel.add(btSave);
bottomPanel.add(bCalc);
bottomPanel.add(btCancel);
btSave.setToolTipText("Save(保存)配置");
bCalc.setToolTipText("先Save(保存),再Calc(计算)");
btCancel.setToolTipText("Cancel(取消)");

mainPanel.setLayout(new BorderLayout());
mainPanel.add(toPanel,BorderLayout.NORTH);
mainPanel.add(centerPanel,BorderLayout.CENTER);
mainPanel.add(bottomPanel,BorderLayout.SOUTH);

this.setModal(true);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.add(mainPanel);
//使配置窗口自动适应控件大小,防止部分控件无法显示
this.pack();
//居中显示配置窗口
Dimension screensize=Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds(screensize.width/2-this.getWidth()/2,screensize.height/2-this.getHeight()/2,this.getWidth(),this.getHeight());
}
//组件的事件响应
private void initEvent() {
//取消按钮
btCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ConfigDlg.this.dispose();
}
});
//保存按钮
btSave.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Integer params_len = (Integer)spNum.getValue();
Integer key_len = (Integer)spKey.getValue();
Integer value_len = (Integer)spValue.getValue();
Integer number_len = (Integer)spNumber.getValue();
Integer fuzz_number = (Integer) spFuzzNumber.getValue();

Config.setParams_len(params_len);
Config.setKey_len(key_len);
Config.setValue_len(value_len);
Config.setNumber_len(number_len);
Config.setFuzz_number(fuzz_number);

}
});
//显示kb 先Save然后Calc
bCalc.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
byte[] bytes = Util.getRandomString(Config.getKey_len(), Config.getValue_len(), Config.getNumber_len()).getBytes();
int kbNum = bytes.length;
String result = kbNum +"";
kbText.setText("(" + result+ "byte)");
}
});
//选择按钮
bSelect.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("文本文件(*.txt)", "txt"));
int result = fileChooser.showOpenDialog(null);
if (result == fileChooser.APPROVE_OPTION) {
String filePath = fileChooser.getSelectedFile().getPath();
Config.setFilePath(filePath);
}
}
});
}
//为控件赋值
public void initValue() {
spNum.setValue(Config.getParams_len());
spKey.setValue(Config.getKey_len());
spValue.setValue(Config.getValue_len());
spNumber.setValue(Config.getNumber_len());
spFuzzNumber.setValue(Config.getFuzz_number());
filePathText.setText(Config.getFilePath());
}
}
















Loading

0 comments on commit 6085cbb

Please sign in to comment.