-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh_server_via_proxy.ttl
70 lines (59 loc) · 1.5 KB
/
ssh_server_via_proxy.ttl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
; auto login to target server via proxy server
;
; File: ssh_server_via_proxy.ttl
; Description: auto login to target server via proxy server
; Update: 2013/07/09
; Author: tamano
; 共通設定
dynamicpass = 1 ; パスワードを実行時に入力する「1」
; 中継サーバー
hostname0 = 'PROXY SERVER'
portnum0 = '22'
username0 = 'USERNAME'
password0 = 'PASSWORD' ; dynammicepass=0の場合のみ有効
; 接続先のサーバー
hostname1 = 'TARGET SERVER'
portnum1 = '22'
username1 = 'USERNAME'
password1 = 'PASSWORD' ; dynammicepass=0の場合のみ有効
if dynamicpass then
passwordtext0 = 'Enter password for '
strconcat passwordtext0 hostname0
passwordbox passwordtext0 passwordtext0
password0 = inputstr
passwordtext1 = 'Enter password for '
strconcat passwordtext1 hostname1
passwordbox passwordtext1 passwordtext1
password1 = inputstr
endif
; 中継サーバーにssh
msg = hostname0
strconcat msg ':'
strconcat msg portnum0
strconcat msg ' /ssh /auth=password /user='
strconcat msg username0
strconcat msg ' /passwd='
strconcat msg password0
connect msg
;「$」という文字がでるまで待つ
prompt1 = '$'
wait prompt1
; 中継サーバーから接続したいサーバーにssh
msg = ''
strconcat msg 'ssh -p'
strconcat msg portnum1
strconcat msg ' '
strconcat msg username1
strconcat msg '@'
strconcat msg hostname1
sendln msg
; 「password: 」という文字がでるまで待ってパスワード入力。
prompt2 = "password: "
wait prompt2
sendln password1
; タイトルキャプションの変更
title = ''
strconcat title hostname1
strconcat title ' via '
strconcat title hostname0
settitle title