Skip to content

Commit

Permalink
Merge branch 'tkt_63_add_resolve_hostname_parameter' into 'dev'
Browse files Browse the repository at this point in the history
Add resolve hostname parameter

Closes #63

See merge request faradaysec/faraday-cli!65
  • Loading branch information
Jonathan Filogna committed May 20, 2022
2 parents 45ced28 + d0fea8b commit acb2ad9
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG/current/add_hostname_resolution_parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Now is possible to doesn't resolve hostname by changing resolve_hostname parameter
28 changes: 28 additions & 0 deletions docs/docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,31 @@ optional arguments:
-p PASSWORD, --password PASSWORD
Faraday password
```

## set

List or change global configurations

```
$ faraday-cli set
+------------------------+----------+----------------------------------------------------------------------------------+
| Name | Value | Description |
+------------------------+----------+----------------------------------------------------------------------------------+
| allow_style | Terminal | Allow ANSI text style sequences in output (valid values:Always, Never, Terminal) |
| always_show_hint | False | Display tab completion hint even when completion suggestions print |
| auto_command_detection | True | Enable/disable automatic command detection |
| custom_plugins_path | None | Path of custom plugins folder |
| echo | False | Echo command issued into output |
| editor | vim | Program used by 'edit' |
| feedback_to_output | False | Include nonessentials in '|', '>' results |
| hostname_resolution | True | Resolve hostname |
| ignore_info_severity | False | Ignore Informational vulnerabilities from reports and commands |
| max_completion_items | 50 | Maximum number of CompletionItems to display during tab completion |
| quiet | False | Don't print nonessential feedback |
| timing | False | Report execution times |
+------------------------+----------+----------------------------------------------------------------------------------+
$ faraday-cli set hostname_resolution False
hostname_resolution - was: True
now: False
```
1 change: 1 addition & 0 deletions faraday_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self):
self.workspace = None
self.custom_plugins_path = None
self.ignore_info_severity = False
self.hostname_resolution = True
self.auto_command_detection = True
self.load()

Expand Down
20 changes: 19 additions & 1 deletion faraday_cli/shell/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def __init__(self, *args, **kwargs):
)
self.custom_plugins_path = active_config.custom_plugins_path
self.ignore_info_severity = active_config.ignore_info_severity
self.hostname_resolution = active_config.hostname_resolution
self.auto_command_detection = active_config.auto_command_detection
self.intro = "\n".join(intro)
self.data_queue = queue.Queue()
Expand All @@ -135,6 +136,15 @@ def __init__(self, *args, **kwargs):
settable_object=self,
)
)
self.add_settable(
Settable(
"hostname_resolution",
bool,
"Resolve hostname",
onchange_cb=self._onchange_hostname_resolution,
settable_object=self,
)
)
self.add_settable(
Settable(
"auto_command_detection",
Expand Down Expand Up @@ -163,7 +173,9 @@ def do_version(self, _):

def _create_plugin_manager(self):
self.plugins_manager = PluginsManager(
self.custom_plugins_path, ignore_info=self.ignore_info_severity
self.custom_plugins_path,
ignore_info=self.ignore_info_severity,
hostname_resolution=self.hostname_resolution,
)
self.report_analyzer = ReportAnalyzer(self.plugins_manager)
self.command_analyzer = CommandAnalyzer(self.plugins_manager)
Expand All @@ -185,6 +197,12 @@ def _onchange_ignore_info_severity(self, param_name, old, new):
self.ignore_info_severity = new
self._create_plugin_manager()

def _onchange_hostname_resolution(self, param_name, old, new):
active_config.hostname_resolution = new
active_config.save()
self.hostname_resolution = new
self._create_plugin_manager()

def _onchange_auto_command_detection(self, param_name, old, new):
active_config.auto_command_detection = new
active_config.save()
Expand Down

0 comments on commit acb2ad9

Please sign in to comment.