Skip to content

Instantly share code, notes, and snippets.

@yottatsa
Created February 28, 2023 10:27
Show Gist options
  • Save yottatsa/b5e914503654c59212a54307edef018d to your computer and use it in GitHub Desktop.
Save yottatsa/b5e914503654c59212a54307edef018d to your computer and use it in GitHub Desktop.
Hayes modem dummy plug
#!/usr/bin/expect
#
# responds to Windows 9x dial-up, as it doesn't work with null-modem
# out of the box
#
# Usage:
# 1. enable pre-dial terminal
# 2. login and exec into it
# 3. continue dialling
set timeout 600
expect {
ATQ { exp_continue }
-re "AT\[/S&\r\n\]" {
send -- "OK\r\n"; exp_continue
}
ATZ { send -- "OK\r\n"; exp_continue }
ATL { send -- "OK\r\n"; exp_continue }
ATV1 { send -- "OK\r\n"; exp_continue }
ATX0 { send -- "OK\r\n"; exp_continue }
ATE0 { send -- "OK\r\n"; exp_continue }
ATX1 { send -- "OK\r\n"; exp_continue }
ATH {
send -- "OK\r\n";
}
ATD {
# PPPD
send -- "CONNECT 14400\r\n";
# replace with spawn/fork?
system "/usr/sbin/pppd -detach || /bin/echo -en NO CARRIER\r\n";
exp_continue
}
-re "AT.*" {
# catch-all
send -- "ERROR\r\n"; exp_continue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment