diff --git a/scripts/competition.py b/scripts/competition.py index d7312deb..ea86b34f 100755 --- a/scripts/competition.py +++ b/scripts/competition.py @@ -1,32 +1,18 @@ #!/usr/bin/python import argparse -import atexit import datetime -import json -import lockfile import os -import pipes -import re -import shlex +import random import shutil -import signal -import string import stat import subprocess -import sys -import time -import random - -from math import sqrt -from os.path import basename, dirname, join, abspath, exists +from os.path import basename, join -from vars import parse_vars -from lava import LavaDatabase, Bug, Build, DuaBytes, Run, \ - run_cmd, run_cmd_notimeout, mutfile, inject_bugs, LavaPaths, \ - validate_bugs, run_modified_program, unfuzzed_input_for_bug, \ - fuzzed_input_for_bug, get_trigger_line, AttackPoint, Bug, \ +from lava import LavaDatabase, run_cmd, run_cmd_notimeout, inject_bugs, LavaPaths, \ + validate_bugs, fuzzed_input_for_bug, AttackPoint, Bug, \ get_allowed_bugtype_num, limit_atp_reuse +from vars import parse_vars # from pycparser.diversifier.diversify import diversify # from process_compile_commands import get_c_files diff --git a/scripts/lava.py b/scripts/lava.py index a24d8b17..6ff10b26 100644 --- a/scripts/lava.py +++ b/scripts/lava.py @@ -1,49 +1,43 @@ from __future__ import print_function +import math import os +import random import re -import sys -import math import shlex import struct -import random import subprocess - -from os.path import join -from os.path import dirname +import sys from os.path import abspath from os.path import basename +from os.path import dirname +from os.path import join +from subprocess import PIPE +from subprocess import check_call -from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import ForeignKey +from sqlalchemy import Table from sqlalchemy import create_engine -from sqlalchemy.types import Text -from sqlalchemy.types import Float -from sqlalchemy.types import Integer -from sqlalchemy.types import Boolean -from sqlalchemy.types import BigInteger +from sqlalchemy.dialects import postgresql +from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import load_only from sqlalchemy.orm import relationship from sqlalchemy.orm import sessionmaker -from sqlalchemy.dialects import postgresql from sqlalchemy.sql.expression import func -from sqlalchemy.ext.declarative import declarative_base - -# from multiprocessing import cpu_count -# from multiprocessing.pool import ThreadPool - -from time import sleep - -from subprocess import PIPE -from subprocess import check_call +from sqlalchemy.types import BigInteger +from sqlalchemy.types import Boolean +from sqlalchemy.types import Float +from sqlalchemy.types import Integer +from sqlalchemy.types import Text from composite import Composite - -from test_crash import process_crash - from process_compile_commands import get_c_files from process_compile_commands import process_compile_commands +from test_crash import process_crash + +# from multiprocessing import cpu_count +# from multiprocessing.pool import ThreadPool Base = declarative_base() @@ -386,7 +380,7 @@ def run_cmd(cmd, envv=None, timeout=30, cwd=None, rr=False, shell=False): env_string = "" if envv: env_string = " ".join(["{}='{}'".format(k, v) - for k, v in envv.iteritems()]) + for k, v in envv.items()]) if type(cmd) == list: print("run_cmd(" + env_string + " " + subprocess.list2cmdline(cmd) + ")") diff --git a/scripts/manual_lava.py b/scripts/manual_lava.py index 268f9f14..56a4b880 100644 --- a/scripts/manual_lava.py +++ b/scripts/manual_lava.py @@ -7,7 +7,7 @@ # ok this is gross sys.path.append("/home/tleek/git/panda-leet/panda/scripts") -from plog_reader import PLogReader +from pandare.plog_reader import PLogReader # # manual_lava.py diff --git a/scripts/patch-sources.py b/scripts/patch-sources.py deleted file mode 100644 index 4c4954aa..00000000 --- a/scripts/patch-sources.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python -import os -import sys -import shutil -import tempfile - - -def modify_sources_list(): - def replacer_fn(line): - return line.replace("# deb-src", "deb-src").replace("#deb-src", "deb-src") - - t = tempfile.mktemp() - with open("/etc/apt/sources.list") as in_file: - with open(t, "w") as out_file: - new_lines = map(replacer_fn, (line for line in in_file)) - out_file.write("\n".join(new_lines)) - - shutil.copy(t, "/etc/apt/sources.list") - os.remove(t) - - -if __name__ == "__main__": - if os.getuid() != 0: - print("Must run {} as sudo or root".format(sys.argv[0])) - exit(1) - modify_sources_list()