Skip to content

Commit

Permalink
Map checksums and paths in android d2d pipeline #1366
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Sep 9, 2024
1 parent 7b2e308 commit 84d67b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions scanpipe/pipelines/android_d2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,8 @@ def steps(cls):
cls.collect_and_create_codebase_resources,
cls.map_checksum,
cls.find_java_packages,
cls.map_java_to_class,
cls.map_jar_to_source,
cls.flag_mapped_resources_archives_and_ignored_directories,
cls.remove_packages_without_resources,
cls.flag_deployed_from_resources_with_missing_license,
cls.create_local_files_packages,
cls.map_path,
)

def convert_dex_to_java(self):
d2d.convert_dex_to_java(self.project)
d2d.convert_dex_to_java(self.project, to_only=True)
11 changes: 5 additions & 6 deletions scanpipe/pipes/d2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,13 +1894,15 @@ def map_go_paths(project, logger=None):
)


def convert_dex_to_java(project):
def convert_dex_to_java(project, to_only=False):
location = project.codebase_path
abs_location = abspath(expanduser(location))
for top, _, files in fileutils.walk(abs_location):
for f in files:
if not f.endswith('.dex'):
continue
if to_only and FROM in top:
continue
loc = join(top, f)
run_jadx(location=loc)

Expand All @@ -1911,15 +1913,12 @@ def run_jadx(location):
This will decompile the classes.dex file into Java source files.
"""
rc, result, err = command.execute(
command.execute(
cmd_loc="jadx",
args=[
"-d",
f"{file_name(location)}-java",
f"{location}-out",
location,
],
to_files=False,
)

if rc != 0:
raise Exception(err)
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ scancodeio_pipelines =
analyze_docker_image = scanpipe.pipelines.docker:Docker
analyze_root_filesystem_or_vm_image = scanpipe.pipelines.root_filesystem:RootFS
analyze_windows_docker_image = scanpipe.pipelines.docker_windows:DockerWindows
android_d2d = scanpipe.pipelines.android_d2d:AndroidAPKDeployToDevelop
collect_strings_gettext = scanpipe.pipelines.collect_strings_gettext:CollectStringsGettext
collect_symbols_ctags = scanpipe.pipelines.collect_symbols_ctags:CollectSymbolsCtags
collect_symbols_pygments = scanpipe.pipelines.collect_symbols_pygments:CollectSymbolsPygments
Expand Down

0 comments on commit 84d67b9

Please sign in to comment.