Version: 2.0.7 Update
This commit is contained in:
@@ -3,7 +3,10 @@ package burp.yaml;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import burp.Config;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -12,7 +15,7 @@ import java.util.Map;
|
||||
*/
|
||||
|
||||
public class LoadConfigFile {
|
||||
private static Yaml yaml = new Yaml();
|
||||
private static final Yaml yaml = new Yaml();
|
||||
private static final String SettingPath = "Setting.yml";
|
||||
private static final String ConfigPath = "Config.yml";
|
||||
|
||||
@@ -28,7 +31,7 @@ public class LoadConfigFile {
|
||||
r.put("configPath", ConfigPath);
|
||||
r.put("excludeSuffix", getExcludeSuffix());
|
||||
try{
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath),"UTF-8");
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath), StandardCharsets.UTF_8);
|
||||
yaml.dump(r, ws);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
@@ -44,11 +47,11 @@ public class LoadConfigFile {
|
||||
return r.get("excludeSuffix").toString();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return "css|jpeg|gif|jpg|png|pdf|rar|zip|docx|doc|svg|jpeg|ico|woff|woff2|ttf|otf";
|
||||
return Config.excludeSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
public String getConfigPath(){
|
||||
public static String getConfigPath(){
|
||||
try {
|
||||
InputStream inorder = new FileInputStream(SettingPath);
|
||||
Map<String,Object> r;
|
||||
@@ -65,7 +68,7 @@ public class LoadConfigFile {
|
||||
r.put("excludeSuffix", excludeSuffix);
|
||||
r.put("configPath", getConfigPath());
|
||||
try{
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath),"UTF-8");
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath), StandardCharsets.UTF_8);
|
||||
yaml.dump(r, ws);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
@@ -77,7 +80,7 @@ public class LoadConfigFile {
|
||||
r.put("configPath", filePath);
|
||||
r.put("excludeSuffix", getExcludeSuffix());
|
||||
try{
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath),"UTF-8");
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(SettingPath), StandardCharsets.UTF_8);
|
||||
yaml.dump(r, ws);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.yaml.snakeyaml.representer.Representer;
|
||||
import org.yaml.snakeyaml.nodes.Tag;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -17,16 +18,15 @@ import java.util.Map;
|
||||
|
||||
public class LoadRule {
|
||||
private static String filePath = "Config.yml";
|
||||
public LoadRule(String configfile){
|
||||
filePath = configfile;
|
||||
public LoadRule(String configFile){
|
||||
filePath = configFile;
|
||||
init();
|
||||
}
|
||||
|
||||
// 初始化配置
|
||||
public void init(){
|
||||
File settingyaml = new File(filePath);
|
||||
if (!(settingyaml.exists() && settingyaml.isFile())){
|
||||
Map<String,Object[][]> r = new HashMap<>();
|
||||
File yamlFile = new File(filePath);
|
||||
if (!(yamlFile.exists() && yamlFile.isFile())){
|
||||
Rule rule = new Rule();
|
||||
rule.setLoaded(true);
|
||||
rule.setName("Email");
|
||||
@@ -50,10 +50,10 @@ public class LoadRule {
|
||||
representer.addClassTag(Config.class, Tag.MAP);
|
||||
|
||||
Yaml yaml = new Yaml(new Constructor(),representer,dop);
|
||||
LoadConfigFile loadfile = new LoadConfigFile();
|
||||
File f = new File(loadfile.getConfigPath());
|
||||
new LoadConfigFile();
|
||||
File f = new File(LoadConfigFile.getConfigPath());
|
||||
try{
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(f),"UTF-8");
|
||||
Writer ws = new OutputStreamWriter(new FileOutputStream(f), StandardCharsets.UTF_8);
|
||||
yaml.dump(config,ws);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
@@ -65,7 +65,7 @@ public class LoadRule {
|
||||
InputStream inorder = null;
|
||||
{
|
||||
try {
|
||||
inorder = new FileInputStream(new File(filePath));
|
||||
inorder = new FileInputStream(filePath);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user