Permalink
Browse files

config cleanup and hangsAreCrashes support

  • Loading branch information...
dobin committed Jun 2, 2018
1 parent 475f0c6 commit 315677931e6900b1eb39fc979b67f2898f79c066
Showing with 22 additions and 9 deletions.
  1. +12 −3 defaultconfig.py
  2. +4 −0 honggmode/honggslave.py
  3. +6 −6 network/networkmanager.py
@@ -29,7 +29,10 @@
"handle_corefiles": False,
# have a special app protocol implemented? use it here
"proto": None,
# this will load protocol.py in the projdir
# the instance of protocol.py will be stored in protocolInstance
"use_protocol": False,
"protocolInstance": None,
# the maximum network message number we will look at
# (send, replay, test etc.)
@@ -62,12 +65,18 @@
# Directory of verified files
"verified_dir": "verified",
"protoObj": None,
# restart server every X fuzzing iterations
"restart_server_every": 10000,
# how long we wait for an server answer
"recvTimeout": 0.03, # 30/s
# how long we wait to check if the server is up/down
"connectTimeout": 0.2,
# hides the target server stdout - or not (on certain phases)
"hideTargetStdout": True,
# Interpret hangs as crashes. Mostly experimental.
"hangsAreCrashes": False,
}
@@ -241,6 +241,10 @@ def realDoActualFuzz(self):
logging.error("Honggfuzz server crashed? Killed?")
return
if self.config['hangsAreCrashes']:
self._handleCrash(honggCorpusData, 'hang')
self.iterStats["crashCount"] += 1
haveCheckedTargetIsAlive = False
# honggfuzz says: new basic-block found
@@ -103,8 +103,8 @@ def receiveDataTcp(self, message=None):
try:
data = self.sock.recv(1024)
logging.debug("Received: " + str(data))
if self.config["protoObj"] is not None and message is not None:
self.config["protoObj"].onPostRecv(data, message["index"])
if self.config["protocolInstance"] is not None and message is not None:
self.config["protocolInstance"].onPostRecv(data, message["index"])
return data
except Exception as e:
logging.info("NET ReceiveData err on msg " + str(message["index"]) + ": " + str(e))
@@ -158,8 +158,8 @@ def sendDataUdp(self, message=None):
sys.exit(1)
try:
if self.config["protoObj"] is not None and message is not None:
message["data"] = self.config["protoObj"].onPreSend(message["data"], message["index"])
if self.config["protocolInstance"] is not None and message is not None:
message["data"] = self.config["protocolInstance"].onPreSend(message["data"], message["index"])
self.sock.sendto(message["data"], ('127.0.0.1', self.targetPort))
except socket.error as exc:
@@ -173,8 +173,8 @@ def receiveDataUdp(self, message=None):
"""Receive data from the server."""
try:
data, addr = self.sock.recvfrom(1024)
if self.config["protoObj"] is not None and message is not None:
self.config["protoObj"].onPostRecv(data, message["index"])
if self.config["protocolInstance"] is not None and message is not None:
self.config["protocolInstance"].onPostRecv(data, message["index"])
return data
except Exception as e:
logging.info("NET ReceiveData err on msg " + str(message["index"]) + ": " + str(e))

0 comments on commit 3156779

Please sign in to comment.