[Autoit] Connection SSH thông qua Bitvise SSH Client bằng Autoit

Status
Not open for further replies.
Joined
Feb 15, 2015
Messages
663
Reactions
384
MR
0.001
Follow me on Facebook Chat with me via Skype
Chào mọi người !!

+ Bạn nào từng làm qua chỗ này rồi cho mình xin vài ví dụ xem với , đọc tài liệu tiếng anh không hiểu cho lắm

Cảm ơn mọi người !!!
 

candylop

Hero
Joined
Nov 24, 2013
Messages
4,091
Reactions
3,384
MR
0.003
Chat with me via Skype
Ặc ko phải hôm nọ thím có lấy code rồi à. Ko hiểu đoạn nào thì yh mình giải thích cho.
 

HotGirlViet

Junior
Joined
Oct 15, 2015
Messages
67
Reactions
10
MR
0.000
Func LoginBitvise()
If _GUICtrlListView_GetItemCount($listViewSSH)>=1 Then
ProcessClose("BvSsh.exe")
$row=_GUICtrlListView_GetSelectedIndices($listViewSSH)
$row+=1
$aItem = GUICtrlRead(GUICtrlRead($listViewSSH))
_GUICtrlListView_SetItemSelected($listViewSSH,$row,True,True)
_GUICtrlListView_ClickItem($listViewSSH,$row)
$textTemp = StringSplit($aItem,"|")
ReDim $textTemp[6]
$ip=$textTemp[2]
$id=$textTemp[3]
$password=$textTemp[4]
Global $nation=$textTemp[5]
Local $sDir=RegRead("HKEY_CLASSES_ROOT\Bitvise.SSH.Client4.60.Profile\DefaultIcon","")
$sDir=StringTrimRight($sDir,2)
$bitvise =$sDir &" -profile="&@WorkingDir&"\tenten.bscp"&" -host="&$ip&" -port=22 -username="&$id&" -password="&$password&" -loginOnStartup -exitOnLogout"
Run($bitvise)
$delay=0
$auth=0
While $delay<=30
If ProcessExists("BvSsh.exe") Then

$auth=WinExists("Host Key Verification")
if $auth =1 Then
$auth=WinGetHandle("Host Key Verification")
WinActivate($auth)
ControlClick("Host Key Verification","Accept and &Save","[CLASS:Button;INSTANCE:1]")
ExitLoop
EndIf
Sleep(500)
$delay+=1
Else
ExitLoop
EndIf
WEnd
$answer=""
$doi=0
Do
$answer = ControlGetText("Bitvise SSH Client","","[CLASS:Button;INSTANCE:1]")
Sleep(1000)
$doi+=1
WinClose("User Authentication Banner")
WinClose("Bitvise xterm - tenten.bscp - "&$ip&":22")
WinClose("Bitvise SFTP - tenten.bscp - "&$ip&":22")
WinClose("Bvtermc Error")
WinClose("Totermc Error")
Until $doi=10 or StringCompare($answer,"Logout")=0

Switch $answer
Case "Abort"
LoginBitvise()
Case ""
LoginBitvise()
EndSwitch
EndIf
WinClose("User Authentication Banner")
EndFunc
Func ChangeSocks()
Do
LoginBitvise()
Until CheckCountry1($ip)=1

WinClose("Bitvise xterm - tenten.bscp - "&$ip&":22")
WinClose("Bitvise SFTP - tenten.bscp - "&$ip&":22")
EndFunc

Code cùi dùng tạm
 
Func LoginBitvise()
If _GUICtrlListView_GetItemCount($listViewSSH)>=1 Then
ProcessClose("BvSsh.exe")
$row=_GUICtrlListView_GetSelectedIndices($listViewSSH)
$row+=1
$aItem = GUICtrlRead(GUICtrlRead($listViewSSH))
_GUICtrlListView_SetItemSelected($listViewSSH,$row,True,True)
_GUICtrlListView_ClickItem($listViewSSH,$row)
$textTemp = StringSplit($aItem,"|")
ReDim $textTemp[6]
$ip=$textTemp[2]
$id=$textTemp[3]
$password=$textTemp[4]
Global $nation=$textTemp[5]
Local $sDir=RegRead("HKEY_CLASSES_ROOT\Bitvise.SSH.Client4.60.Profile\DefaultIcon","")
$sDir=StringTrimRight($sDir,2)
$bitvise =$sDir &" -profile="&@WorkingDir&"\tenten.bscp"&" -host="&$ip&" -port=22 -username="&$id&" -password="&$password&" -loginOnStartup -exitOnLogout"
Run($bitvise)
$delay=0
$auth=0
While $delay<=30
If ProcessExists("BvSsh.exe") Then

$auth=WinExists("Host Key Verification")
if $auth =1 Then
$auth=WinGetHandle("Host Key Verification")
WinActivate($auth)
ControlClick("Host Key Verification","Accept and &Save","[CLASS:Button;INSTANCE:1]")
ExitLoop
EndIf
Sleep(500)
$delay+=1
Else
ExitLoop
EndIf
WEnd
$answer=""
$doi=0
Do
$answer = ControlGetText("Bitvise SSH Client","","[CLASS:Button;INSTANCE:1]")
Sleep(1000)
$doi+=1
WinClose("User Authentication Banner")
WinClose("Bitvise xterm - tenten.bscp - "&$ip&":22")
WinClose("Bitvise SFTP - tenten.bscp - "&$ip&":22")
WinClose("Bvtermc Error")
WinClose("Totermc Error")
Until $doi=10 or StringCompare($answer,"Logout")=0

Switch $answer
Case "Abort"
LoginBitvise()
Case ""
LoginBitvise()
EndSwitch
EndIf
WinClose("User Authentication Banner")
EndFunc
Func ChangeSocks()
Do
LoginBitvise()
Until CheckCountry1($ip)=1

WinClose("Bitvise xterm - tenten.bscp - "&$ip&":22")
WinClose("Bitvise SFTP - tenten.bscp - "&$ip&":22")
EndFunc

Code cùi dùng tạm
Thank bạn nhiều
 
Status
Not open for further replies.

Announcements

Today's birthdays

Forum statistics

Threads
424,007
Messages
7,138,659
Members
176,499
Latest member
vin777garden

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom