version 1.149, 2022/12/26 19:16:03 |
version 1.150, 2023/02/10 04:56:30 |
|
|
#include "sshbuf.h" |
#include "sshbuf.h" |
#include "sshkey.h" |
#include "sshkey.h" |
#include "cipher.h" |
#include "cipher.h" |
|
#include "digest.h" |
#include "kex.h" |
#include "kex.h" |
#include "compat.h" |
#include "compat.h" |
#include "myproposal.h" |
#include "myproposal.h" |
|
|
|
|
int found_one = 0; /* Successfully found a key */ |
int found_one = 0; /* Successfully found a key */ |
|
|
|
int hashalg = -1; /* Hash for SSHFP records or -1 for all */ |
|
|
#define MAXMAXFD 256 |
#define MAXMAXFD 256 |
|
|
/* The number of seconds after which to give up on a TCP connection */ |
/* The number of seconds after which to give up on a TCP connection */ |
|
|
found_one = 1; |
found_one = 1; |
|
|
if (print_sshfp) { |
if (print_sshfp) { |
export_dns_rr(host, key, stdout, 0); |
export_dns_rr(host, key, stdout, 0, hashalg); |
return; |
return; |
} |
} |
|
|
|
|
usage(void) |
usage(void) |
{ |
{ |
fprintf(stderr, |
fprintf(stderr, |
"usage: %s [-46cDHv] [-f file] [-p port] [-T timeout] [-t type]\n" |
"usage: ssh-keyscan [-46cDHv] [-f file] [-p port] [-T timeout] [-t type]\n" |
"\t\t [host | addrlist namelist]\n", |
" [-O option] [host | addrlist namelist]\n"); |
__progname); |
|
exit(1); |
exit(1); |
} |
} |
|
|
|
|
if (argc <= 1) |
if (argc <= 1) |
usage(); |
usage(); |
|
|
while ((opt = getopt(argc, argv, "cDHv46p:T:t:f:")) != -1) { |
while ((opt = getopt(argc, argv, "cDHv46O:p:T:t:f:")) != -1) { |
switch (opt) { |
switch (opt) { |
case 'H': |
case 'H': |
hash_hosts = 1; |
hash_hosts = 1; |
|
|
if (strcmp(optarg, "-") == 0) |
if (strcmp(optarg, "-") == 0) |
optarg = NULL; |
optarg = NULL; |
argv[fopt_count++] = optarg; |
argv[fopt_count++] = optarg; |
|
break; |
|
case 'O': |
|
/* Maybe other misc options in the future too */ |
|
if (strncmp(optarg, "hashalg=", 8) != 0) |
|
fatal("Unsupported -O option"); |
|
if ((hashalg = ssh_digest_alg_by_name( |
|
optarg + 8)) == -1) |
|
fatal("Unsupported hash algorithm"); |
break; |
break; |
case 't': |
case 't': |
get_keytypes = 0; |
get_keytypes = 0; |