-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -c argument to target-shell #873
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #873 +/- ##
==========================================
- Coverage 76.41% 76.40% -0.01%
==========================================
Files 314 314
Lines 26918 26927 +9
==========================================
+ Hits 20569 20574 +5
- Misses 6349 6353 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dissect/target/tools/shell.py
Outdated
"""Helper method for starting a :class:`TargetCli` or :class:`TargetHubCli` for one or multiple targets.""" | ||
if cli := create_cli(targets, cli_cls): | ||
if commands is not None: | ||
# @todo if cli is not RegistryCli: - load targetrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be advised: RegistryCli also supports a targetrc file.
JSCU advised to move the loadtargetrc method to ExtendedCmd
.
Originally, I wanted to trigger the execution in ExtendedCmd::__init__
, but this causes an initialization fiasco because:
- the current directory needs to be set before the targetrc file is run
- but the directory can only be set after ExtendedCmd has initialized.
So now I trigger targetrc execution in the preloop
, but I can see that this is suboptimal with regard to one-shotting.
Might also be related to the fact that we are reusing code through inheritance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addendum: Since bash does not execute the run commands file for non-interactive shells, you can skip loading the targetrc file, until someone complaints. (discussed with @pyrco)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this means, this PR does not have to wait for targetrc and does not have to integrate with targetrc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA'OK.
Code looks good.
Waiting on targetrc merge...
142acf7
to
9554b7f
Compare
Co-authored-by: Erik Schamper <[email protected]>
Co-authored-by: Erik Schamper <[email protected]>
Co-authored-by: Erik Schamper <[email protected]>
(DIS-150)