0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Teraterm 自動ログイン+ログ保存+踏み台経由接続

Posted at

teraterm は非常によく使うけど案件毎に作ったりする割に全部盛りな物作ってなかったので。
サーバー経由が無い場合や不要なところは消していくスタイルで。
(ただちょっとログがイケてないので時間があればそのうち多分対応しまs)

;;;;踏み台
hostname = '192.168.1.100'
username = 'hoge'
password='hogehoge'

;;;本命行先
hostname2 = '192.168.2.200'
username2 = 'huga'
password2 = 'hugahuga'

;;;;Log file settings;;;;;;;;;;;;;;;;;;;;;;;;;;
LOGSPATH = 'C:\Users\hogeuser\teraterm\log'
getdate LOG_NAME '\%Y%m%d_%H%M%S.log'
FULLPATH = LOGSPATH
strconcat FULLPATH LOG_NAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

msg = hostname
strconcat msg ':22 /ssh /auth=password /user='
strconcat msg username
strconcat msg ' /passwd='
strconcat msg password

connect msg

;; Logging 
logopen FULLPATH 1 1

wait '$'

msg = ''
strconcat msg 'ssh '
strconcat msg username2
strconcat msg '@'
strconcat msg hostname2
sendln msg

wait 'password:'
sendln password2

wait '~]'

COMMAND = 'date'
sendln COMMAND
COMMAND = 'uname -a'
sendln COMMAND
COMMAND = 'whoami'
sendln COMMAND


end

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?