Skip to content
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

Added SSH Key & Fingerprint output to host command #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

drb-ra
Copy link

@drb-ra drb-ra commented Nov 27, 2023

Added additional information to the output of the host command for SSH results. SSH Key and Fingerprint are useful for threat hunting and data validation.

@@ -113,6 +113,13 @@ def host_print_pretty(host, history=False):
if 'fingerprint' in banner['ssl']['dhparams']:
click.echo('\t\t{:15s}{}'.format('Fingerprint:', banner['ssl']['dhparams']['fingerprint']))

# Show optional ssh info
if 'ssh' in banner:
if 'key' in banner['ssh'] and banner['ssh']['key']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this could be simplified like the following: if banner.get('ssh') and banner['ssh'].get('key')

Given that `bannher['ssh']['key'] returns a string, the second part of your nested if statement is not needed. I think the same could be said for your check for banner['ssh']['fingerprint']

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please feel free to adjust, the idea was more to provide a solution to the request at the same time as the request itself, if there's a better or preferred way to do it, I'm all for that. I think at the time I was just trying to make these changes as close to the original code as possible.

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.

2 participants