예제 #1
0
 def asm_calc_disasm(self):
     inputdata = self.txtasm_input.toPlainText()
     try:
         buff=Util.StrToHexSplit(inputdata)
         res=AsmUtil.disasm(self.cmbasm.currentIndex(),buff)
         self.txtasm_output.setPlainText(res)
     except Exception as ex:
         self.appendLog("解析异常.请检查数据和模式是否正确."+str(ex))
         self.txtasm_output.setPlainText("")
예제 #2
0
 def binformat_calc_str(self):
     inputdata = self.txtbinformat_input.toPlainText()
     try:
         buff = Util.StrToHexSplit(inputdata)
         res = Util.hex2str(buff)
         self.txtbinformat_output.setPlainText(res)
     except Exception as ex:
         self.appendLog("转换异常:" + str(ex))
         self.txtbinformat_output.setPlainText("")
예제 #3
0
 def protoc_calc(self):
     inputdata=self.txtprotoc_input.toPlainText()
     try:
         if "  " in inputdata:
             data=Util.HexdumpReplaceLeftRight(inputdata)
             data = Util.StrToHexSplit(data)
         elif " " not in inputdata:
             data = Util.ByteToHexStr(inputdata)
             data=Util.StrToHexSplit(data)
         else:
             data = Util.StrToHexSplit(inputdata)
         if self.iswin():
             res=Util.execProcess("../exec/win/protoc.exe","--decode_raw",data)
             self.txtprotoc_output.setPlainText(res.decode("utf-8"))
         else:
             res = Util.execProcess("..\exec\linux\protoc", "--decode_raw", data)
             self.txtprotoc_output.setPlainText(res.decode("utf-8"))
     except Exception as ex:
         self.appendLog(str(ex))
         self.txtprotoc_output.setPlainText("")
예제 #4
0
 def varint_calc_decode(self):
     inputdata = self.txtvarint_input.toPlainText()
     if len(inputdata)<=0:
         self.appendLog("varint input为空")
         return
     try:
         if " " not in inputdata:
             inputdata=Util.ByteToHexStr(inputdata)
         buff = Util.StrToHexSplit(inputdata)
         res = Util.varint_decode(buff)
         self.txtvarint_output.setPlainText(str(res))
     except Exception as ex:
         self.appendLog(str(ex))
         self.txtvarint_output.setPlainText("")
예제 #5
0
 def save_file(self):
     output=self.txtbase64_output.toPlainText()
     if len(output)<=2:
         self.appendLog("错误的输出结果.无法保存")
         return
     savefile= QFileDialog.getSaveFileName()[0]
     if len(savefile)<=0:
         self.appendLog("取消选择文件")
         return
     try:
         res=Util.StrToHexSplit(output)
         #开始保存
         with open(savefile,"wb") as myfile:
             myfile.write(res)
             self.appendLog("保存成功到:"+savefile)
     except Exception as ex:
         self.appendLog(str(ex))