def test_list_artifacts(self): fuzzer = Fuzzer(MockDevice(), u'mock-package1', u'mock-target1') artifacts = fuzzer.list_artifacts() self.assertEqual(len(artifacts), 3) self.assertTrue('crash-deadbeef' in artifacts) self.assertTrue('leak-deadfa11' in artifacts) self.assertTrue('oom-feedface' in artifacts) self.assertFalse('fuzz-0.log' in artifacts)
def test_repro(self): mock_device = MockDevice() fuzzer = Fuzzer(mock_device, u'mock-package1', u'mock-target2') artifacts = ['data/' + artifact for artifact in fuzzer.list_artifacts()] fuzzer.repro(['-some-lf-arg=value']) self.assertEqual( mock_device.last, 'ssh -F ' + mock_device.host.ssh_config + ' ::1 run ' + fuzzer.url() + ' -artifact_prefix=data ' + '-some-lf-arg=value ' + ' '.join(artifacts))
def test_repro(self): mock_device = MockDevice() fuzzer = Fuzzer(mock_device, u'mock-package1', u'mock-target2') artifacts = ['data/' + artifact for artifact in fuzzer.list_artifacts()] fuzzer.repro(['-some-lf-arg=value']) self.assertIn( ' '.join( mock_device.get_ssh_cmd( [ 'ssh', '::1', 'run', fuzzer.url(), '-artifact_prefix=data/', '-some-lf-arg=value' ] + artifacts)), mock_device.host.history)
def main(): parser = Args.make_parser( description='Reports status for the fuzzer matching NAME if provided, ' + 'or for all running fuzzers. Status includes execution state, corpus ' + 'size, and number of artifacts.', name_required=False) args = parser.parse_args() host = Host() device = Device.from_args(host, args) fuzzers = Fuzzer.filter(host.fuzzers, args.name) pids = device.getpids() silent = True for pkg, tgt in fuzzers: fuzzer = Fuzzer(device, pkg, tgt) if not args.name and tgt not in pids: continue silent = False if tgt in pids: print(str(fuzzer) + ': RUNNING') else: print(str(fuzzer) + ': STOPPED') print(' Output path: ' + fuzzer.data_path()) print(' Corpus size: %d inputs / %d bytes' % fuzzer.measure_corpus()) artifacts = fuzzer.list_artifacts() if len(artifacts) == 0: print(' Artifacts: None') else: print(' Artifacts: ' + artifacts[0]) for artifact in artifacts[1:]: print(' ' + artifact) if silent: print( 'No fuzzers are running. Include \'name\' to check specific fuzzers.' ) return 1 return 0