Skip to content

Commit 67c1a69

Browse files
author
Owen Jones
committed
Add option to specify location of models.jar
1 parent 66735ca commit 67c1a69

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

driver/run.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
def _get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
1616

1717

18-
def _get_common_libraries():
18+
def _get_common_libraries(diffblue_models_library_location):
1919

2020
def get_benchmark_library_dir():
2121
return os.path.abspath(os.path.join(_get_my_dir(), "../benchmarks/LIBRARIES"))
2222

23-
def get_diffblue_models_library_props():
23+
def get_diffblue_models_library_props(pathname):
2424
props = {"diffblue_models_library": {"paths": [], "error": None}}
25-
pathname = os.path.join(get_benchmark_library_dir(), "models", "model", "target", "models.jar")
25+
if pathname is None:
26+
pathname = os.path.join(get_benchmark_library_dir(), "models", "model", "target", "models.jar")
2627
if os.path.isfile(pathname):
2728
props["diffblue_models_library"]["paths"].append(pathname)
2829
else:
@@ -82,7 +83,7 @@ def get_javax_xxe_library_props():
8283
return props
8384

8485
result = {}
85-
result.update(get_diffblue_models_library_props())
86+
result.update(get_diffblue_models_library_props(diffblue_models_library_location))
8687
result.update(get_java_runtime_library())
8788
result.update(get_apache_tomcat_props())
8889
result.update(get_spring_framework_props())
@@ -162,6 +163,9 @@ def create_parser():
162163
parser.add_argument("--use-models-library", action="store_true",
163164
help="Add the Diffblue Models Library's JAR file to the classpath of the security-scanner. "
164165
"It will be put in front of the JARs of the analysed web application.")
166+
parser.add_argument("--models-library-location", type=str,
167+
help="Absolute path of the models library. Only works if --use-models-library is set. (Will be "
168+
"removed soon)")
165169
parser.add_argument("--use-java-runtime-library", action="store_true",
166170
help="Add the Java standard library to the classpath. First, there will be attempt to add "
167171
"OpenJDK version of the library. If it is not found (e.g. not installed), then the "
@@ -428,7 +432,7 @@ def __main():
428432
analyser.get_missing_binary_error_message())
429433
return
430434

431-
common_libraries = _get_common_libraries()
435+
common_libraries = _get_common_libraries(cmdline.models_library_location)
432436

433437
if cmdline.use_models_library:
434438
if common_libraries["diffblue_models_library"]["error"] is not None:

0 commit comments

Comments
 (0)