#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=D:\\autoit3\\Aut2Exe\\Icons\\zz.ico
#AutoIt3Wrapper_Outfile=AutoLogin.exe
#AutoIt3Wrapper_Res_Comment=网维大师客户机专用
#AutoIt3Wrapper_Res_Description=pubwin解锁器
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=TVZML作品
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include<SysTray_UDF.au3>
Opt("MouseClickDownDelay", 100)
TraySetToolTip(@ScriptName)
If WinExists(@ScriptName) Then Exit
AutoItWinSetTitle(@ScriptName)
$log = @ScriptDir & "\\log\\ClientSetup" & @YEAR & @MON & @MDAY & ".log"
$dir = @ScriptDir & "\\Autologin.ini"
$url = IniRead($dir, "config", "url", "")
If $cmdline[0] = 0 Then
$input1 = InputBox("配置", "远程密码下载地址", $url, "", 300, "120", "-1", "-1")
If @error = 1 Or $input1 = "" Then
Exit
EndIf
IniWrite($dir, "config", "url", $input1)
$input2 = InputBox("配置", "PUBWIN解锁退出密码", "", "", 300, "120", "-1", "-1")
If @error = 1 Or $input2 = "" Then
Exit
EndIf
IniWrite("pubwin.txt", "config", "password", _password(1, $input2, $url, 0))
IniWrite($dir, "config", "password", _password(1, $input2, $url, 0))
MsgBox(0, "密文已写入文件", _password(1, $input2, $url, 0))
Exit
EndIf
If FileExists("d:\\ProtectedC00.sys") Then
FileSetAttrib("d:\\ProtectedC00.sys", "-RASH")
FileDelete("d:\\ProtectedC00.sys")
EndIf
If FileExists("d:\\ProtectedC00.sys") Then
Exit
EndIf
If Not FileExists(@ScriptDir & "\\log") Then DirCreate(@ScriptDir & "\\log")
If Not FileExists($dir) Then
FileWriteLine($log, "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "][Error] 没有找到配置文件.")
Exit
EndIf
$i = 1
While $i <= 10
Sleep(1000)
InetGet($url, "Config.dat", 1, 0)
$password = IniRead("Config.dat", "config", "password", "")
If Not $password = "" Then
IniWrite($dir, "config", "password", $password)
ExitLoop
EndIf
$i = $i + 1
WEnd
If $password = "" Then
$password = IniRead($dir, "config", "password", "")
EndIf
If $password = "" Then
FileWriteLine($log, "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "][Error] 下载远程配置文件失败")
If FileExists("Config.dat") Then FileDelete("Config.dat")
Exit
EndIf
$Pub_Password = _password(0, $password, $url, 0)
If FileExists("Config.dat") Then FileDelete("Config.dat")
FileWriteLine($log, "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "][Info] 解密成功")
$p_process = "PubwinClient.exe"
$autorun = 0
_AutoLoginPUBWIN()
Sleep(2000)
If Not ProcessExists("PubwinClient.exe") Then Exit
$list = ProcessList("smss.exe")
Local $ep_pid
For $i = 1 To $list[0][0]
If StringInStr(Procespath($list[$i][1]), "PubwinClient\\smss.exe") > 1 Then
$ep_pid = $list[$i][1]
If ProcessExists($list[$i][1]) Then ProcessClose($list[$i][1])
EndIf
Next
Local $t
For $t = 1 To 3
_kick_icafe()
Sleep(2000)
$p_index = _SysTrayIconIndex($p_process)
$p_xy = _SysTrayIconPos($p_index)
If IsArray($p_xy) Then
BlockInput(1)
$p_x = $p_xy[0] + 7
$p_y = $p_xy[1] + 7
MouseMove($p_x, $p_y, 0)
MouseClick("left", $p_x, $p_y, 2, 0)
Sleep(500)
$p_y = $p_xy[1] - 85
MouseMove($p_x, $p_y, 0)
Sleep(100)
MouseClick("left", $p_x, $p_y, 1, 0)
If Not ProcessExists($p_process) Then Exit
If WinWaitActive("验证口令", "请输入口令", 1) Then ExitLoop
BlockInput(0)
EndIf
Next
_kick_icafe()
If WinExists("验证口令", "请输入口令") Then
BlockInput(1)
$p_xy = WinGetPos("验证口令", "请输入口令")
$p_x = $p_xy[0] + $p_xy[2] / 2
$p_y = $p_xy[1] + $p_xy[3] / 2
MouseMove($p_x, $p_y, 0)
MouseClick("left", $p_x, $p_y, 2, 0)
ControlSetText("验证口令", "请输入口令", "Edit1", $Pub_Password)
Sleep(500)
MouseClick("left", $p_x, $p_y, 2, 0)
ControlSend("验证口令", "", "Button1", "{enter}")
BlockInput(0)
EndIf
Sleep(500)
_kick_icafe()
If WinExists("询问", "下次Windows启动时是否自动运行Pubwin") Then
$p_xy = WinGetPos("询问", "下次Windows启动时是否自动运行Pubwin")
$p_x = $p_xy[0] + $p_xy[2] / 2
$p_y = $p_xy[1] + $p_xy[3] / 2
MouseMove($p_x, $p_y, 0)
MouseClick("left", $p_x, $p_y, 2, 0)
WinWaitActive("询问", "下次Windows启动时是否自动运行Pubwin", 1)
If $autorun = 1 Then
ControlSend("询问", "", "Button2", "{y}")
Else
ControlSend("询问", "", "Button2", "{n}")
EndIf
EndIf
If ProcessExists(@ComputerName & ".exe") Then
ProcessClose(@ComputerName & ".exe")
EndIf
If ProcessExists("HintSafe.exe") Then
ProcessClose("HintSafe.exe")
EndIf
If ProcessExists("filemon.exe") Then
ProcessClose("filemon.exe")
EndIf
ProcessClose($ep_pid)
Exit
Func _kick_icafe()
If ProcessExists("BarClientView.exe") Then
If WinExists("网维大师(ICafe) 娱乐平台") Then
WinSetState("网维大师(ICafe) 娱乐平台", "", @SW_MINIMIZE)
EndIf
EndIf
EndFunc ;==>_kick_icafe
Func _AutoLoginPUBWIN()
Local $i, $j
For $i = 1 To 30
If WinExists("Client") Then
$i = 999
ExitLoop
EndIf
Sleep(1000)
Next
If $i = 999 Then
Else
Return 0
EndIf
For $i = 1 To 15
If WinExists("LockDlg") Then
$i = 999
ExitLoop
EndIf
Sleep(1000)
Next
If $i = 999 Then
Else
Return 0
EndIf
For $j = 1 To 15
If WinExists("ActiveMovie Window") Then
$i = 999
ExitLoop
EndIf
Sleep(1000)
Next
If $i = 999 Then
Else
Return 0
EndIf
BlockInput(1)
Sleep(1000)
MouseClick("left")
WinWaitActive("LockDlg", "", 3)
ControlSetText("LockDlg", "", "Edit1", "admin")
Sleep(250)
WinWaitActive("LockDlg", "", 3)
ControlSetText("LockDlg", "", "Edit2", $Pub_Password)
Sleep(250)
WinWaitActive("LockDlg", "", 3)
ControlSend("LockDlg", "", "Button1", "{enter}")
BlockInput(0)
EndFunc ;==>_AutoLoginPUBWIN
Func Procespath($pid)
$objWMIService = ObjGet("winmgmts:\\\\.\\root\\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId = " & $pid)
For $objItem In $colItems
$cmdpath = $objItem.CommandLine
$exepath = $objItem.ExecutablePath
$path = StringSplit($cmdpath, "\\")
If $path[0] <= 2 Then
Return $exepath
Else
Return $cmdpath
EndIf
Next
EndFunc ;==>Procespath
Func _password($jiami_lp, $jiami_txt, $jiami_pas, $jiami_lev)
Local $tlev, $bhb, $jjxc = 1, $Num
Local $jh[100]
If $jiami_txt = '' Or $jiami_pas = '' Or StringLen($jiami_pas) > 100 _
Or $jiami_lev > 9 Or Int($jiami_lev) <> $jiami_lev Or $jiami_lev < 0 Then Return -1
If $jiami_lp = 1 Then
$sosu = StringLen($jiami_pas)
For $pa_s = 1 To $sosu
$jh[$pa_s] = Asc(StringMid($jiami_pas, $pa_s, 1))
$Num = $Num & $jh[$pa_s]
If $jjxc > 3 Then $jjxc = 1
If $jjxc = 1 Then
$bhb = Int($bhb + $jh[$pa_s])
ElseIf $jjxc = 2 Then
$bhb = Int($bhb * $jh[$pa_s])
ElseIf $jjxc = 3 Then
$bhb = Int($bhb - $jh[$pa_s])
EndIf
$jjxc += 1
Next
$Num = StringLeft($Num, $jiami_lev) & $bhb & StringRight($Num, $jiami_lev)
$jiami_txt = StringTrimLeft(StringToBinary($jiami_txt, 2), 2)
$y_si = $sosu
$j_si = 1
Do
$vi = StringMid($jh[$j_si], 1, 1) + StringMid($jh[$y_si], StringLen($jh[$y_si]), 1)
$tempa = StringMid($jiami_txt, 1, $vi - 1)
$tempb = StringMid($jiami_txt, $vi)
$jiami_txt = $tempa & $jh[$j_si] & $tempb
$y_si -= 1
$j_si += 1
Until $y_si <= 0 And $j_si >= $sosu
$st = StringLen($Num)
$txtshi = StringLen($jiami_txt)
For $kl = 1 To $st
$rtemp = ''
For $vn = 1 To $txtshi Step StringMid($Num, $kl, 1) + 30
$rtemp = StringMid($jiami_txt, $vn, StringMid($Num, $kl, 1) + 30) & $rtemp
Next
$jiami_txt = $rtemp
Next
Return $jiami_txt
ElseIf $jiami_lp = 0 Then
$sosu = StringLen($jiami_pas)
For $pa_s = 1 To $sosu
$jh[$pa_s] = Asc(StringMid($jiami_pas, $pa_s, 1))
$Num = $Num & $jh[$pa_s]
If $jjxc > 3 Then $jjxc = 1
If $jjxc = 1 Then
$bhb = Int($bhb + $jh[$pa_s])
ElseIf $jjxc = 2 Then
$bhb = Int($bhb * $jh[$pa_s])
ElseIf $jjxc = 3 Then
$bhb = Int($bhb - $jh[$pa_s])
EndIf
$jjxc += 1
Next
$Num = StringLeft($Num, $jiami_lev) & $bhb & StringRight($Num, $jiami_lev)
$st = StringLen($Num)
Do
$txtshi = StringLen($jiami_txt)
$rtemp = ''
Do
$rtemp = $rtemp & StringRight($jiami_txt, StringMid($Num, $st, 1) + 30)
$jiami_txt = StringTrimRight($jiami_txt, StringMid($Num, $st, 1) + 30)
$txtshi -= StringMid($Num, $st, 1) + 30
Until $txtshi <= 0
$jiami_txt = $rtemp
$st -= 1
Until $st <= 0
$y_si = $sosu
$j_si = 1
Do
$vi = StringMid($jh[$y_si], 1, 1) + StringMid($jh[$j_si], StringLen($jh[$j_si]), 1)
$tempa = StringMid($jiami_txt, 1, $vi - 1)
$tempb = StringMid($jiami_txt, $vi + StringLen($jh[$y_si]))
$jiami_txt = $tempa & $tempb
$y_si -= 1
$j_si += 1
Until $y_si <= 0
$jiami_txt = '0x' & $jiami_txt
$jiami_txt = BinaryToString($jiami_txt, 2)
Return $jiami_txt
Else
Return -1
EndIf
EndFunc ;==>_password