Terminal顯示結果
```
event failure executing tBot: fuzzer queryTBotDict() missing 1 required positional argument: 'TBotName' exitAlgorithm executed!
>>> 17.23: before addTestLog: {'player': 'fuzzer', 'type': 'action', 'contents': ["queryTBotDict() missing 1 required positional a
>>> 17.24: after addTestLog
>>> 17.26: before returning from api.addIssueReport()
Posting message: {'op': 'postMessageInDialogPanel', 'player': 'fuzzer', 'texts': ['return ', " with queryTBotDict() missing 1 required positional argument: 'TBotName'"], 'timeStamp': '上午 03:23:18', 'dateStamp': '2023/9/21'}
postMessage: return
with queryTBotDict() missing 1 required positional argument: 'TBotName'
postMessage(2): return
with queryTBotDict() missing 1 required positional argument: 'TBotName'
```
Code
```
from __future__ import print_function # (at top of module)
# -------------------------------------------------------------------------------
# fuzzer: a cross-platform and cross-app fuzzer based on Test-Dragon intelligent API
#
# Goal: Improving the oracle and fuzzer methods for bombarding the forms and urls with mal-formed input.
# 1. The oracle function is initially for detecting 404 and 503 web errors.
# The students need improve the oracle method.
# 2. The fuzzer function is in three methods: fuzzForm, fuzzGets, fuzzUrls.
# The students may improve these or develop other techniques for fuzz testing.
#
# Author: Farn Wang
#
# Created: 5/10/2023
# Copyright: (c) Farn Wang
# Licence:
# -------------------------------------------------------------------------------
import time
import cv2
import random
import sys
import os.path
import os
import sys
import copy
import numpy as np
'''
from skimage.measure import compare_ssim
import pytesseract
from pytesseract import Output
import threading
'''
if sys.version_info[0] < 3: # Python 2 and 3:
# to execute the file, type in the following command in powershell:
# % python CnTaaDPackage.py build_ext --inplace
import future # pip install future
import builtins # pip install future
import past # pip install future
import six # pip install six
import json
addIssueReportExpDict2 = {
"recordType": 'verdict',
"verdict": "failure!",
"component": "network, web server, browser, url",
"subject": "web server operational error {0}",
"summary": "web browser {0} on {1}",
"environment": ['windows'],
"contents": ["Page not found!"],
"features": ['404', 'page not found'],
"diagnosis": "url not processed, could be a user authentication issue",
"suggestions": "It is better to direct {0} page to the main page with an alert!",
"severity": "low",
"priority": 1
}
# The students are expected to implement and improve oracle, fuzzForm, fuzzGets, fuzzUrls.
class fuzzer:
def __init__(self, curAPI, *args):
self.API = curAPI
self.countStep = 0
# After you click to execute fuzzer TBot, Test-Dragon will call this method after analyzing
# each screen DOM.
# The method is expected to return a test action suggestion, usually as an action index (with test data),
# or as a special string for test command.
def getTestInput(self):
print('-------------------------------------------------------')
queryTBotDict = self.API.TBotMan.queryTBotDict()
print(f'{queryTBotDict}')
print(type(queryTBotDict))
print('-------------------------------------------------------')
return "exitAlgorithm", "enough!"
def main():
pass
if __name__ == '__main__':
main()
```
Terminal顯示結果
``` event failure executing tBot: fuzzer queryTBotDict() missing 1 required positional argument: 'TBotName' exitAlgorithm executed! >>> 17.23: before addTestLog: {'player': 'fuzzer', 'type': 'action', 'contents': ["queryTBotDict() missing 1 required positional a >>> 17.24: after addTestLog >>> 17.26: before returning from api.addIssueReport() Posting message: {'op': 'postMessageInDialogPanel', 'player': 'fuzzer', 'texts': ['return ', " with queryTBotDict() missing 1 required positional argument: 'TBotName'"], 'timeStamp': '上午 03:23:18', 'dateStamp': '2023/9/21'} postMessage: return with queryTBotDict() missing 1 required positional argument: 'TBotName' postMessage(2): return with queryTBotDict() missing 1 required positional argument: 'TBotName' ```Code
``` from __future__ import print_function # (at top of module) # ------------------------------------------------------------------------------- # fuzzer: a cross-platform and cross-app fuzzer based on Test-Dragon intelligent API # # Goal: Improving the oracle and fuzzer methods for bombarding the forms and urls with mal-formed input. # 1. The oracle function is initially for detecting 404 and 503 web errors. # The students need improve the oracle method. # 2. The fuzzer function is in three methods: fuzzForm, fuzzGets, fuzzUrls. # The students may improve these or develop other techniques for fuzz testing. # # Author: Farn Wang # # Created: 5/10/2023 # Copyright: (c) Farn Wang # Licence: # ------------------------------------------------------------------------------- import time import cv2 import random import sys import os.path import os import sys import copy import numpy as np ''' from skimage.measure import compare_ssim import pytesseract from pytesseract import Output import threading ''' if sys.version_info[0] < 3: # Python 2 and 3: # to execute the file, type in the following command in powershell: # % python CnTaaDPackage.py build_ext --inplace import future # pip install future import builtins # pip install future import past # pip install future import six # pip install six import json addIssueReportExpDict2 = { "recordType": 'verdict', "verdict": "failure!", "component": "network, web server, browser, url", "subject": "web server operational error {0}", "summary": "web browser {0} on {1}", "environment": ['windows'], "contents": ["Page not found!"], "features": ['404', 'page not found'], "diagnosis": "url not processed, could be a user authentication issue", "suggestions": "It is better to direct {0} page to the main page with an alert!", "severity": "low", "priority": 1 } # The students are expected to implement and improve oracle, fuzzForm, fuzzGets, fuzzUrls. class fuzzer: def __init__(self, curAPI, *args): self.API = curAPI self.countStep = 0 # After you click to execute fuzzer TBot, Test-Dragon will call this method after analyzing # each screen DOM. # The method is expected to return a test action suggestion, usually as an action index (with test data), # or as a special string for test command. def getTestInput(self): print('-------------------------------------------------------') queryTBotDict = self.API.TBotMan.queryTBotDict() print(f'{queryTBotDict}') print(type(queryTBotDict)) print('-------------------------------------------------------') return "exitAlgorithm", "enough!" def main(): pass if __name__ == '__main__': main() ```