Skip to content

Commit

Permalink
Replace old create_recording with new pypanda api
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Jul 11, 2024
1 parent 9f20d68 commit 1200248
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ARG BASE_IMAGE
ENV DEBIAN_FRONTEND=noninteractive
ENV LLVM_DIR=/usr/lib/llvm-11
ENV PATH="/scripts:${PATH}"
# To avoid any protobuf incompatible version issues
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

# Copy dependencies lists into container. We copy them all and then do a mv because
# we need to transform base_image into a windows compatible filename which we can't
Expand Down
19 changes: 15 additions & 4 deletions scripts/bug_mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
curtail = 0


# Replace
# https://github.com/panda-re/panda/blob/dev/panda/scripts/run_guest.py
# https://docs.panda.re/#recordings
# https://github.com/panda-re/panda/blob/dev/panda/python/core/pandare/panda.py#L2595-L2645
def create_recording(qemu_path_name, command, copy_directory, iso_name):
# I assume qemu_path is just 'panda-system-i386', `panda-system-x86_64`, etc.
from pandare import Panda
panda = Panda(arch=qemu_path_name.split('-')[-1])
guest_command = subprocess.list2cmdline(command)
panda.record_cmd(guest_command=guest_command, copy_directory=copy_directory, iso_name=iso_name)


def tick():
global start_time
start_time = time.time()
Expand Down Expand Up @@ -102,7 +114,8 @@ def progress(msg):
panda_scripts_dir = join(src_path, 'panda', 'scripts')
sys.path.append(panda_scripts_dir)

from run_guest import create_recording

from os.path import abspath, join

chaff = project.get('chaff', False)

Expand All @@ -129,9 +142,7 @@ def progress(msg):
input_file=input_file_guest))
shutil.copy(input_file, installdir)

create_recording(qemu_path, project['qcow'], project['snapshot'],
command_args, installdir, isoname,
project["expect_prompt"], 'ide1-cd0', rr=qemu_use_rr)
create_recording(qemu_path, command_args, copy_directory=installdir, iso_name=isoname)

try:
os.mkdir('inputs')
Expand Down

0 comments on commit 1200248

Please sign in to comment.