automate systems using linux and windows program called expect
Page 1 of 1
automate systems using linux and windows program called expect
https://www.youtube.com/watch?v=dlwqyMW5H5I&feature=relmfu
automate systems
http://expect.sourceforge.net/
example codesautomate systems
http://expect.sourceforge.net/
ssh root@172.16.42.1
expect "password"
send "pinapplesareyunny\r"
expect "root@pinapple"
send "opkg install /tmp/*.1pk\r"
expect "root@pinapple"
send "tcpdump port 80 and not src 172.16.42.1\r"
interact
ls
cat tcpdump.exp
./tcpdump.exp
example
# Assume $remote_server, $my_user_id, $my_password, and $my_command were read in earlier
# in the script.
# Open a telnet session to a remote server, and wait for a username prompt.
spawn telnet $remote_server
expect "username:"
# Send the username, and then wait for a password prompt.
send "$my_user_id\r"
expect "password:"
# Send the password, and then wait for a shell prompt.
send "$my_password\r"
expect "%"
# Send the prebuilt command, and then wait for another shell prompt.
send "$my_command\r"
expect "%"
# Capture the results of the command into a variable. This can be displayed, or written to disk.
set results $expect_out(buffer)
# Exit the telnet session, and wait for a special end-of-file character.
send "exit\r"
expect eof
Similar topics
» Patch Bash NOW: 'Shell Shock' bug blasts OS X, Linux systems wide open
» Use RUSTUP to create your first RUST Program on LINUX | Rust Programming for Beginners
» WINE: Run Windows Games in Linux!
» Remote Desktop into windows from linux
» ripping dvd with windows and linux!
» Use RUSTUP to create your first RUST Program on LINUX | Rust Programming for Beginners
» WINE: Run Windows Games in Linux!
» Remote Desktop into windows from linux
» ripping dvd with windows and linux!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum