This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Change Password for Hirschmann RS20 Switch

I'm trying to write a script to change password's for Hirschmann RS20 Switch.

Debug:

<W-16:03:06>users passwd user[13]

<R-16:03:06>u

<R-16:03:06>sers passwd user[13][10][13][10]Enter old password:

<W-16:03:06>public[13]

<R-16:03:06>*

<R-16:03:06>**[13][10][13][10]Incorrect Password![13][10][13][10](egvko1swvis6) (Config)#

.... but the password is right.

Script:

     ReDim rgMult(5)

   

    rgMult(1) = "Enter old password:"

    rgMult(2) = "Enter new password:"

    rgMult(3) = "Confirm new Password:"

    rgMult(4) = "... irgendwas"

    rgMult(5) = "Incorrect Password!"

   

    cl.Log 4, "SendData '" & sCmd & "'"

    cl.SendData sCmd & vbCr

   

    iRetValPWD = cl.WaitForMultData(rgMult, , COMMAND_TIMEOUT)

    cl.Log 4, "Buffer '" & cl.RxBuffer & "'"

   

    Select Case iRetValPWD

     Case 1, 2, 3, 4

           ' Password accepted - a valid device prompt was received back

           iNumSuccess = iNumSuccess + 1

           iChangePWD = iChangePWD + 1

           cl.Log 4, "SendData ok"

     Case 5

           cl.Log 4, "Incorrect Password!"

           SendCommandsMultiple = False

           Exit Do

     Case Else

           ' Unexpected response received back from device

           cl.Log 4, "Did not receive expected response after sending password"

           iNumErrors = iNumErrors + 1

    End Select

    cl.FlushRxBuffer

  • Hi, kraftr.

    There is stupid anti-robot protection in Hirschmann software. If you are a human, you are typing not very fast, aren't you? So you should make a little pause between symbols in password. Here is my example in EXPECT (I use sleep for 1 second because I don't know how to use sleep intervals less than a second):

      spawn telnet 192.168.1.1

      expect "User:"

      send "admin\r"

      expect "Password:"

      send "private\r"

      expect ">"

      send "enable\r"

      expect "#"

      send "configure\r"

      expect "#"

      send "users passwd admin\r"

      expect "Enter old password:"

      send "p";  sleep 1;

      send "r";  sleep 1;

      send "i";  sleep 1;

      send "v";  sleep 1;

      send "a";  sleep 1;

      send "t";  sleep 1;

      send "e";  sleep 1;

      send "\r";

      expect "Enter new password:"

      send "n";  sleep 1;

      send "e";  sleep 1;

      send "w";  sleep 1;

      send "_";  sleep 1;

      send "p";  sleep 1;

      send "w";  sleep 1;

      send "d";  sleep 1;

      send "\r";

      expect "Confirm new password:"

      send "n";  sleep 1;

      send "e";  sleep 1;

      send "w";  sleep 1;

      send "_";  sleep 1;

      send "p";  sleep 1;

      send "w";  sleep 1;

      send "d";  sleep 1;

      send "\r";

      expect "#"

      send "exit\r"

      expect "#"

      send "copy system:running-config nvram:startup-config\r"

      send "y"

      expect "#"

      send "logout\r"

      expect eof