Skip to content

Collect init.d scripts when root is available - #127

Open
besendorf wants to merge 2 commits into
mainfrom
collect-init-scripts
Open

Collect init.d scripts when root is available#127
besendorf wants to merge 2 commits into
mainfrom
collect-init-scripts

Conversation

@besendorf

Copy link
Copy Markdown
Collaborator

AndroidQF does not currently collect init.d scripts, which can provide evidence of commands configured to run at startup on rooted devices.

This adds an init_scripts module that checks the existing HasRoot() helper before accessing /system/etc/init.d. When root is available, it collects regular files recursively, including hidden files, into init_scripts/ with relative paths preserved. It uses the same staged root extraction as the other root-only modules, so failed reads do not leave incomplete archive entries. Scripts are never executed and symlinks within the directory are not followed.

Devices without working root or an init.d directory are skipped. Enumeration and file-read failures are reported as partial collection, while other files can still be collected. The README documents the behavior and -module init_scripts usage.

Regression tests cover unavailable or denied root, missing directories, recursive collection, unsafe paths, enumeration failures, and failed pulls followed by successful collection.

Validation: go test -tags unbundle ./... and go vet -tags unbundle ./... pass. Not tested on a physical Android device.

Closes #121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collect android init scripts when accessible

1 participant