Update HaE.py

Fixed Bug
This commit is contained in:
key
2020-05-05 11:37:16 +08:00
committed by GitHub
parent af626dffcd
commit 5f9955531b

View File

@@ -109,19 +109,19 @@ class BurpExtender(IBurpExtender, ITab,IHttpListener, IMessageEditorTabFactory):
isHighlight = int(self.highlightCheckBox.isSelected()) isHighlight = int(self.highlightCheckBox.isSelected())
isExtract = int(self.extractCheckBox.isSelected()) isExtract = int(self.extractCheckBox.isSelected())
if colorText in colors: if colorText in colors:
with open(configFile, 'r+') as content: # 获取配置文件信息
content = open(configFile, 'r')
dicts = json.load(content) dicts = json.load(content)
content.close()
# 读写判断
if nameText in dicts: if nameText in dicts:
self.tipString.setText("Name is existed!") self.tipString.setText("Name is existed!")
elif not(isHighlight or isExtract): elif not(isHighlight or isExtract):
self.tipString.setText("Highlight or Extract?") self.tipString.setText("Highlight or Extract?")
else: else:
# 解决r+写入问题
content.seek(0,0)
content.truncate()
dicts[nameText] = {"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText} dicts[nameText] = {"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}
content.write(jsbeautifier.beautify(json.dumps(dicts))) with open(configFile, 'w') as configContent:
#print(dicts) configContent.write(jsbeautifier.beautify(json.dumps(dicts)))
self.tipString.setText("Save Successfully!") self.tipString.setText("Save Successfully!")
else: else:
self.tipString.setText("Not in colors list.") self.tipString.setText("Not in colors list.")