scriptWin-teraTerm-part1

scriptWin – teraterm – part1

windowsのteratermスクリプト – part1

  • ssh接続
;単純接続
connect '192.168.1.38 /ssh /2 /auth=password /user=root /passwd=password /F=yellow.ini'

wait "]$"
sendln "df -h"
  • ssh接続マクロが参照する定義ファイルをy:\teraIni\gvis.iniに用意
gvis_iPTH = 'y:\\teraIni\\'
gvis_wS1  = ']$'
gvis_wS2  = ']#'
gvis_wS3  = 'パスワード:'
gvis_wS4  = 'nari$'
gvis_wS5  = 'Password:'
gvis_wS6  = 'C:\Users\nari>'
gvis_ws7  = 'nari@MacX-nari'
gvis_nari = 'password1'
gvis_nari2= 'password2'
gvis_MAIN = 'password3'
gvis_winP = 'winPassword'
gvis_macP = 'macPassword'
gvis_WhP  = 'drivePassword'
gvis_KY1  = 'Y:\\terIni\\key\\privateKEY'

;---- 
;---- zip -r -P xx dirname.zip ./dirname  
;---- unzip  -P xx dirname.zip
;---- 
;---- 記号を混ぜるとNG
gvis_psw1 = 'longlongPassword1'
gvis_psw2 = 'longlongPassword2'
gvis_pswP = 'longlongPassword3'

gvis_TOUT = '5'
gvis_COUT = 10

gvis_Yps1 = 'routerPassword1'
gvis_Yps2 = 'routerPassword2'

gvis_YwS1 = '>'
gvis_YwS2 = '#'
gvis_YwS3 = 'Password:'
gvis_YCot = 3
  • 定義ファイルを利用してローカルlinuxへssh接続
include 'y:\teraIni\gvis.ini'

; --- 接続 --------------
 conSTR = '172.16.17.218 /ssh /2 /auth=password /user=nari /passwd='
 strconcat conSTR gvis_nari
 strconcat conSTR ' /F='
 strconcat conSTR gvis_iPTH
 strconcat conSTR 'yellow.ini '
 strconcat conSTR '/timeout='
 strconcat conSTR gvis_TOUT

; ---debug --------------
; messagebox conSTR 'info'

 connect conSTR
 if result <> 2 goto end

wait gvis_wS1
sendln "df -h"

wait gvis_wS1
sendln "w"

wait gvis_wS1
sendln "onlchk"

:end
  • 定義ファイルを利用してGoogle Cloudのlinuxへssh接続
include 'y:\teraIni\gvis.ini'

; --- 接続 --------------
 conSTR = 'gcp-gvis-dklinux.intra.gavann-it.com  /ssh /auth=publickey  /user=nari /passwd='
 strconcat conSTR gvis_MAIN
 strconcat conSTR ' /keyfile='
 strconcat conSTR gvis_KY1
 strconcat conSTR ' /F='
 strconcat conSTR gvis_iPTH
 strconcat conSTR 'wine.ini '
 strconcat conSTR '/timeout='
 strconcat conSTR gvis_TOUT

; ---debug --------------
; messagebox conSTR 'info'

 connect conSTR
 if result <> 2 goto end

wait gvis_wS1
sendln "df -h"

wait gvis_wS1
sendln "w"

:end
  • teratermではフォントや色などの表示指定を保存して作成しておく(tertermウィンドウの「設定」->「設定の保存」)。以下、wine.iniで赤っぽい配色の定義サンプル。
[Tera Term]
Version=4.98
Language=Japanese
Port=tcpip
TerminalSize=90,35
TermIsWin=on
AutoWinResize=off
CRReceive=CR
CRSend=CR
LocalEcho=off
Answerback=
KanjiReceive=UTF-8
KatakanaReceive=8
KanjiSend=UTF-8
KatakanaSend=8
KanjiIn=B
KanjiOut=B
ConnectingTimeout=5
DisablePasteMouseRButton=off
ConfirmPasteMouseRButton=off
SelectOnlyByLButton=on
DisableAcceleratorSendBreak=off
EnableContinuedLineCopy=on
MouseCursor=ibeam
AlphaBlend=255
CygwinDirectory=c:\cygwin
ViewlogEditor=notepad.exe
Locale=japanese
CodePage=932
ANSIColor=0,0,0,0, 1,255,0,0, 2,0,255,0, 3,255,255,0, 4,128,128,255, 5,255,0,255, 6,0,255,255, 7,255,255,255, 8,0,0,0, 9,255,0,0, 10,0,255,0, 11,255,255,0, 12,128,128,255, 13,255,0,255, 14,0,255,255, 15,255,255,255
AutoWinSwitch=off
TerminalID=VT100
RussHost=Windows
RussClient=Windows
Title=Tera Term
CursorShape=block
HideTitle=off
PopupMenu=off
FullColor=on
EnableScrollBuff=on
ScrollBuffSize=10000
VTColor=255,29,202,72,27,21
VTBoldColor=0,0,255,72,27,21
VTBlinkColor=255,0,0,72,27,21
EnableClickableUrl=on
URLColor=0,255,0,72,27,21
TEKColor=0,0,0,255,255,255
TEKColorEmulation=off
VTFont=MS 明朝,0,-16,128
EnableBold=on
RussFont=Windows
TEKFont=Terminal,0,-8,128
BSKey=BS
DeleteKey=on
MetaKey=off
DisableAppKeypad=off
DisableAppCursor=off
RussKeyb=Windows
ComPort=1
BaudRate=9600
Parity=none
DataBit=8
StopBit=1
FlowCtrl=none
DelayPerChar=0
DelayPerLine=0
Telnet=off
TermType=vt100
TCPPort=22
AutoWinClose=on
Historylist=on
TransBin=off
LogAppend=on
LogTypePlainText=on
LogTimestamp=off
LogDefaultName=teraterm.log
LogDefaultPath=
LogAutoStart=off
XmodemOpt=checksum
XmodemBin=on
XmodemRcvCommand=
FileDir=C:\Program Files (x86)\teraterm
FileSendFilter=
Accept8BitCtrl=on
AllowWrongSequence=off
AutoFileRename=on
AutoTextCopy=on
BackWrap=off
Beep=on
BeepOnConnect=off
BPAuto=off
BPEscCtl=off
BPLog=off
ClearComBuffOnOpen=on
ConfirmDisconnect=on
CtrlInKanji=on
Debug=off
DelimList=$20!"#$24%&'()*+,:;<=>?@[\]^`{|}~
DelimDBCS=on
EnablePopupMenu=on
EnableShowMenu=on
EnableStatusLine=on
IME=on
IMEInline=on
KmtLog=off
LanguageSelection=on
MaxBuffSize=500000
MaxComPort=256
NonblinkingCursor=off
PassThruDelay=3
PassThruPort=
PrnFont=
PrnMargin=50,50,50,50
QVLog=off
QVWinSize=8
RussPrint=Windows
ScrollThreshold=12
SelectOnActivate=on
Send8BitCtrl=off
StartupMacro=
TEKGINMouseCode=32
TelAutoDetect=on
TelBin=off
TelEcho=off
TelLog=off
TelPort=23
TelKeepAliveInterval=300
MaxBroadcatHistory=99
TCPLocalEcho=off
TCPCRSend=
UseTextColor=off
TitleFormat=61
VTCompatTab=off
VTFontSpace=0,0,0,0
VTPPI=0,0
TEKPPI=0,0
WindowMenu=on
XmodemLog=off
ZmodemAuto=off
ZmodemDataLen=1024
ZmodemWinSize=32767
ZmodemEscCtl=off
ZmodemLog=off
ZmodemRcvCommand=rz
UseNormalBGColor=on
UILanguageFile=lang\Japanese.lng
BroadcastCommandHistory=on
AcceptBroadcast=on
ConfirmFileDragAndDrop=on
DisablePasteMouseMButton=on
ConfirmChangePaste=on
ConfirmChangePasteCR=on
ConfirmChangePasteStringFile=
ScrollWindowClearScreen=on
PcBoldColor=off
Aixterm16Color=off
Xterm256Color=on
VTReverseColor=255,255,255,0,0,0
EnableBoldAttrColor=on
EnableBlinkAttrColor=on
EnableReverseAttrColor=off
EnableURLColor=on
URLUnderline=on
EnableANSIColor=on
LogBinary=off
LogHideDialog=off
LogIncludeScreenBuffer=off
LogTimestampFormat=%Y-%m-%d %H:%M:%S.%N
LogTimestampType=Local
LogRotate=0
LogRotateSize=0
LogRotateSizeType=0
LogRotateStep=0
DeferredLogWriteMode=on
ScpSendDir=
AutoComPortReconnect=on
WaitCom=off
FileSendHighSpeedMode=on
KmtLongPacket=off
KmtFileAttr=off
KillFocusCursor=on
PrinterCtrlSequence=on
PrnConvFF=off
MouseWheelScrollLine=3
SendBreakTime=1000
YmodemLog=off
YmodemRcvCommand=rb
TranslateWheelToCursor=on
HostDialogOnStartup=on
MouseEventTracking=on
MaximizedBugTweak=2
UnicodeToDecSpMapping=3
AutoScrollOnlyInBottomLine=off
UnknownUnicodeCharacterAsWide=off
AcceptTitleChangeRequest=overwrite
PasteDialogSize=330,220
DisableMouseTrackingByCtrl=on
DisableWheelToCursorByCtrl=on
StrictKeyMapping=off
Wait4allMacroCommand=off
DisableMenuSendBreak=off
ClearScreenOnCloseConnection=off
DisableAcceleratorDuplicateSession=off
AcceleratorNewConnection=on
AcceleratorCygwinConnection=on
DisableMenuDuplicateSession=off
DisableMenuNewConnection=off
PasteDelayPerLine=10
Meta8Bit=off
WindowCtrlSequence=on
CursorCtrlSequence=off
WindowReportSequence=on
TitleReportSequence=empty
EnableLineMode=on
ClearOnResize=on
AlternateScreenBuffer=on
IMERelatedCursor=off
TerminalUID=FFFFFFFF
LockTUID=on
JumpList=on
TabStopModifySequence=on
ClipboardAccessFromRemote=off
NotifyClipboardAccess=on
ClickableUrlBrowser=
ClickableUrlBrowserArg=
LogLockExclusive=on
FontQuality=default
BeepOverUsedCount=5
BeepOverUsedTime=2
BeepSuppressTime=5
MaxOSCBufferSize=4096
JoinSplitURL=off
JoinSplitURLIgnoreEOLChar=\
DebugModes=all
XmodemTimeouts=10,3,10,20,60
YmodemTimeouts=10,3,10,20,60
ZmodemTimeouts=10,0,10,3
TrimTrailingNLonPaste=off
NormalizeLineBreakOnPaste=off
ListHiddenFonts=off
ISO2022ShiftFunction=on
TerminalSpeed=38400
[BG]
BGEnable=off
BGUseAlphaBlendAPI=on
BGSPIPath=plugin
BGFastSizeMove=on
BGFlickerlessMove=on
BGNoFrame=on
BGThemeFile=theme\*.ini
[TTSSH]
Enabled=1
Compression=0
DefaultUserName=
DefaultForwarding=
CipherOrder=78;9:3MK>HJ=GLI<FCDEB026A@?
KnownHostsFiles=ssh_known_hosts
DefaultRhostsLocalUserName=
DefaultRhostsHostPrivateKeyFile=
DefaultRSAPrivateKeyFile=
DefaultAuthMethod=3
LogLevel=0
WriteBufferSize=2097152
LocalForwardingIdentityCheck=1
ProtocolVersion=2
HeartBeat=60
RememberPassword=1
CheckAuthListFirst=0
KexOrder=567:9843210
HostKeyOrder=4567230
MacOrder=@?:861>5;20<=34
CompOrder=3210
EnableRsaShortKeyServer=0
ForwardAgent=0
ForwardAgentConfirm=1
ForwardAgentNotify=1
VerifyHostKeyDNS=1
SSHIcon=Default
DisablePopupMessage=0
X11Display=
UpdateHostkeys=0
GexMinimalGroupSize=0
AuthBanner=1
[TTProxy]
ConnectionTimeout="10"
SocksResolve="auto"
TelnetHostnamePrompt=">> Host name: "
TelnetUsernamePrompt="Username:"
TelnetPasswordPrompt="Password:"
TelnetConnectedMessage="-- Connected to "
TelnetErrorMessage="!!!!!!!!"
タイトルとURLをコピーしました