Skip to main content

Posts

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 r...
Recent posts

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

Disabling and enabling TLS

1.Press win+R 2.Type regedit 3.go to  Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS (version)\Client  Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS (version)\Server set the Dword value to 1 for enabling TLS client and 0 to disable enable TLS will make systems vulnerable 

disabling SSL in windows

1.Press win+R 2.Type regedit 3.go to  Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client set the Dword value to 1 for enabling SSL client and 0 to disable

Java function to read from sql database

 public static ResultSet sqlread(String S){       ResultSet rs = null;        try     {       // create a mysql database connection       String myUrl = "jdbc:mysql://localhost:3306/firewall?zeroDateTimeBehavior=convertToNull";       Class.forName("com.mysql.jdbc.Driver");       Connection conn = DriverManager.getConnection(myUrl, "root", "Cns@54321");             Statement st = conn.createStatement();       // note that i'm leaving "date_created" out of this insert statement         rs = st.executeQuery(S);           }        catch (Exception e)     {       System.err.println("Got an exception!");       System.err.println(e.getMessage());     }        return rs;   } 

java function to write into sql database from java

public static void runsql(String Q)   {     try     {       // create a mysql database connection           String myUrl = "jdbc:mysql://localhost:3306/firewall?zeroDateTimeBehavior=convertToNull";       Class.forName("com.mysql.jdbc.Driver");       Connection conn = DriverManager.getConnection(myUrl,"root", "password");       if (conn != null) {     System.out.println("Connected"); }       Statement st = conn.createStatement();             st.executeUpdate(Q);       conn.close();     }     catch (Exception e)     {       System.err.println("Got an exception!");       System.err.println(e.getMessage());     }   }

Java functions to run SSH commands from java

     public static void SSH(String Host,String username,String passwor,String cmd,String cmd1) {   byte[] tmp = new byte[1024]; String host =Host; String user =username; String password =passwor; String  command = cmd;                 String ou=null; try { Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); JSch jsch = new JSch(); // Create a JSch session to connect to the server Session session = jsch.getSession(user, host, 22); session.setPassword(password); session.setConfig(config); // Establish the connection session.connect(); System.out.println("Connected..."); ChannelExec channel = (ChannelExec) session.openChannel("exec"); channel.setCommand(command); channel.setErrStream(System.err);                         channel.connect();       ...