A장비에서
#vi test.sh
#!/usr/bin/sh
( sleep 2
echo test <---- 유저명
sleep 5
echo "test1234" <--- 패스워드
sleep 2
echo "touch /tmp/testfile"
echo "sleep 2"
echo "exit"
) | telnet targethost > /tmp/telnet.out 2>&1
#chmod 777 test.sh
#./test.sh
다음, targethost로 로그인하여 파일이 생성되었는지 확인해보면
정상적으로 실행되었음을 볼 수 있습니다.
[root:/tmp] ll testfile
-rw-rw-rw- 1 root sys 0 Jul 19 16:48 testfile
#vi test.sh
#!/usr/bin/sh
( sleep 2
echo test <---- 유저명
sleep 5
echo "test1234" <--- 패스워드
sleep 2
echo "touch /tmp/testfile"
echo "sleep 2"
echo "exit"
) | telnet targethost > /tmp/telnet.out 2>&1
#chmod 777 test.sh
#./test.sh
다음, targethost로 로그인하여 파일이 생성되었는지 확인해보면
정상적으로 실행되었음을 볼 수 있습니다.
[root:/tmp] ll testfile
-rw-rw-rw- 1 root sys 0 Jul 19 16:48 testfile