Skip to content

Commit

Permalink
convert setup_container to shell script. more cleanup too
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Jul 10, 2024
1 parent fffb861 commit 7ea6e16
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 532 deletions.
13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG BASE_IMAGE="ubuntu:20.04"
ARG BASE_IMAGE="ubuntu:22.04"

### BASE IMAGE
FROM $BASE_IMAGE as base
ARG BASE_IMAGE

ENV DEBIAN_FRONTEND=noninteractive
ENV LLVM_DIR=/usr/lib/llvm-11
ENV PATH="/scripts:${PATH}"

# 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 Expand Up @@ -38,13 +39,7 @@ RUN [ -e /tmp/build_dep.txt ] && \
FROM builder as developer

COPY ./tools/ /tools
COPY setup_container.py /
COPY ./scripts /scripts
COPY setup_container.py /setup_container.py

RUN python3 setup_container.py

# RUN cd /tools && \
# cmake -Bbuild -H. -DLLVM_DIR=$LLVM_DIR/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=/tools/install

# RUN cd /tools/build && \
# make && \
# make install V=1
49 changes: 0 additions & 49 deletions SETUP.md

This file was deleted.

43 changes: 0 additions & 43 deletions docker/Dockerfile

This file was deleted.

36 changes: 5 additions & 31 deletions init-host.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
from colorama import Fore
from colorama import Style

QCOW_URL = "http://panda.moyix.net/~moyix/wheezy_panda2.qcow2"
# if moyix server is down, this image will also work
# QCOW_URL = "https://panda.re/qcows/linux/debian/7.3/x86/debian_7.3_x86.qcow"
QCOW_URL = "https://panda.re/qcows/linux/debian/7.3/x86/debian_7.3_x86.qcow"
QCOW_FILE_NAME = "wheezy_panda2.qcow2"
TAR_URL = "ftp://ftp.astron.com/pub/file/file-5.22.tar.gz"
LAVA_DIR = dirname(abspath(sys.argv[0]))
os.chdir(LAVA_DIR)


def progress(msg):
Expand Down Expand Up @@ -57,20 +55,7 @@ def run(cmd):


def main():
# try to import lava.mak as a config file if not exit
try:
def_lines = (line.strip() for line in open("lava.mak", "r")
if not line.strip().startswith("#")
and line.strip() != "")
def_lines = (line.split(":=") for line in def_lines)
def_lines = ((line[0].strip(), line[1].strip()) for line in def_lines)
LAVA_CONFS = dict(def_lines)
PANDA_BUILD_DIR = LAVA_CONFS["PANDA_BUILD_DIR"]
PANDA_BUILD_DIR = expandvars(PANDA_BUILD_DIR)
print("PANDA_BUILD_DIR Used {}".format(PANDA_BUILD_DIR))
except Exception:
error("Make sure to have properly configured lava.mak \
generated by setup.py")

# parser = argparse.ArgumentParser(description='Setup LAVA')
# parser.add_argument('-s', '--skip_docker_build', action='store_true',
# default = False,
Expand All @@ -87,9 +72,7 @@ def main():
# summon tar and qcow files
if not isfile(join(TAR_DIR, basename(TAR_URL))):
progress("Downloading %s".format(basename(TAR_URL)))
os.chdir(TAR_DIR)
run(["wget", TAR_URL])
os.chdir(LAVA_DIR)
run(["wget", TAR_URL], cwd=TAR_DIR)
else:
progress("Found existing target_bins/{}".format(basename(TAR_URL)))

Expand All @@ -103,8 +86,7 @@ def main():
progress("Building host.json")
# Build host.json
json_configs = {}
json_configs["qemu"] = join(join(PANDA_BUILD_DIR, "i386-softmmu"),
"qemu-system-i386")
json_configs["qemu"] = "anda-system-i386"
json_configs["qcow_dir"] = LAVA_DIR
json_configs["output_dir"] = join(LAVA_DIR, "target_injections")
json_configs["config_dir"] = join(LAVA_DIR, "target_configs")
Expand All @@ -119,15 +101,7 @@ def main():
else:
progress("Found existing host.json")

# progress("(re)building the fbi")
# os.chdir(join(LAVA_DIR, "tools", "build", "fbi"))
# run(["make", "install", "-j4"])

# progress("(re)building lavaTool")
# os.chdir(join(LAVA_DIR, "tools", "build", "lavaTool"))
# run(["./compile-on-docker.sh"])

progress("Sucessful! Now run:\n $ scripts/lava.sh -ak file")
progress("Successful! Now run:\n $ scripts/lava.sh -ak file")
return 0


Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions scripts/manual_lava.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import re
import sys
import random
import subprocess as sp
import sys

# ok this is gross
sys.path.append("/home/tleek/git/panda-leet/panda/scripts")

from pandare.plog_reader import PLogReader

#
Expand Down
Loading

0 comments on commit 7ea6e16

Please sign in to comment.