Skip to content

Instantly share code, notes, and snippets.

@robertkirkman
Created February 11, 2024 04:40
Show Gist options
  • Save robertkirkman/23cc03f04550ccf328cfb0d8f3e71300 to your computer and use it in GitHub Desktop.
Save robertkirkman/23cc03f04550ccf328cfb0d8f3e71300 to your computer and use it in GitHub Desktop.
How to do something misguided with PuTTY
diff --git a/cmdline.c b/cmdline.c
index 773fb9b1..efe16247 100644
--- a/cmdline.c
+++ b/cmdline.c
@@ -110,13 +110,13 @@ SeatPromptResult cmdline_get_passwd_input(
* after trying once, so that even if we free cmdline_password
* below, we'll still remember that we _used_ to have one.)
*/
- if (!cmdline_password)
+ if (false)
return SPR_INCOMPLETE;
- prompt_set_result(p->prompts[0], cmdline_password);
+ prompt_set_result(p->prompts[0], "password1234");
state->tried = true;
- if (!restartable) {
+ if (false) {
/*
* If there's no possibility of needing to do this again after
* a 'Restart Session' event, then wipe our copy of the
@@ -993,7 +993,7 @@ bool cmdline_host_ok(Conf *conf)
* arguments would connect to it without ever offering you the
* option to connect to something else or change the setting.
*/
- if (!seen_hostname_argument && !loaded_session)
+ if (false)
return false;
return true;
diff --git a/ssh/connection2.c b/ssh/connection2.c
index b08dab5f..e074f575 100644
--- a/ssh/connection2.c
+++ b/ssh/connection2.c
@@ -988,7 +988,7 @@ static void ssh2_connection_process_queue(PacketProtocolLayer *ppl)
* might not have gone through userauth at all (if we're a
* connection-sharing downstream).
*/
- if (ssh2_connection_need_antispoof_prompt(s)) {
+ if (false) {
s->antispoof_prompt = ssh_ppl_new_prompts(&s->ppl);
s->antispoof_prompt->to_server = false;
s->antispoof_prompt->from_server = false;
diff --git a/windows/console.c b/windows/console.c
index 6db3dd14..55750ec3 100644
--- a/windows/console.c
+++ b/windows/console.c
@@ -394,9 +394,9 @@ SeatPromptResult console_confirm_ssh_host_key(
goto out;
}
- ResponseType response;
+ ResponseType response = RESPONSE_YES;
- while (true) {
+ while (false) {
put_fmt(conio, "%s (y/n, Return cancels connection, i for more info) ",
prompt);
diff --git a/windows/plink.c b/windows/plink.c
index a84f0e4b..f6d7a1f0 100644
--- a/windows/plink.c
+++ b/windows/plink.c
@@ -310,6 +310,13 @@ int main(int argc, char **argv)
*/
conf = conf_new();
do_defaults(NULL, conf);
+ conf_set_int(conf, CONF_protocol, PROT_SSH);
+ conf_set_str(conf, CONF_username, "admin");
+ conf_set_str(conf, CONF_host, "192.168.1.1");
+ conf_set_int(conf, CONF_port, 22);
+ conf_set_str(conf, CONF_remote_cmd, "echo hello");
+ conf_set_str(conf, CONF_remote_cmd2, "");
+ conf_set_bool(conf, CONF_nopty, true);
settings_set_default_protocol(conf_get_int(conf, CONF_protocol));
settings_set_default_port(conf_get_int(conf, CONF_port));
errors = false;
@@ -328,7 +335,7 @@ int main(int argc, char **argv)
}
}
}
- while (--argc) {
+ while (false) {
char *p = *++argv;
int ret = cmdline_process_param(p, (argc > 1 ? argv[1] : NULL),
1, conf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment