ssh - Support for other known_hosts formats in not_in_host_file()

Several other formats in known_hosts files are valid including [host]:port which aren't taken into account currently.

Uses pull request #8341 (46e31a66a3325ccbbe5d48402ffa217e75160218) as inspiration for this simpler implementation.

Fixes #8333