minxss_beacon_decoder.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:MinXSS_Beacon_Decoder 作者: jmason86 项目源码 文件源码
def setupOutputLog(self):
        """
        Purpose:
            Create the output files for a human readable hex interpretation of the MinXSS data and a binary file
        Input:
            None
        Output:
            A .tex file with hex MinXSS data and a .dat file with binary MinXSS data
        """
        # Human readable log
        if not os.path.exists(os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output")):
            os.makedirs(os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output"))
        self.bufferOutputFilename = os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output", datetime.datetime.now().isoformat().replace(':', '_')) + ".txt"

        with open(self.bufferOutputFilename, 'w') as bufferOutputLog:
            # Update the GUI for the log file - is saving
            self.textBrowser_savingToLogFile.setText("Saving to log file: " + self.bufferOutputFilename)
            palette = QtGui.QPalette()
            palette.setColor(QtGui.QPalette.Text, QColor(55, 195, 58))  # Green
            self.textBrowser_savingToLogFile.setPalette(palette)
        bufferOutputLog.closed

        # Binary log
        if not os.path.exists(os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output")):
            os.makedirs(os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output"))
        latitude = self.lineEdit_latitude.text()
        longitude = self.lineEdit_longitude.text()

        self.bufferOutputBinaryFilename = os.path.join(os.path.expanduser("~"), "MinXSS_Beacon_Decoder", "output", datetime.datetime.now().isoformat().replace(':', '_')) + "_" + latitude + "_" + longitude + ".dat"

        with open(self.bufferOutputBinaryFilename, 'w') as bufferOutputBinaryLog:
            self.log.info("Opening binary file for buffer data")
        bufferOutputBinaryLog.closed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号