(self, iteration=0)
| 712 | return libs |
| 713 | |
| 714 | def setup_fuzzer(self, iteration=0): |
| 715 | # do fuzzer-sysconfig |
| 716 | self.fuzz_sysconfig() |
| 717 | # create output dir for this campaign on host |
| 718 | # upload fuzzer |
| 719 | fuzzer_path = os.path.join(device_path, self.meta_device_id, "fuzzer") |
| 720 | if not os.path.exists(fuzzer_path): |
| 721 | print(f"[ORC] fuzzer not compiled! {fuzzer_path}") |
| 722 | logging.error(f"fuzzer not compiled! {fuzzer_path}") |
| 723 | raise Exception |
| 724 | seedinfo_path = os.path.join(device_path, self.meta_device_id, "seedinfo") |
| 725 | fuzzer_remote_path = os.path.join( |
| 726 | FUZZER_PATH, os.path.basename(fuzzer_path) |
| 727 | ) |
| 728 | _, err = adb.execute_privileged_command( |
| 729 | f"mkdir -p {FUZZER_PATH}", device_id=self.device_id |
| 730 | ) |
| 731 | if err: |
| 732 | logging.error(f"failed setting up directory: {FUZZER_PATH}, {err}") |
| 733 | raise Exception |
| 734 | if not adb.path_exists(fuzzer_remote_path, device_id=self.device_id): |
| 735 | adb.push_privileged( |
| 736 | fuzzer_path, FUZZER_PATH, device_id=self.device_id |
| 737 | ) |
| 738 | adb.execute_privileged_command( |
| 739 | f"chmod +x {fuzzer_remote_path}", device_id=self.device_id |
| 740 | ) |
| 741 | adb.push_privileged( |
| 742 | seedinfo_path, FUZZER_PATH, device_id=self.device_id |
| 743 | ) |
| 744 | adb.execute_privileged_command( |
| 745 | f"rm {PID_PATH}", device_id=self.device_id |
| 746 | ) |
| 747 | adb.execute_privileged_command( |
| 748 | f"rm {PID_ACK_PATH}", device_id=self.device_id |
| 749 | ) |
| 750 | if not adb.path_exists(FUZZ_DATA_PATH, device_id=self.device_id): |
| 751 | adb.execute_privileged_command( |
| 752 | f"mkdir -p {FUZZ_DATA_PATH}", device_id=self.device_id |
| 753 | ) |
| 754 | else: |
| 755 | # clean fuzz output folder |
| 756 | adb.execute_privileged_command( |
| 757 | f"rm -rf {FUZZ_DATA_PATH}/*", device_id=self.device_id |
| 758 | ) |
| 759 | no_seeds = True |
| 760 | if self.corpus_dirs is not None: |
| 761 | for corpus_dir in self.corpus_dirs: |
| 762 | if corpus_dir is not None and len(os.listdir(corpus_dir)) > 0: |
| 763 | corpus_dir = corpus_dir.rstrip("/") |
| 764 | # upload seed corpus |
| 765 | adb.push_privileged( |
| 766 | corpus_dir, |
| 767 | FUZZ_DATA_PATH, |
| 768 | is_directory=True, |
| 769 | device_id=self.device_id |
| 770 | ) |
| 771 | no_seeds = False |
no test coverage detected