|
15 | 15 | def _get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
|
16 | 16 |
|
17 | 17 |
|
18 |
| -def _get_common_libraries(): |
| 18 | +def _get_common_libraries(diffblue_models_library_location): |
19 | 19 |
|
20 | 20 | def get_benchmark_library_dir():
|
21 | 21 | return os.path.abspath(os.path.join(_get_my_dir(), "../benchmarks/LIBRARIES"))
|
22 | 22 |
|
23 |
| - def get_diffblue_models_library_props(): |
| 23 | + def get_diffblue_models_library_props(pathname): |
24 | 24 | 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") |
26 | 27 | if os.path.isfile(pathname):
|
27 | 28 | props["diffblue_models_library"]["paths"].append(pathname)
|
28 | 29 | else:
|
@@ -82,7 +83,7 @@ def get_javax_xxe_library_props():
|
82 | 83 | return props
|
83 | 84 |
|
84 | 85 | result = {}
|
85 |
| - result.update(get_diffblue_models_library_props()) |
| 86 | + result.update(get_diffblue_models_library_props(diffblue_models_library_location)) |
86 | 87 | result.update(get_java_runtime_library())
|
87 | 88 | result.update(get_apache_tomcat_props())
|
88 | 89 | result.update(get_spring_framework_props())
|
@@ -162,6 +163,9 @@ def create_parser():
|
162 | 163 | parser.add_argument("--use-models-library", action="store_true",
|
163 | 164 | help="Add the Diffblue Models Library's JAR file to the classpath of the security-scanner. "
|
164 | 165 | "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)") |
165 | 169 | parser.add_argument("--use-java-runtime-library", action="store_true",
|
166 | 170 | help="Add the Java standard library to the classpath. First, there will be attempt to add "
|
167 | 171 | "OpenJDK version of the library. If it is not found (e.g. not installed), then the "
|
@@ -428,7 +432,7 @@ def __main():
|
428 | 432 | analyser.get_missing_binary_error_message())
|
429 | 433 | return
|
430 | 434 |
|
431 |
| - common_libraries = _get_common_libraries() |
| 435 | + common_libraries = _get_common_libraries(cmdline.models_library_location) |
432 | 436 |
|
433 | 437 | if cmdline.use_models_library:
|
434 | 438 | if common_libraries["diffblue_models_library"]["error"] is not None:
|
|
0 commit comments