├── JSONandHTTPP.py └── README.md /JSONandHTTPP.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | # Author: Vulkey_Chen 3 | # Blog: gh0st.cn 4 | # Team: MSTSEC 5 | 6 | import json,re 7 | 8 | from burp import IBurpExtender, ITab 9 | from javax.swing import JPanel,JButton,JTextArea,JScrollPane 10 | from java.awt import BorderLayout 11 | 12 | class BurpExtender(IBurpExtender, ITab): 13 | 14 | def registerExtenderCallbacks(self, callbacks): 15 | print 'JSON&HTTPP by [Vulkey_Chen]\nBlog: gh0st.cn\nTeam: MSTSEC' 16 | self._cb = callbacks 17 | self._hp = callbacks.getHelpers() 18 | self._cb.setExtensionName('JSON&HTTPP') 19 | self.mainPanel = JPanel() 20 | self.mainPanel.setLayout(BorderLayout()) 21 | 22 | self.jsonTextArea = JTextArea(20,0) 23 | self.jsonTextArea.setLineWrap(True) 24 | 25 | self.dictTextArea = JTextArea() 26 | self.dictTextArea.setLineWrap(True) 27 | 28 | self.jsonTextWrapper = JPanel() 29 | self.jsonTextWrapper.setLayout(BorderLayout()) 30 | self.dictTextWrapper = JPanel() 31 | self.dictTextWrapper.setLayout(BorderLayout()) 32 | 33 | self.jsonScrollPane = JScrollPane(self.jsonTextArea) 34 | self.dictScrollPane = JScrollPane(self.dictTextArea) 35 | 36 | self.jsonTextWrapper.add(self.jsonScrollPane, BorderLayout.CENTER) 37 | self.dictTextWrapper.add(self.dictScrollPane, BorderLayout.CENTER) 38 | 39 | self.mainPanel.add(self.jsonTextWrapper, BorderLayout.NORTH) 40 | self.mainPanel.add(self.dictTextWrapper, BorderLayout.CENTER) 41 | 42 | self.beautifyButton_1 = JButton("JSON2HTTPP", actionPerformed=self.onClick1) 43 | self.beautifyButton_2 = JButton("HTTPP2JSON", actionPerformed=self.onClick2) 44 | 45 | self.buttons = JPanel(); 46 | self.buttons.add(self.beautifyButton_1, BorderLayout.CENTER) 47 | self.buttons.add(self.beautifyButton_2, BorderLayout.CENTER) 48 | 49 | self.mainPanel.add(self.buttons, BorderLayout.SOUTH) 50 | 51 | self._cb.customizeUiComponent(self.mainPanel) 52 | self._cb.addSuiteTab(self) 53 | 54 | def onClick1(self, event): 55 | _jsontext = self.jsonTextArea.getText() 56 | try: 57 | _jsontext = json.loads(re.search(r'\({.*?}\)',_jsontext).group().replace('(','').replace(')','')) 58 | except: 59 | _jsontext = json.loads(_jsontext) 60 | self._result = [] 61 | self.dictTextArea.setText('&'.join(self.json2dict(_jsontext))) 62 | # self.dictTextArea.setText('\n'.join(self.json2dict(_jsontext))) 63 | 64 | def onClick2(self, event): 65 | _jsontext = self.jsonTextArea.getText() 66 | _res = [] 67 | for i in _jsontext.split('&'): 68 | for x in i.split('='): 69 | _res.append(x) 70 | self.dictTextArea.setText(json.dumps(dict(zip(_res[0::2],_res[1::2])))) 71 | 72 | def json2dict(self,_jsontext): 73 | keyValue = "" 74 | if isinstance(_jsontext, dict): 75 | for key in _jsontext.keys(): 76 | keyValue = _jsontext.get(key) 77 | if isinstance(keyValue, dict): 78 | self.json2dict(keyValue) 79 | elif isinstance(keyValue, list): 80 | for json_array in keyValue: 81 | self.json2dict(json_array) 82 | else: 83 | if type(keyValue) is int or type(keyValue) == long or type(keyValue) == str: 84 | self._result.append(str(key) + "=" + str(keyValue)) 85 | elif type(keyValue) is bool: 86 | self._result.append(str(key) + "=" + str(int(keyValue))) 87 | elif type(keyValue) == type(None): 88 | self._result.append(str(key) + "=" + "") 89 | else: 90 | self._result.append(str(key) + "=" + keyValue) 91 | elif isinstance(_jsontext, list): 92 | for _jsontext_array in _jsontext: 93 | self.json2dict(_jsontext_array) 94 | return self._result 95 | 96 | def getTabCaption(self): 97 | return 'JSON&HTTPP' 98 | 99 | def getUiComponent(self): 100 | return self.mainPanel 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JSON and HTTPP 2 | 3 | Burp Suite Plugin: Convert the json text that returns the body into HTTP request parameters. 4 | --------------------------------------------------------------------------------