Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
881 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  Faire échap en expect

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Faire échap en expect

n°2187219
pierra56
Posté le 23-04-2013 à 17:42:32  profilanswer
 

Mais j'ai un gros problème à un moment je dois faire un echap pour pour valider, et sa ne marche pas!  
 
voila le script
 
"Login Screen" {
send "\r"
sleep 2
send "$user"
send "\t"
sleep 2
send "$passwd"
send "\e"            
sleep 2
send "\t"
send "\n"
send "\n"
sleep 1; send "\cZ"
send "lcli\r"
send "$user"
send "\r"
A oui ça écrit l'utilisateur et le mot de passe a suivre! je ne comprend pas pourquoi!
Merci de votre aide.
PA


Message édité par gilou le 24-04-2013 à 19:46:52
mood
Publicité
Posté le 23-04-2013 à 17:42:32  profilanswer
 

n°2187359
gilou
Modérateur
Modzilla
Posté le 24-04-2013 à 12:38:47  profilanswer
 

1) Message incompréhensible. Faudrait expliquer ce qui vous pose problème, la on ne le sait pas ce qui ne va pas, ni dans quel contexte. "Faire un echap", c'est clair comme du jus de chaussette de marathonien à l'arrivée.
2) Manque le code autour. Il en manque tellement que c'est pas un script perl pour le moment ce qui est posté.
A+,


Message édité par gilou le 24-04-2013 à 12:39:23

---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --
n°2187432
pierra56
Posté le 24-04-2013 à 17:45:36  profilanswer
 

oups, il manque une partie dans mon message désoler. Merci pour ta réponse!!
Je reprends,
 
Enfaite je veux modifier un script déja existant qui sert a se connecter à un switch Linksys version 1.0.4. or les switch que je possède sont à la version 1.0.2 et il m'est impossible de les mettres à jour. (il y en a trop et dans toutes la Bretagne.)
 
Voici le script de la version 1.0.4 c'est le csblogin https://github.com/chrpinedo/rancid [...] 8b02482d8e
La différence entre ces deux versions c'est juste la procédure de connexion.
Ah oui je me suis tromper c'est un script en expect  :sweat:  
 
Voici le code en entier (il fonctionne pour la 1.0.4):
 

Code :
  1. #! /usr/bin/expect --
  2. ##
  3. ## $Id: csblogin,v 1.3 2010-01-28 13:12:00 bjorn Exp $
  4. ##
  5. ## rancid 2.3.2a8
  6. ## Copyright (c) 1997-2007 by Terrapin Communications, Inc.
  7. ## All rights reserved.
  8. ##
  9. ## This code is derived from software contributed to and maintained by
  10. ## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
  11. ## Pete Whiting, Austin Schutz, and Andrew Fort.
  12. ##
  13. ## Redistribution and use in source and binary forms, with or without
  14. ## modification, are permitted provided that the following conditions
  15. ## are met:
  16. ## 1. Redistributions of source code must retain the above copyright
  17. ##    notice, this list of conditions and the following disclaimer.
  18. ## 2. Redistributions in binary form must reproduce the above copyright
  19. ##    notice, this list of conditions and the following disclaimer in the
  20. ##    documentation and/or other materials provided with the distribution.
  21. ## 3. All advertising materials mentioning features or use of this software
  22. ##    must display the following acknowledgement:
  23. ##        This product includes software developed by Terrapin Communications,
  24. ##        Inc. and its contributors for RANCID.
  25. ## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
  26. ##    contributors may be used to endorse or promote products derived from
  27. ##    this software without specific prior written permission.
  28. ## 5. It is requested that non-binding fixes and modifications be contributed
  29. ##    back to Terrapin Communications, Inc.
  30. ##
  31. ## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
  32. ## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  33. ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  34. ## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
  35. ## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  38. ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  39. ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. ## POSSIBILITY OF SUCH DAMAGE.
  42. #
  43. #  The expect login scripts were based on Erik Sherk's gwtn, by permission.
  44. #
  45. # csblogin - Cisco/Linksys "Small Business" switch login
  46. #
  47. # Most options are intuitive for logging into a Cisco router.
  48. # The default username password is the same as the vty password.
  49. #
  50. # Usage line
  51. set usage "Usage: $argv0 \[-dV\] \[-c command\] \[-Evar=x\] \
  52. \[-f cloginrc-file\] \[-p user-password\] \[-r passphrase\] \[-s script-file\] \
  53. \[-u username\] \[-t timeout\] \[-x command-file\] \[-y ssh_cypher_type\] \
  54. router \[router...\]\n"
  55. # env(CLOGIN) may contain the following chars:
  56. # x == do not set xterm banner or name
  57. # Password file
  58. set password_file $env(HOME)/.cloginrc
  59. # Default is to login to the router
  60. set do_command 0
  61. set do_script 0
  62. # The default is to automatically enable
  63. set avenable 1
  64. # The default is to look in the password file to find the passwords.  This
  65. # tracks if we receive them on the command line.
  66. set do_passwd 1
  67. # Find the user in the ENV, or use the unix userid.
  68. if {[ info exists env(CISCO_USER) ]} {
  69.     set default_user $env(CISCO_USER)
  70. } elseif {[ info exists env(USER) ]} {
  71.     set default_user $env(USER)
  72. } elseif {[ info exists env(LOGNAME) ]} {
  73.     set default_user $env(LOGNAME)
  74. } else {
  75.     # This uses "id" which I think is portable.  At least it has existed
  76.     # (without options) on all machines/OSes I've been on recently -
  77.     # unlike whoami or id -nu.
  78.     if [ catch {exec id} reason ] {
  79. send_error "\nError: could not exec id: $reason\n"
  80. exit 1
  81.     }
  82.     regexp {\(([^)]*)} "$reason" junk default_user
  83. }
  84. if {[ info exists env(CLOGINRC) ]} {
  85.     set password_file $env(CLOGINRC)
  86. }
  87. # Sometimes routers take awhile to answer (the default is 10 sec)
  88. set timeout 120
  89. # Process the command line
  90. for {set i 0} {$i < $argc} {incr i} {
  91.     set arg [lindex $argv $i]
  92.     switch  -glob -- $arg {
  93. # Command to run.
  94. -c* -
  95. -C* {
  96.     if {! [  regexp .\[cC\](.+) $arg ignore command]} {
  97.  incr i
  98.  set command [ lindex $argv $i ]
  99.     }
  100.     set do_command 1
  101. # Expect debug mode
  102. } -d* {
  103.     exp_internal 1
  104. # Environment variable to pass to -s scripts
  105. } -E*
  106. {
  107.     if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
  108.  set E$varname $varvalue
  109.     } else {
  110.  send_user "\nError: invalid format for -E in $arg\n"
  111.  exit 1
  112.     }
  113. # alternate cloginrc file
  114. } -f* -
  115. -F* {
  116.     if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
  117.  incr i
  118.  set password_file [ lindex $argv $i ]
  119.     }
  120. # user Password
  121. } -p* -
  122. -P* {
  123.     if {! [  regexp .\[pP\](.+) $arg ignore userpasswd]} {
  124.  incr i
  125.  set userpasswd [ lindex $argv $i ]
  126.     }
  127.     set do_passwd 0
  128. # Version string
  129. } -V* {
  130.     send_user "rancid 2.3.2a8\n"
  131.     exit 0
  132. # passphrase
  133. } -r* -
  134. -R* {
  135.     if {! [  regexp .\[rR\](.+) $arg ignore passphrase]} {
  136.  incr i
  137.  set avpassphrase [ lindex $argv $i ]
  138.     }
  139. # Expect script to run.
  140. } -s* -
  141. -S* {
  142.     if {! [  regexp .\[sS\](.+) $arg ignore sfile]} {
  143.  incr i
  144.  set sfile [ lindex $argv $i ]
  145.     }
  146.     if { ! [ file readable $sfile ] } {
  147.  send_user "\nError: Can't read $sfile\n"
  148.  exit 1
  149.     }
  150.     set do_script 1
  151. # Timeout
  152. } -t* -
  153. -T* {
  154.     if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
  155.  incr i
  156.  set timeout [ lindex $argv $i ]
  157.     }
  158. # Username
  159. } -u* -
  160. -U* {
  161.     if {! [  regexp .\[uU\](.+) $arg ignore user]} {
  162.  incr i
  163.  set username [ lindex $argv $i ]
  164.     }
  165. # command file
  166. } -x* -
  167. -X* {
  168.     if {! [  regexp .\[xX\](.+) $arg ignore cmd_file]} {
  169.  incr i
  170.  set cmd_file [ lindex $argv $i ]
  171.     }
  172.     if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
  173.  send_user "\nError: $reason\n"
  174.  exit 1
  175.     }
  176.             set cmd_text [read $cmd_fd]
  177.             close $cmd_fd
  178.             set command [join [split $cmd_text \n] \;]
  179.             set do_command 1
  180. # 'ssh -c' cypher type
  181. } -y* -
  182. -Y* {
  183.     if {! [  regexp .\[yY\](.+) $arg ignore cypher]} {
  184.  incr i
  185.  set cypher [ lindex $argv $i ]
  186.     }
  187. } -* {
  188.     send_user "\nError: Unknown argument! $arg\n"
  189.     send_user $usage
  190.     exit 1
  191. } default {
  192.     break
  193. }
  194.     }
  195. }
  196. # Process routers...no routers listed is an error.
  197. if { $i == $argc } {
  198.     send_user "\nError: $usage"
  199. }
  200. # Only be quiet if we are running a script (it can log its output
  201. # on its own)
  202. if { $do_script } {
  203.     log_user 0
  204. } else {
  205.     log_user 1
  206. }
  207. #
  208. # Done configuration/variable setting.  Now run with it...
  209. #
  210. # Sets Xterm title if interactive...if its an xterm and the user cares
  211. proc label { host } {
  212.     global env
  213.     # if CLOGIN has an 'x' in it, don't set the xterm name/banner
  214.     if [info exists env(CLOGIN)] {
  215. if {[string first "x" $env(CLOGIN)] != -1} { return }
  216.     }
  217.     # take host from ENV(TERM)
  218.     if [info exists env(TERM)] {
  219. if [regexp \^(xterm|vs) $env(TERM) ignore ] {
  220.     send_user "\033]1;[lindex [split $host "."] 0]\a"
  221.     send_user "\033]2;$host\a"
  222.         }
  223.     }
  224. }
  225. # This is a helper function to make the password file easier to
  226. # maintain.  Using this the password file has the form:
  227. # add password sl*  pete cow
  228. # add password at*  steve
  229. # add password * hanky-pie
  230. proc add {var args} { global int_$var ; lappend int_$var $args}
  231. proc include {args} {
  232.     global env
  233.     regsub -all "(^{|}$)" $args {} args
  234.     if { [ regexp "^/" $args ignore ] == 0 } {
  235. set args $env(HOME)/$args
  236.     }
  237.     source_password_file $args
  238. }
  239. proc find {var router} {
  240.   upvar int_$var list
  241.   if { [info exists list] } {
  242.     foreach line $list {
  243.       if { [string match [lindex $line 0] $router ] } {
  244. return [lrange $line 1 end]
  245.       }
  246.     }
  247.   }
  248.   return {}
  249. }
  250. # Loads the password file.  Note that as this file is tcl, and that
  251. # it is sourced, the user better know what to put in there, as it
  252. # could install more than just password info...  I will assume however,
  253. # that a "bad guy" could just as easy put such code in the clogin
  254. # script, so I will leave .cloginrc as just an extention of that script
  255. proc source_password_file { password_file } {
  256.     global env
  257.     if { ! [file exists $password_file] } {
  258. send_user "\nError: password file ($password_file) does not exist\n"
  259. exit 1
  260.     }
  261.     file stat $password_file fileinfo
  262.     if { [expr ($fileinfo(mode) & 007)] != 0000 } {
  263. send_user "\nError: $password_file must not be world readable/writable\n"
  264. exit 1
  265.     }
  266.     if [ catch {source $password_file} reason ] {
  267. send_user "\nError: $reason\n"
  268. exit 1
  269.     }
  270. }
  271. # Log into the router.
  272. # returns: 0 on success, 1 on failure
  273. proc login { router user passwd cmethod cyphertype identfile} {
  274.     global spawn_id in_proc do_command do_script passphrase prompt
  275.     global sshcmd
  276.     set in_proc 1
  277.     # try each of the connection methods in $cmethod until one is successful
  278.     set progs [llength $cmethod]
  279.     foreach prog [lrange $cmethod 0 end] {
  280. incr progs -1
  281. if [string match "telnet*" $prog] {
  282.     regexp {telnet(:([^[:space:]]+))*} $prog command suffix port
  283.     if {"$port" == ""} {
  284.  set retval [ catch {spawn telnet $router} reason ]
  285.     } else {
  286.  set retval [ catch {spawn telnet $router $port} reason ]
  287.     }
  288.     if { $retval } {
  289.  send_user "\nError: telnet failed: $reason\n"
  290.  return 1
  291.     }
  292. } elseif ![string compare $prog "ssh"] {
  293.     # ssh to the router & try to login with or without an identfile.
  294.     # We use two calls to spawn since spawn does not seem to parse
  295.     # spaces correctly.
  296.     if {$identfile != ""} {
  297.  if [ catch {spawn $sshcmd -c $cyphertype -x -l $user -i $identfile $router} reason ] {
  298.      send_user "\nError: failed to $sshcmd: $reason\n"
  299.      return 1
  300.  }
  301.     } else {
  302.  if [ catch {spawn $sshcmd -c $cyphertype -x -l $user $router} reason ] {
  303.      send_user "\nError: failed to $sshcmd: $reason\n"
  304.      return 1
  305.  }
  306.     }
  307. } elseif ![string compare $prog "rsh"] {
  308.     send_error "\nError: unsupported method: rsh\n"
  309.     if { $progs == 0 } {
  310.  return 1
  311.     }
  312.     continue
  313. } else {
  314.     send_user "\nError: unknown connection method: $prog\n"
  315.     return 1
  316. }
  317. sleep 0.3
  318. # This helps cleanup each expect clause.
  319. expect_after {
  320.     timeout {
  321.  send_user "\nError: TIMEOUT reached\n"
  322.  catch {close}; catch {wait};
  323.  if { $in_proc} {
  324.             return 1
  325.  } else {
  326.             continue
  327.  }
  328.             } eof {
  329.  send_user "\nError: EOF received\n"
  330.  catch {close}; catch {wait};
  331.  if { $in_proc} {
  332.             return 1
  333.  } else {
  334.             continue
  335.  }
  336.             }
  337. }
  338. # Here we get a little tricky.  There are several possibilities:
  339. # the router can ask for a username and passwd and then
  340. # talk to the TACACS server to authenticate you, or if the
  341. # TACACS server is not working, then it will use the enable
  342. # passwd.  Or, the router might not have TACACS turned on,
  343. # then it will just send the passwd.
  344. expect {
  345.     -re "(Connection refused|Secure connection \[^\n\r]+ refused|Connection closed by)" {
  346.  catch {close}; catch {wait};
  347.  if !$progs {
  348.     send_user "\nError: Connection Refused ($prog)\n"; return 1
  349.  }
  350.     }
  351.             eof { send_user "\nError: Couldn't login\n"; wait; return 1
  352.     } -nocase "unknown host\r\n" {
  353.  catch {close}; catch {wait};
  354.  send_user "\nError: Unknown host\n"; wait; return 1
  355.     } "Host is unreachable" {
  356.  catch {close}; catch {wait};
  357.  send_user "\nError: Host Unreachable!\n"; wait; return 1
  358.     } "No address associated with name" {
  359.  catch {close}; catch {wait};
  360.  send_user "\nError: Unknown host\n"; wait; return 1
  361.     }
  362.     "Bad user name or password" {
  363.     send_user "\nError: Check your password for $router\n"
  364.     catch {close}; catch {wait}; return 1
  365.   }
  366.     -re "Enter passphrase.*: " {
  367.  # sleep briefly to allow time for stty -echo
  368.  sleep 1
  369.  send "$passphrase\r"
  370.  exp_continue }
  371.     -re "(Host key not found |The authenticity of host .* be established).*\(yes\/no\)\?" {
  372.  send "yes\r"
  373.  send_user "\nHost $router added to the list of known hosts.\n"
  374.  exp_continue }
  375.     -re "HOST IDENTIFICATION HAS CHANGED.* \(yes\/no\)\?" {
  376.  send "no\r"
  377.  send_user "\nError: The host key for $router has changed.  Update the SSH known_hosts file accordingly.\n"
  378.  return 1 }
  379.     -re "Offending key for .* \(yes\/no\)\?"   {
  380.  send "no\r"
  381.  send_user "\nError: host key mismatch for $router.  Update the SSH known_hosts file accordingly.\n"
  382.  return 1 }
  383.     "Login Screen" {
  384.      send "$user\t$passwd\r"
  385.      exp_continue
  386.        }
  387.     "Switch Main Menu" {
  388.      # send Ctrl+Z
  389.      sleep 1; send "send \032"
  390.      exp_continue
  391.    }
  392.     ">"  {
  393.      send "lcli\r"
  394.      exp_continue
  395.    }
  396.     -re "User Name:$" {
  397.                 send "$user\r"
  398.      exp_continue
  399.    }
  400.     -re "Password:$" {
  401.                 send "$passwd\r"
  402.      exp_continue
  403.    }
  404.     -re "$prompt"  { break; }
  405.     denied { send_user "\nError: Check your password for $router\n"
  406.                   catch {close}; catch {wait}; return 1
  407.                 }
  408. }
  409.     }
  410.     set in_proc 0
  411.     return 0
  412. }
  413. # Run commands given on the command line.
  414. proc run_commands { prompt command } {
  415.     global in_proc
  416.     set in_proc 1
  417.     send "terminal datadump\r"
  418.     expect -re $prompt {}
  419.     # Is this a multi-command?
  420.     if [ string match "*\;*" "$command" ] {
  421. set commands [split $command \;]
  422. set num_commands [llength $commands]
  423. for {set i 0} {$i < $num_commands} { incr i} {
  424.     send "[lindex $commands $i]\r"
  425.     expect {
  426.  -re "^\[^\n\r *]*$prompt *$" {}
  427.  -re "^\[^\n\r]*$prompt." { exp_continue }
  428.  -re "(\r\n|\n)"   { exp_continue }
  429.             }
  430. }
  431.     } else {
  432. send "$command\r"
  433. expect {
  434.  -re "^\[^\n\r *]*$prompt *$" {}
  435.  -re "^\[^\n\r]*$prompt." { exp_continue }
  436.  -re "(\r\n|\n)"   { exp_continue }
  437. }
  438.     }
  439.     send "exit\r\n"
  440.     expect {
  441. "\n"     { exp_continue }
  442. timeout     { catch {close}; catch {wait};
  443.        return 0
  444.      }
  445. eof     { return 0 }
  446.     }
  447.     set in_proc 0
  448. }
  449. #
  450. # For each router... (this is main loop)
  451. #
  452. source_password_file $password_file
  453. set in_proc 0
  454. set exitval 0
  455. foreach router [lrange $argv $i end] {
  456.     set router [string tolower $router]
  457.     send_user "$router\n"
  458.     set prompt "#"
  459.     # Figure out username
  460.     if {[info exists username]} {
  461.       # command line username
  462.       set loginname $username
  463.     } else {
  464.       set loginname [join [find user $router] ""]
  465.       if { "$loginname" == "" } { set loginname $default_user }
  466.     }
  467.     # Figure out loginname's password (if different from the vty password)
  468.     if {[info exists userpasswd]} {
  469.       # command line passwd
  470.       set passwd $userpasswd
  471.     } else {
  472.       set passwd [join [lindex [find userpassword $router] 0] ""]
  473.       if { "$passwd" == "" } {
  474.         set passwd [join [lindex [find password $router] 0] ""]
  475.         if { "$passwd" == "" } {
  476.   send_user "\nError: no password for $router in $password_file.\n"
  477.   continue
  478.         }
  479.       }
  480.     }
  481.     # Figure out identity file to use
  482.     set identfile [join [lindex [find identity $router] 0] ""]
  483.     # Figure out passphrase to use
  484.     if {[info exists avpassphrase]} {
  485. set passphrase $avpassphrase
  486.     } else {
  487. set passphrase [join [lindex [find passphrase $router] 0] ""]
  488.     }
  489.     if { ! [string length "$passphrase"]} {
  490. set passphrase $passwd
  491.     }
  492.     # Figure out ssh cypher type
  493.     if {[info exists cypher]} {
  494.       # command line ssh cypher type
  495.       set cyphertype $cypher
  496.     } else {
  497.       set cyphertype [find cyphertype $router]
  498.       if { "$cyphertype" == "" } { set cyphertype "3des" }
  499.     }
  500.     # Figure out connection method
  501.     set cmethod [find method $router]
  502.     if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }
  503.     # Figure out the SSH executable name
  504.     set sshcmd [find sshcmd $router]
  505.     if { "$sshcmd" == "" } { set sshcmd {ssh} }
  506.     # Login to the router
  507.     if {[login $router $loginname $passwd $cmethod $cyphertype $identfile]} {
  508. incr exitval
  509. continue
  510.     }
  511.     if { $do_command } {
  512. if {[run_commands $prompt $command]} {
  513.     incr exitval
  514.     continue
  515. }
  516.     } elseif { $do_script } {
  517. send "terminal datadump\r"
  518. expect -re $prompt {}
  519. source $sfile
  520. catch {close};
  521.     } else {
  522. label $router
  523. log_user 1
  524. interact
  525.     }
  526.     # End of for each router
  527.     catch {wait};
  528.     sleep 0.3
  529. }
  530. exit $exitval


 
Mais comme je l'ai dit  pour la 1.0.2 la connexion est différente car quand je lance le sript le programme s'emballe un peu.
Il n'y a que cette partie qui sert je pense:
 
 

Code :
  1. "Login Screen" {                     
  2.       send "$user\t$passwd\r" 
  3.       exp_continue
  4.         }
  5.      "Switch Main Menu" {
  6.       # send Ctrl+Z
  7.       sleep 1; send "send \032"
  8.       exp_continue
  9.     }
  10.      ">"  {
  11.       send "lcli\r"
  12.       exp_continue
  13.     }
  14.      -re "User Name:$" {
  15.                  send "$user\r"
  16.       exp_continue
  17.     }
  18.      -re "Password:$" {
  19.                  send "$passwd\r"
  20.       exp_continue
  21.     }
  22.      -re "$prompt"  { break; }
  23.     denied { send_user "\nError: Check your password for $router\n"
  24.                    catch {close}; catch {wait}; return 1
  25.                  }
  26. }
  27.      }
  28.      set in_proc 0
  29.      return 0
  30. }[/spoiler]


 
Et donc pour se connecter en privilège il faut faire une manip complétement différente:  
ce qui donne en litérale:  
Login Screen

  • "entrée"
  • "$user"      <= variable prédefinie dans un fichier à coté
  • "tabulation"
  • "$passwd"  <= variable prédefinie dans un fichier à coté
  • "echap"      <= la touche echap
  • "tabulation"
  • "entrée"
  • "entrée"

Switch Main Menu

  • "control+Z"
  • "entrée"

>

  • "lcli"    <= passage en mode privilégier
  • "$user"

connecté en mode privilégier
 
Donc  quand je mofidie le script cela ne fait pas du tout ce que je veux.
Merci de ton aide !!  
PA


Message édité par pierra56 le 25-04-2013 à 13:57:55
n°2187460
gilou
Modérateur
Modzilla
Posté le 24-04-2013 à 19:50:13  profilanswer
 

J'ai passé le message dans la bonne catégorie, et adapté le titre.
Il te faudra attendre le passage de quelqu'un habitué à utiliser expect, ce qui n'est pas mon cas.
A+,


---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --
n°2187599
pierra56
Posté le 25-04-2013 à 17:44:29  profilanswer
 

Up Up!! s'il vous plait!! Dieu Expect et Dieux Linksys aider moi!! :)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  Faire échap en expect

 

Sujets relatifs
Comparaison avec perlperl + comparaison + xml
Faire un bouton coloré PERL GTK2exécution script Perl sous mac impossible
recherche expert en PERL[PERL] Subtition
Sockets en Perl[PERL] Récupérer des données dans un fichier txt
[PERL] Nouvel utilisateur ou toujours le même ...[PERL] Mixer un tableau
Plus de sujets relatifs à : Faire échap en expect


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR