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,20 +109,20 @@ 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: # 获取配置文件信息
dicts = json.load(content) content = open(configFile, 'r')
if nameText in dicts: dicts = json.load(content)
self.tipString.setText("Name is existed!") content.close()
elif not(isHighlight or isExtract): # 读写判断
self.tipString.setText("Highlight or Extract?") if nameText in dicts:
else: self.tipString.setText("Name is existed!")
# 解决r+写入问题 elif not(isHighlight or isExtract):
content.seek(0,0) self.tipString.setText("Highlight or Extract?")
content.truncate() else:
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.")
@@ -232,4 +232,4 @@ class MarkINFOTab(IMessageEditorTab):
result += "[{}] {}\n".format(i,contents[i]) result += "[{}] {}\n".format(i,contents[i])
self._txtInput.setText(result) self._txtInput.setText(result)
else: else:
return False return False