Posted to tcl by aspect at Wed Dec 07 04:24:53 GMT 2011view raw

  1. #!/usr/bin/tclsh
  2. #
  3. # edit target user's .ssh/authorized_keys to contain {command="/path/to/this.tcl""
  4. package require Expect
  5.  
  6. foreach c [split "abcdefghijklmnopqrstuvwxyz" {}] {
  7. set C [string toupper $c]
  8. lappend map $c $C $C $c
  9. }
  10.  
  11. spawn /bin/bash -l
  12. interact {
  13. -re (.*) {
  14. send [string map $map $interact_out(1,string)]
  15. }
  16. }
  17.