¿©·¯ Àåºñµé sshÀÀ´äÇÏ´ÂÁö üũÇÏ´Â ÅøÀ̳ª

½Öcpu   
   Á¶È¸ 5589   Ãßõ 0    

 리눅스쉘 또는 도스에서 배치파일 있을까요?


여러대를 ssh응답하는지 확인하려니 귀차니즘이

툴이나 리눅스쉘이든 도스 베치파일이든

리설트 떨어지게만 하면 되는데



ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
±øÅëÀÌ 2017-12
¿©·¯ ¹æ¹ýÀÌ ÀÖ°ÚÁö¸¸ Fabric À» »ç¿ëÇϽô °ÍÀÌ °¡Àå ½±°í °­·ÂÇÒ °ÍÀÔ´Ï´Ù.
python ¶óÀ̺귯¸®Àε¥, ssh¸¦ ÀÌ¿ëÇؼ­ ¼­¹ö¿¡ Á¢¼ÓÇØ ¿ø°ÝÀ¸·Î ¸í·ÉÀ» ½ÇÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.
hostname °°Àº ¸í·É¾î¸¦ º´·Ä·Î µ¿½Ã¿¡ ³¯·Á¼­ È®ÀÎÇÏ½Ã¸é µË´Ï´Ù.
http://www.fabfile.org
Á¶¿ë¿ø 2017-12
telnet ÀÌ ¸®´ÙÀÌ·ºÆ®¸¦ Áö¿ø¾ÈÇÕ´Ï´Ù ;;
ASR9K 2017-12
<¿¹Àü L2/L3 °ü¸®ÇÒ¶§ ½è´ø ½ºÅ©¸³Æ® ÀÔ´Ï´Ù.>
½ºÅ©¸³Æ®¸¸ Á¶±Ý ¼öÁ¤Çؼ­ »ç¿ëÇÏ½Ã¸é µÉ°Í °°½À´Ï´Ù.
ÇÁ·Î±×·¥Àº SecureCRT·Î µ¹·È½À´Ï´Ù.
Ãß°¡·Î ÇÊ¿äÇÑ ÆÄÀÏÀº Á¢¼Ó Host ÆÄÀÏ°ú ¸í·É¾î ÆÄÀÏÀÌ ÇÊ¿äÇÕ´Ï´Ù.
--------------------------------------------------------
#$language = "VBScript"
#$interface = "1.0"


'''''''''' ¶ó¿ìÅÍ ÀÚµ¿Á¡°Ë ½ºÅ©¸³Æ®
'''''''''' 2009-04-15
'''''''''' Made by Jay


Dim DevIP(255)
Dim Passwd
Dim Enpasswd
        Dim Command(100)
        Dim CmdCount
Dim DevCount

        CmdCount = 0
        DevCount = 0
'''''''''' DevIP(255) : ¶ó¿ìÅÍ IP¸¦ µî·ÏÇÒ º¯¼ö - Àåºñ ÃÖ´ë 255°³ µî·Ï°¡´É
'''''''''' Passwd : Æнº¿öµå º¯¼ö
'''''''''' Enpasswd : Enable Æнº¿öµå º¯¼ö
'''''''''' Command(100) : ½ÇÇàÇÒ ¸í·ÉÀ» µî·ÏÇÒ º¯¼ö - ÃÖ´ë 100°³ ¸í·É ½ÇÇà °¡´É
'''''''''' CmdCount : ¸í·ÉÀÇ °¹¼ö ¸¸Å­ ·çÇÁ¸¦ µ¹¸± º¯¼ö
'''''''''' DevCount : ÀåºñÀÇ °¹¼ö¸¸Å­ ·çÇÁ¸¦ µ¹¸± º¯¼ö



Sub main
  Dim A
FileRead
  for A=1 to DevCount
  call RunCmd(DevIP(A))
  next
End Sub
'''''''''' FileRead Sub ÇÔ¼ö¿¡¼­ Àåºñ IP, Æнº¿öµå, ½ÇÇàÇÒ ¸í·ÉÀ» Àоî¿Â´Ù
'''''''''' ÀåºñÀÇ °¹¼ö¸¸Å­ ·çÇÁ¸¦ µ¹·Á¼­ RunCmd Sub ÇÔ¼ö¿¡¼­ ¸í·É¾î¸¦ ½ÇÇàÇÑ´Ù.



Sub FileRead
'''''''''' ÆÄÀÏÀ» ¿­¾î¼­ Çѹø¿¡ ÇÑÁÙ¾¿ Àд´Ù.

Dim fso, f, str
Const ForReading = 1

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile("D:\visual script\Backbone_password.txt", ForReading, 0)
                str = f.Readline
    str = f.Readline
    Passwd = str


'''''''''' c:\password.txt ÆÄÀÏÀ» ¿­¾î¼­ ÇÑÁÙ¾¿ Àд´Ù.
'''''''''' ù°ÁÙÀº ÁÖ¼®À̹ǷΠ±×³É Àб⸸ ÇÏ°í
'''''''''' µÑ°ÁÙÀº Passwd º¯¼ö·Î, ¼Â°ÁÙÀº Enpasswd º¯¼ö¿¡ ¹Þ¾Æ¿Â´Ù.

        Set f = fso.OpenTextFile("D:\visual script\Á¦¼± Backbone_Checklist.txt", ForReading, 0)
        str = f.Readline

        Do While f.AtEndOfStream <> True
    str = f.Readline
DevCount = DevCount + 1
    DevIP(DevCount) = str
Loop

'''''''''' c:\Checklist.txt ÆÄÀÏÀ» ¿­¾î¼­ ÇÑÁÙ¾¿ Àд´Ù.
'''''''''' ù°ÁÙÀº ÁÖ¼®À̹ǷΠ±×³É Àб⸸ ÇÏ°í
'''''''''' µÑ°ÁÙºÎÅÍ ¸¶Áö¸· ÁÙ±îÁö Àд´Ù
'''''''''' ÇÑÁÙ ÀÐÀ»¶§¸¶´Ù DevCount¸¦ Áõ°¡½ÃÅ°°í
'''''''''' DevIP() ¹è¿­ º¯¼ö¿¡ Àåºñ IP¸¦ ¹Þ¾Æ¿Â´Ù.

        Set f = fso.OpenTextFile("D:\visual script\Backbone_command.txt", ForReading, 0)
        str = f.Readline

        Do While f.AtEndOfStream <> True
    str = f.Readline
CmdCount = CmdCount + 1
    Command(CmdCount) = str
Loop

'''''''''' c:\command.txt ÆÄÀÏÀ» ¿­¾î¼­ ÇÑÁÙ¾¿ Àд´Ù.
'''''''''' ù°ÁÙÀº ÁÖ¼®À̹ǷΠ±×³É Àб⸸ ÇÏ°í
'''''''''' µÑ°ÁÙºÎÅÍ ¸¶Áö¸· ÁÙ±îÁö Àд´Ù
'''''''''' ÇÑÁÙ ÀÐÀ»¶§¸¶´Ù CmdCount¸¦ Áõ°¡½ÃÅ°°í
'''''''''' Command() ¹è¿­ º¯¼ö¿¡ ½ÇÇàÇÒ ¸í·ÉÀ» ¹Þ¾Æ¿Â´Ù.

End Sub

Function RunCmd(IP)
'''''''''' ¸í·ÉÀ» ½ÇÇàÇÑ´Ù.

  crt.Session.Connect "/TELNET " & IP & " 23"
  crt.Screen.Synchronous = True

'''''''''' crt¿¡¼­ ÀåºñIP·Î ÅÚ³Ý Á¢¼ÓÀ» ÇÑ´Ù.
'''''''''' turn on synchronous mode so we don't miss any data
'''''''''' Turn on synchronous mode while performing Send/Wait sequences
'''''''''' so no input is missed.

  Dim logfile
  logfile = ("D:\SC_LOG\" & Date & "_" & IP & ".txt")
  crt.Session.LogFileName = logfile
  crt.Session.Log True

'''''''''' logfile Çü½ÄÀº IP_Date.txt (ex, 100.100.100.1_2009-04-10)
'''''''''' crt È­¸é»óÀÇ ¸ðµç ³»¿ëÀ» ·Î±× ÆÄÀÏ·Î ÀúÀåÇÑ´Ù.

  crt.Screen.WaitForString "username:"
  crt.Screen.Send "xxxx" & VbCr
    crt.Screen.WaitForString "password:"
    crt.Screen.Send "axxxx" & VbCr
    crt.Screen.WaitForString ">"
  crt.Screen.Send "en" & VbCr
  crt.Screen.WaitForString "Password:"
    crt.Screen.Send "wpxxxx" & VbCr
    crt.Screen.WaitForString "#"

'''''''''' Send initial carriage return
'''''''''' Wait for a tring that looks like "password: " or "Password: "
'''''''''' Send password followed by a carriage return
'''''''''' Wait for a ">"
'''''''''' Send This command "en" followed by a carriage return
'''''''''' Wait for a tring that looks like "password: " or "Password: "
'''''''''' Send enable password followed by a carriage return
'''''''''' Wait for a "#"

Dim B
  for B=1 to CmdCount
  crt.Screen.Send Command(B) & vbCr
                Do While (Not crt.Screen.WaitForString ("#" , 2))
    crt.Screen.Send chr(13)
Loop
  next
'''''''''' ¸í·ÉÀÇ °¹¼ö¸¸Å­ ·çÇÁ¸¦ µ¹·Á¼­ ¸í·ÉÀ» ½ÇÇàÇÑ´Ù
'''''''''' °¢ ¸í·ÉÀÌ ½ÇÇàµÉ¶§ ¸¶´Ù # ÇÁ·ÒÇÁÆ®°¡ ¶³¾îÁú¶§±îÁö ½ºÆäÀ̽º¹Ù¸¦ ÀÔ·ÂÇÑ´Ù.

crt.Screen.Send VbCr
  crt.Screen.WaitForString "#"
crt.Session.Log False
'''''''''' ·Î±× ÆÄÀÏ ÀúÀåÀ» ¿Ï·áÇÑ´Ù.

  crt.Session.Disconnect
  crt.Screen.Synchronous = false

'''''''''' Session disconnect
'''''''''' turn off synchronous mode to restore normal input processing

End Function
     
½Öcpu 2017-12
Çã°Æ...Á¸¹®°¡½Ê´Ï´Ù..


QnA
Á¦¸ñPage 1753/5680
2014-05   4946295   Á¤ÀºÁØ1
2015-12   1482970   ¹é¸Þ°¡
2012-12   12925   ¹Ì¼ö¸Ç
2014-08   8253   À©µµ¿ì10
2012-12   5746   ¿£ÄÚ
2023-05   2580   Caroline
2012-12   5392   ³ª¿ì¸¶Å©
2015-12   5044   ¹ÙºÎÆÃÀÌ
2015-12   3886   ¼­¿ïI±èµ¿¼ö
2009-11   10981   ·Î±×¾Æ¿ô
2019-03   4071   ¾Ç¸¶¶ó³×
2015-12   6211   À̹®¿µ
2020-05   3084   ¸§¹è¸£
2013-01   5875   °¡ºü·Î±¸³ª
2014-08   5404   Won³«¿¬
2015-12   4815   ¼ÛÁö¸¸
2020-05   4574   ±îÄ¡»ê°³²ÜÅÊ
2009-12   9900   ±èÁÖ¿ës
2023-05   2176   grzlr
2023-05   2980   ÀÓ¸í»ó
2018-01   5750   ¿Ã»©¹ÌÀá¿Í
2020-06   2104   ³×À̽ºÅÍ