Jump to content

Search the Community

Showing results for tags 'plink.exe'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. I need to change user's passwords remotely for Linux devices. I was recommended using plink for achieving the same, but I am facing little issue while resetting the passwords. Sharing the command using which I change password via cmd (working): echo 'y' | plink.exe admin@X.X.X.X -pw Old-password -no-antispoof "echo -e 'Old-password\nNew-password\nNew-password'|(passwd)" > passwdChange.log When I integrated it with AutoIT, I embedded the above command in a batch file as below. @echo off echo 'y' | plink.exe %1@%2 -pw %3 -no-antispoof "echo -e '%3\n%4\n%4'|(passwd)" > passwdChange.log When I try to execute the above batch file via AutoIT Run/ShellExecute command it doesn't work properly (doesn't change password). $DOS = Run(@ComSpec & " /c "&@ScriptDir &"\chpasswd.bat "&$sUser&" "&$sIP&" "&$sOldPwd&" "&$pwd, "", @SW_SHOWMAXIMIZED, $STDERR_CHILD + $STDOUT_CHILD) Where I am going & what changes I need to make in order for this to work Thank you in advance.
  2. Hey guys, I want to use Putty/Plink to connect on a remote computer via SSH because I need to execute a couple commands there. So I researched a couple days now and tried like 20 different ways to get this running but I'm still failing. Maybe a little description what my script should do: #Edit: Short version: I need to use StdoutRead to get the DOS command promt output MORE THAN ONCE! The first time is working, but I need to get this the whole time till I say stop ^^ I want to start Putty/Plink and connect via SSH on a remote computer AND I wanna check if there is anything wrong going on or not, because the next step would be the execution of an perl-script on the remote computer which is giving an output text while running. That means I'd like to be able to read out the Putty-Window/Plink-Console the whole time ... I'm actual just getting the text-output after connecting. Maybe a little example of what I'm expecting in some kind of mixed "AutoIt/Pseudo -Code": #include <Constants.au3> Local $iPID = Run('"C:\Program Files (x86)\Putty\putty.exe" -ssh root@HOST:22 -pw PASSWORD', @ScriptDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) Actual Putty-Window is popping up showing me: Using username "root". Linux COMPUTERNAME 2.6.31-22-generic-pae #63-Ubuntu SMP Wed Aug 18 23:57:18 UTC 2010 i686 To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ System information as of Mo 13. Jan 15:01:50 CET 2014 System load: 0.0 Processes: 77 Usage of /: 47.5% of 9.15GB Users logged in: 1 Memory usage: 9% IP address for eth2: HOST Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ Last login: Mon Jan 13 14:58:43 2014 from XXX.X.X.XXX root@COMPUTERNAME:~# Now I'd like to do ControlSend($hWindow_Putty, '', '', 'perl -w /some/dir/script.pl{ENTER}') If I'd do this on my on with Putty I'd now see something like: Using username "root". Linux COMPUTERNAME 2.6.31-22-generic-pae #63-Ubuntu SMP Wed Aug 18 23:57:18 UTC 2010 i686 To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ System information as of Mo 13. Jan 15:01:50 CET 2014 System load: 0.0 Processes: 77 Usage of /: 47.5% of 9.15GB Users logged in: 1 Memory usage: 9% IP address for eth2: HOST Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ Last login: Mon Jan 13 14:58:43 2014 from XXX.X.X.XXX root@COMPUTERNAME:~# perl -w some/dir/script.pl some text written by the script.pl some text written by the script.pl some text written by the script.pl root@COMPUTERNAME:~# And that's what my problem is. I need to be able to check this output of the script like "some text written by the script.pl" because I may not execute a following statement if this one didn't succeed. In my thoughts the first step should show me what I got in the first code-box above, and the second output should be perl -w some/dir/script.pl some text written by the script.pl some text written by the script.pl some text written by the script.pl root@COMPUTERNAME:~# but I dont get this working ... So I found many threads about Plink. I tried the whole thing with Plink... Local $sData = '' Local $iPID = Run('"C:\Program Files (x86)\Putty\plink.exe" -ssh root@HOST:22 -pw PASSWORD', @ScriptDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) While True $sData &= StdoutRead($iPID) If @error Then ExitLoop Sleep(25) WEnd ConsoleWrite("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & @CR & _ $sData & @CR & _ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & @CR) I'm getting the following output: Linux COMPUTERNAME 2.6.31-22-generic-pae #63-Ubuntu SMP Wed Aug 18 23:57:18 UTC 2010 i686 To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ System information as of Mo 13. Jan 15:35:53 CET 2014 System load: 0.0 Processes: 77 Usage of /: 47.5% of 9.15GB Users logged in: 1 Memory usage: 9% IP address for eth2: HOST Swap usage: 0% Graph this data and manage this system at https://landscape.canonical.com/ Last login: Mon Jan 13 15:23:36 2014 from MY_IP_ADRESS In comparison to the Putty window-output I'm missing here the root@COMPUTERNAME:~# line ... anyway, I don't get this Plink thing doing more then just connecting ... no more executions I'm getting done ... I also tried something like: #RequireAdmin #include <Constants.au3> Local $sData = '' Local $iPID = ShellExecute(@ComSpec, '"C:\Program Files (x86)\Putty\plink.exe" -ssh root@HOST:22 -pw PASSWORD', @ScriptDir, '', @SW_SHOW) Local $hWindow = WinWait('Administrator: C:\Windows\system32\cmd.exe', '', 5) ConsoleWrite("WinWait: " & $hWindow & @CR) If $hWindow = 0 Then Exit ConsoleWrite("WinActivate: " & WinActivate('Administrator: C:\Windows\system32\cmd.exe') & @CR) ConsoleWrite("WinActive: " & WinActive('Administrator: C:\Windows\system32\cmd.exe') & @CR) Sleep(1000) ConsoleWrite(ControlSend('Administrator: C:\Windows\system32\cmd.exe', '', '', '"C:\Program Files (x86)\Putty\plink.exe" -ssh root@HOST:22 -pw PASSWORD{ENTER}') & @CR) ;StdinWrite($iPID, '"C:\Program Files (x86)\Putty\plink.exe" -ssh root@HOST:22 -pw PASSWORD' & @CRLF) ;StdinWrite($iPID) While True $sData &= StdoutRead($iPID) If @error Then ExitLoop Sleep(25) WEnd ConsoleWrite("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & @CR & _ $sData & @CR & _ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & @CR) but unfortunately I dont get anything out of it ... Maybe a last more example ... I found this on Stackoverflow (http://stackoverflow.com/questions/19206834/command-prompt-and-autoit-stdinwrite) Thats my code after reading that article: #include <Constants.au3> Local $data Local $pid = Run("C:\Windows\system32\cmd.exe",@SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($pid,"cd C:\users\username") StdinWrite($pid,@CRLF) ;~ StdinWrite($pid) Sleep(2000) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) $data = '' StdinWrite($pid,"cd C:\Program Files (x86)") StdinWrite($pid,@CRLF) StdinWrite($pid) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) but the second output still empty... Can you guys please help me out? Thanks in advice. Regards.
×
×
  • Create New...