Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/fosslight_binary/_jar_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@
import logging
import json
import os
import subprocess
import sys
import fosslight_util.constant as constant
from ._binary import BinaryItem, OssItem, VulnerabilityItem
from dependency_check import run as dependency_check_run


logger = logging.getLogger(constant.LOGGER_NAME)


def run_analysis(params, func):
try:
sys.argv = params
func()
except SystemExit:
pass
except Exception as ex:
logger.error(f"Run Analysis : {ex}")


def get_oss_ver(version):
oss_version = ""

Expand Down Expand Up @@ -98,9 +109,11 @@ def analyze_jar_file(path_to_find_bin):
vulnerability_items = {}

try:
command = f"dependency-check --scan {path_to_find_bin} --out {path_to_find_bin} --disableArchive --disableAssembly --disableRetireJS --disableNodeJS \
--disableNodeAudit --disableNugetconf --disableNuspec --disableOpenSSL --disableOssIndex --disableBundleAudit -f ALL"
subprocess.run(command, shell=True)
command = ['dependency-check', '--scan', f'{path_to_find_bin}', '--out', f'{path_to_find_bin}',
'--disableArchive', '--disableAssembly', '--disableRetireJS', '--disableNodeJS',
'--disableNodeAudit', '--disableNugetconf', '--disableNuspec', '--disableOpenSSL',
'--disableOssIndex', '--disableBundleAudit', '-f', 'ALL']
run_analysis(command, dependency_check_run)

json_file = os.path.join(path_to_find_bin, 'dependency-check-report.json')

Expand Down