Question Automate ssh to linux Box?

luxermax

New member
Joined
Sep 24, 2011
Messages
1
Programming Experience
Beginner
Hi Guys

I have automate ssh to Linux box using vbs script (to log in and execute commands)

but i need to make a tool which edit the vbs values and execute it

Brief :

vbs script :

VB.NET:
set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "plink.exe -v -ssh ubnt@192.168.1.20 -pw ubnt -m UNIX_commands.txt" WScript.Sleep 2000 WshShell.AppActivate "192.168.1.20 - PuTTY" WshShell.SendKeys "conf term{ENTER}"

as you can see it is first run plink.exe (ssh client) with specific User name & password
and load specific commands to execute on Linux box from UNIX_commands.txt which located in same directory

UNIX_commands.txt :


VB.NET:
echo "ifconfig br0 down; ifconfig wifi0 down; ifconfig wifi0 hw ether 00:11:22:22:33:33; ifconfig wifi0 up;  ifconfig eth0 down; ifconfig eth0 hw ether 00:11:22:22:33:33; ifconfig eth0 up;ifconfig br0 up" >  /etc/persistent/rc.prestart  cfgmtd -w -p /etc/  reboot


if you can help me & I appreciate that really

I need a tool in vb.net to edit the (user name ,password and ip if needed)
then execute the vbs script & edit the mac address (00:11:22:22:33:33) in UNIX_commands.txt



Thank you
 
You could do this a few ways?

1.) create some custom parameters within a template text file, so where you put mac address you could have %macaddress% , then in the vb.net program, open the template up as a text file, replace %yourvar% with what you like, then write it to the script file and run the script?

2.) store the entire contents of the script within the vb app, then just re-write the string to the script each time?
 
Back
Top