Skip to main content

VB script to change ssh password

'this code will read IPs from host.txt file and change the passwords
Option Explicit
Dim objFile, strLine
Dim sInput,nInput,rInput,WshShell
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
sInput = InputBox("Enter your old password")
nInput = InputBox("Enter your new password")
rInput =InputBox("Enter your reenter new password")
set WshShell = WScript.CreateObject("WScript.Shell")
Set objFile= objFSO.OpenTextFile("hostname.txt", 1)
Do While Not objFile.AtEndOfStream
strLine = objFile.readline
WshShell.Run "putty.exe "&strLine&":22 -l demo -pw "&sINPUT

WScript.Sleep 2000

WshShell.AppActivate strLine&":22 - PuTTY"

WshShell.SendKeys "passwd {ENTER}"

WScript.Sleep 1000

WshShell.SendKeys sINPUT&"{ENTER}"

WScript.Sleep 1000

WshShell.SendKeys nINPUT&"{ENTER}"

WScript.Sleep 1000

WshShell.SendKeys rINPUT&"{ENTER}"

WScript.Sleep 1000

WshShell.SendKeys "exit{ENTER}"

WScript.Sleep 1000

Loop
objFile.Close

Comments

Popular posts from this blog

restart services remotely using power-shell script( restart.ps1)

FUNCTION Restart-Service { PARAM([STRING]$SERVERNAME=$env:COMPUTERNAME,[STRING]$SERVICENAME) #MSSQLSERVER FOR DEFAULT INSTANCE FOR NAMED INSTANCE MSSQL`$KAT $SERVICE = GET-SERVICE -COMPUTERNAME $SERVERNAME -NAME $SERVICENAME -ERRORACTION SILENTLYCONTINUE IF( $SERVICE.STATUS -EQ "RUNNING" ) { $DEPSERVICES = GET-SERVICE -COMPUTERNAME $SERVERNAME -Name $SERVICE.SERVICENAME -DEPENDENTSERVICES | WHERE-OBJECT {$_.STATUS -EQ "RUNNING"} IF( $DEPSERVICES -NE $NULL ) { FOREACH($DEPSERVICE IN $DEPSERVICES) { Stop-Service -InputObject (Get-Service -ComputerName $SERVERNAME -Name $DEPSERVICES.ServiceName) } }   Stop-Service -InputObject (Get-Service -ComputerName $SERVERNAME -Name $SERVICE.SERVICENAME) -Force    if($?)    {    Start-Service -InputObject (Get-Service -ComputerName $SERVERNAME -Name $SERVICE.SERVICENAME) $DEPSERVICES = GET-SERVICE -COMPUTERNAME $SERVERNAME -NAME $SERVICE.SERVICENAME -DEPENDENTSERVICES | WHERE-OBJECT ...

Encryption and Decryption functions for Java

    public static String encrypt(String key, String initVector, String value) {         try {             IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));             SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");             Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");             cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);             byte[] encrypted = cipher.doFinal(value.getBytes());             System.out.println("encrypted string: "                     + Base64.encodeBase64String(encrypted));             return Base64.encodeBase64String(encrypted);         } catch (Exception ex) {   ...

Disabling DEP(data Excecution prevention) for third party softwares in windows

1.go to system properties. 2.go to Advanced system settings . 3. go to Advance tab ,performance settings,Data execution prevention tab make sure u have selected 1st option as highlighted in screenshot.after making changes you must restart system