如果你喜欢我的文章,欢迎关注公众号:安全女巫
转载请注明出处:https://mp.weixin.qq.com/s/xEKSXm2-fCHhyvZxrQUQvQ
burpsuite 最新版下载地址:
关注公众号回复burpsuite
0x1 前言
官方只支持三种语言:Java, Python & Ruby
因Burpsuite使用Java编写,推荐使用java语言编写插件。若想用Python或Ruby,需使用借助JPython或JRuby,以达到使用Java调用Python或Ruby库的目的。
可根据实际情况进行插件编写。
0x2 Burp Api接口
保存所有接口到本地
0x3 Java插件编写
java环境准备
安装jdk
安装idea
idea创建web项目,可做了解 https://blog.csdn.net/justdoit_potato/article/details/82994046
代码编写
创建项目时,File-New-Project-选择jdk版本,点击下一步.
package burp;
import java.io.PrintWriter;
public class BurpExtender implements IBurpExtender
{
public void registerExtenderCallbacks (IBurpExtenderCallbacks callbacks)
{
// set our extension name
callbacks.setExtensionName("Hello world extension");
// obtain our output and error streams
PrintWriter stdout = new PrintWriter(callbacks.getStdout(), true);
PrintWriter stderr = new PrintWriter(callbacks.getStderr(), true);
// write a message to our output stream
stdout.println("Hello output");
// write a message to our error stream
stderr.println("Hello errors");
// write a message to the Burp alerts tab
callbacks.issueAlert("Hello alerts");
// throw an exception that will appear in our error stream
throw new RuntimeException("Hello exceptions");
}
}
项目打包
plugin_jar为jar包目录
Burp插件导入
插件编写信息,成功展示
Burp调试
开启插件调试命令:
Tips
0x4 Python插件编写
python环境准备
代码编写
from burp import IBurpExtender
from java.io import PrintWriter
from java.lang import RuntimeException
class BurpExtender(IBurpExtender):
def registerExtenderCallbacks(self, callbacks):
callbacks.setExtensionName("Hello world extension")
stdout = PrintWriter(callbacks.getStdout(), True)
stderr = PrintWriter(callbacks.getStderr(), True)
stdout.println("Hello output")
stderr.println("Hello errors")
callbacks.issueAlert("Hello alerts")
raise RuntimeException("Hello exception")
Burp插件导入
Burp调试
其它样例
事件监听
报文重定向
自动记录日志
from burp import IBurpExtender
from burp import ITab
from burp import IHttpListener
from burp import IMessageEditorController
from java.awt import Component;
from java.io import PrintWriter;
from java.util import ArrayList;
from java.util import List;
from javax.swing import JScrollPane;
from javax.swing import JSplitPane;
from javax.swing import JTabbedPane;
from javax.swing import JTable;
from javax.swing import SwingUtilities;
from javax.swing.table import AbstractTableModel;
from threading import Lock
class BurpExtender(IBurpExtender, ITab, IHttpListener, IMessageEditorController, AbstractTableModel):
def registerExtenderCallbacks(self, callbacks):
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
callbacks.setExtensionName("Custom logger")
self._log = ArrayList()
self._lock = Lock()
self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT)
logTable = Table(self)
scrollPane = JScrollPane(logTable)
self._splitpane.setLeftComponent(scrollPane)
tabs = JTabbedPane()
self._requestViewer = callbacks.createMessageEditor(self, False)
self._responseViewer = callbacks.createMessageEditor(self, False)
tabs.addTab("Request", self._requestViewer.getComponent())
tabs.addTab("Response", self._responseViewer.getComponent())
self._splitpane.setRightComponent(tabs)
callbacks.customizeUiComponent(self._splitpane)
callbacks.customizeUiComponent(logTable)
callbacks.customizeUiComponent(scrollPane)
callbacks.customizeUiComponent(tabs)
callbacks.addSuiteTab(self)
callbacks.registerHttpListener(self)
return
def getTabCaption(self):
return "Logger"
def getUiComponent(self):
return self._splitpane
def processHttpMessage(self, toolFlag, messageIsRequest, messageInfo):
if messageIsRequest:
return
self._lock.acquire()
row = self._log.size()
self._log.add(LogEntry(toolFlag, self._callbacks.saveBuffersToTempFiles(messageInfo), self._helpers.analyzeRequest(messageInfo).getUrl()))
self.fireTableRowsInserted(row, row)
self._lock.release()
def getRowCount(self):
try:
return self._log.size()
except:
return 0
def getColumnCount(self):
return 2
def getColumnName(self, columnIndex):
if columnIndex == 0:
return "Tool"
if columnIndex == 1:
return "URL"
return ""
def getValueAt(self, rowIndex, columnIndex):
logEntry = self._log.get(rowIndex)
if columnIndex == 0:
return self._callbacks.getToolName(logEntry._tool)
if columnIndex == 1:
return logEntry._url.toString()
return ""
def getHttpService(self):
return self._currentlyDisplayedItem.getHttpService()
def getRequest(self):
return self._currentlyDisplayedItem.getRequest()
def getResponse(self):
return self._currentlyDisplayedItem.getResponse()
class Table(JTable):
def init(self, extender):
self._extender = extender
self.setModel(extender)
def changeSelection(self, row, col, toggle, extend):
logEntry = self._extender._log.get(row)
self._extender._requestViewer.setMessage(logEntry._requestResponse.getRequest(), True)
self._extender._responseViewer.setMessage(logEntry._requestResponse.getResponse(), False)
self._extender._currentlyDisplayedItem = logEntry._requestResponse
JTable.changeSelection(self, row, col, toggle, extend)
class LogEntry:
def init(self, tool, requestResponse, url):
self.tool = tool
self.requestResponse = requestResponse
self._url = url
本文作者:公众号:安全女巫
本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/200103.html
文章来源于互联网:【Python+Java】Burpsuite插件开发0x1 前言
0x01引言 前段时间在小蓝鸟上看到一个几乎不见的持久化后门–SDDL,然后就看着评论学习着,越看越迷茫就去查了查资料。 0x02 Windows中的安全模型 当 Windows 中的用户或进程尝试访问系统中的资源时,系统会使用访问令牌来标识这些用户或进程。…
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...