compile('net.portswigger.burp.extender:burp-extender-api:1.7.13')
id 'com.github.johnrengelman.shadow' version '5.2.0'
callbacks.setExtensionName("data-collect2"); callbacks.printOutput("load success");
compile('com.intellij:forms_rt:7.0.3')
-
解析功能,解析请求中的各种数据,然后插入到数据库中。 -
数据库设计,关键体现在查询和插入数据的性能上,在被我的开发朋友调教后,重新设计SQL语句,从导入一次数据需要十几分钟,优化到了几秒内完成。 -
内存去重,在内存中保存已经插入的数据,如果重复了,就不插入数据库,可以极大地减少数据库的操作。 -
退出时收集数据,当 burp 退出时会进行最后一次数据收集,不用人工收集。
数据库是否存在该记录 // 此处一条查询语句 如果存在不插入 如果不存在,插入该记录 //此处一条插入语句
INSERT IGNORE INTO host_dir_map(host, dir) VALUES ("www.baidu.com", "dir1"), ("www.baidu.com", "dir2"), ... ("www.baidu.com", "dir1000")
SELECT hdm.dir, COUNT(*) AS dirCount FROM host_dir_map hdm GROUP BY hdm.dir ORDER BY `dirCount` DESC
private boolean addToMemory(String host, String value, String flag) {
boolean result = true;
HashMap<String, HashSet<String>> hostHashMap = memoryHostValueMap.get(host);
if (hostHashMap == null) {
hostHashMap = new HashMap<>();
HashSet<String> hostHashSet = new HashSet<>();
hostHashSet.add(value);
hostHashMap.put(flag, hostHashSet);
memoryHostValueMap.put(host, hostHashMap);
result = false;
} else {
HashSet<String> hostHashSet = hostHashMap.get(flag);
if (hostHashSet == null) {
hostHashSet = new HashSet<>();
hostHashSet.add(value);
hostHashMap.put(flag, hostHashSet);
result = false;
} else {
if (!hostHashSet.contains(value)) {
hostHashSet.add(value);
result = false;
}
}
}
return result;
}
service = Executors.newSingleThreadScheduledExecutor(); service.scheduleWithFixedDelay(new Runnable() { @Override public void run() { BurpExtender.this.saveData(); callbacks.printOutput("Scheduled export execution completed"); } }, 0, 10, TimeUnit.MINUTES);
原文链接
本文作者:timeshatter
本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/124593.html
- 左青龙
- 微信扫一扫
- 右白虎
- 微信扫一扫
评论