forked from fkie-cad/fact_extractor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into task-server
- Loading branch information
Showing
27 changed files
with
286 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build CI | ||
run-name: Build CI | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
schedule: | ||
- cron: "0 2 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-ci: | ||
runs-on: [ self-hosted, linux, x64, focal ] | ||
timeout-minutes: 45 | ||
steps: | ||
- name: Add Masks | ||
run: | | ||
echo "::add-mask::${{ secrets.NETWORK_MASK_1 }}" | ||
echo "::add-mask::${{ secrets.NETWORK_MASK_2 }}" | ||
echo "::add-mask::${{ secrets.NETWORK_MASK_3 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_1 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_2 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_3 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_4 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_5 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_6 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_7 }}" | ||
echo "::add-mask::${{ secrets.INTERNAL_NODE_8 }}" | ||
echo "::add-mask::${{ secrets.SECRET_STRING_1 }}" | ||
echo "::add-mask::${{ secrets.SECRET_STRING_2 }}" | ||
echo "::add-mask::${{ secrets.SECRET_STRING_3 }}" | ||
- name: Checkout Branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
- name: Set ulimit | ||
run: ulimit -n 9999 | ||
- name: Pre-Installation | ||
shell: 'script -q -e -c "bash {0}"' | ||
run: ./fact_extractor/install/pre_install.sh | ||
- name: Install fact_extractor | ||
shell: 'script -q -e -c "bash {0}"' | ||
run: ./fact_extractor/install.py | ||
- name: Unit Tests | ||
shell: 'script -q -e -c "bash {0}"' | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions
26
fact_extractor/plugins/unpacking/android_simg/code/android_simg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
''' | ||
This plugin "unpacks" Android sparse image by converting them to regular filesystem images using the simg2img tool | ||
''' | ||
import logging | ||
from pathlib import Path | ||
|
||
from common_helper_process import execute_shell_command | ||
|
||
NAME = 'Android-sparse-image' | ||
MIME_PATTERNS = ['filesystem/android-simg'] | ||
VERSION = '0.1' | ||
|
||
|
||
def unpack_function(file_path, tmp_dir): | ||
extract_dir = Path(tmp_dir) | ||
file_to_unpack = Path(file_path) | ||
output = execute_shell_command(f'simg2img {file_path} {extract_dir / file_to_unpack.name}.raw') + '\n' | ||
meta_data = {'output': output} | ||
logging.debug(output) | ||
return meta_data | ||
|
||
|
||
# ----> Do not edit below this line <---- | ||
def setup(unpack_tool): | ||
for item in MIME_PATTERNS: | ||
unpack_tool.register_plugin(item, (unpack_function, NAME, VERSION)) |
Empty file.
Binary file not shown.
23 changes: 23 additions & 0 deletions
23
fact_extractor/plugins/unpacking/android_simg/test/test_plugin_android_simg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from pathlib import Path | ||
|
||
|
||
import sys | ||
root_dir = Path(__file__).parent.parent.parent.parent.parent | ||
print(root_dir, [str(d) for d in root_dir.iterdir() if d.is_dir()]) | ||
sys.path.append(str(root_dir)) | ||
|
||
from test.unit.unpacker.test_unpacker import TestUnpackerBase | ||
|
||
TEST_DATA_DIR = Path(__file__).parent / 'data' | ||
|
||
|
||
class TestAndroidSimgUnpacker(TestUnpackerBase): | ||
|
||
def test_unpacker_selection_generic(self): | ||
self.check_unpacker_selection('filesystem/android-simg', 'Android-sparse-image') | ||
|
||
def test_extraction_simg(self): | ||
in_file = TEST_DATA_DIR / 'simg.img' | ||
files, _ = self.unpacker.extract_files_from_file(str(in_file), self.tmp_dir.name) | ||
assert len(files) == 1 | ||
assert files[0].endswith('raw') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.