pyinstaller -F -i xx.ico setup.py 打包指定exe图标打包
#! /usr/bin/python3
# -*- encoding:utf-8 -*-
import sys
import os
#import get_api_list
#import python
from PyQt5.QtWidgets import (QWidget,QApplication,QPushButton,QLabel,QLineEdit,QHBoxLayout,QVBoxLayout, QGridLayout, QTextEdit)
#import PyQt5.Qt
#from PyQt5.QtGui import QIcon
CODE_DIR = os.getcwd()
#func = sys.argv[1]
#print(CODE_DIR)
class Fuzzerbox(QWidget):
def __init__(self):
super().__init__()
self.initUI()
self.funcName = ''
def initUI(self):
self.btn = QPushButton("start", self)
self.btn.resize(self.btn.sizeHint())
self.funcEdit = QLineEdit()
self.funcEdit.resize(100,10)
resultLabel = QLabel('result')
result = QLabel('none')
logEdit = QTextEdit()
#layout
#button + funcName
hbox = QHBoxLayout()
hbox.addWidget(self.btn)
hbox.addWidget(self.funcEdit)
hbox.addStretch(1)
#result + pass/fail
hbox1 = QHBoxLayout()
hbox1.addWidget(resultLabel)
hbox1.addWidget(result)
#log
hbox2 = QHBoxLayout()
hbox2.addWidget(logEdit)
vbox = QVBoxLayout()
vbox.addLayout(hbox)
vbox.addLayout(hbox1)
vbox.addLayout(hbox2)
self.setLayout(vbox)
#single handle
self.funcEdit.textChanged.connect(self.funcChanged)
self.btn.clicked.connect(self.startTest)
#window title 16:9
self.setGeometry((QApplication.desktop().width() - self.width())/2, (QApplication.desktop().height() - self.height())/2, 960, 540)
self.move((QApplication.desktop().width() - self.width())/2, (QApplication.desktop().height() - self.height())/2)
self.setWindowTitle('fuzzerTest')
self.show()
def funcChanged(self, funcName):
#if (funcName)需要判断funcName合法性
self.funcName = funcName
def startTest(self):
#需要判断self.funcName是否为null
print(self.funcName)
try:
os.system('rm -rf crash*')
os.system('rm -rf slow*')
#模糊测试函数的生成
python.get_common_file()
python.dir_pro(CODE_DIR)
for fileName in fileNames:
if './lib' in name:
continue
python.file_chk(name, sys.argv[1])
#编译
os.system('make clean')
os.system('export PATH=/bin:$PATH')
os.system('make ssp4_test_fuzzer VERSION=RELEASE _GCC_TYPE=SSPFUZZER')
os.system('chmod 777 fuzzer_main')
os.system('./fuzzer_main -max_len=4096 -max_total_time=3 2>&1 | tee ${sys.argv[1]}.log')
exeResult = os.system("cat ${func}.log | grep 'Done'")
if (0 == exeResult)
{
qlb.setText('pass')
}
else
{
logStr = os.popen("cat ${func}.log")
qlb.setText('fail')
qle.setText(str(logStr))
}
except Exception:
return 0
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Fuzzerbox()
sys.exit(app.exec_())