首页 » 程序源码 » 其他源码 » TeamViewer resetclientID重置PC端id源码

TeamViewer resetclientID重置PC端id源码

如何重置TeamViewer的ID?我们先来了解一下什么是WMI,
WMI有一组API。我们不管使用VBScript、PowerShell脚本还是利用C#的来访问WMI的类库,都是因为WMI向外暴露的一组API。这些API是在系统安装WMI模块的时候安装的,通过他们我们能够能拿到我们想要的类。WMI有一个存储库。尽管WMI的多数实例数据都不存储在WMI中,但是WMI确实有一个存储库,用来存放提供程序提供的类信息,或者称为类的蓝图或者Schema。WMI有一个Service。WMI总是能够响应用户的访问,那是因为它有一个一直运行的Windows服务,名字叫Winmgmt。停止这个服务,所有对WMI的操作都将没有反应。WMI是可扩展的。人人都知道WMI能干很多事情,读取本机硬盘信息、读取远程计算机的用户信息、读取域用户信息等等。基本上,你能想到的获取或者更改资源的操作,它都能干。可谓吃得少,干得多。它为什么这么能干呢?这基于WMI的可扩展性。WMI对资源的操作,不是它自己实现了什么方法,而完全取决于向它注册的提供程序。

如何重置TeamViewer的ID?重置TeamViewer的ID的原理是什么,请看下面的源码
Autoit3源代码

; 
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------
#RequireAdmin
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------
Func _ProcessGetName($i_PID)
	If Not ProcessExists($i_PID) Then
		SetError(1)
		Return ''
	EndIf
	Local $a_Processes = ProcessList()
	If Not @error Then
		For $i = 1 To $a_Processes[0][0]
			If $a_Processes[$i][1] = $i_PID Then Return $a_Processes[$i][0]
		Next
	EndIf
	SetError(1)
	Return ''
EndFunc
Func _ProcessGetPriority($vProcess)
	Local $i_PID = ProcessExists($vProcess)
	If Not $i_PID Then
		SetError(1)
		Return -1
	EndIf
	Local $hDLL = DllOpen('kernel32.dll')
	Local $aProcessHandle = DllCall($hDLL, 'int', 'OpenProcess', 'int', 0x0400, 'int', False, 'int', $i_PID)
	Local $aPriority = DllCall($hDLL, 'int', 'GetPriorityClass', 'int', $aProcessHandle[0])
	DllCall($hDLL, 'int', 'CloseHandle', 'int', $aProcessHandle[0])
	DllClose($hDLL)
	Switch $aPriority[0]
		Case 0x00000040
			Return 0
		Case 0x00004000
			Return 1
		Case 0x00000020
			Return 2
		Case 0x00008000
			Return 3
		Case 0x00000080
			Return 4
		Case 0x00000100
			Return 5
		Case Else
			SetError(1)
			Return -1
	EndSwitch
EndFunc
Func _RunDOS($sCommand)
	Return RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
EndFunc
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------
Func _FileCountLines($sFilePath)
	Local $N = FileGetSize($sFilePath) - 1
	If @error Or $N = -1 Then Return 0
	Return StringLen(StringAddCR(FileRead($sFilePath, $N))) - $N + 1
EndFunc
Func _FileCreate($sFilePath)
	Local $hOpenFile
	Local $hWriteFile
	$hOpenFile = FileOpen($sFilePath, 2)
	If $hOpenFile = -1 Then
		SetError(1)
		Return 0
	EndIf
	$hWriteFile = FileWrite($hOpenFile, "")
	If $hWriteFile = -1 Then
		SetError(2)
		Return 0
	EndIf
	FileClose($hOpenFile)
	Return 1
EndFunc
Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0)
	Local $hSearch, $sFile, $asFileList[1]
	If Not FileExists($sPath) Then Return SetError(1, 1, "")
	If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringInStr($sFilter, "|")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "")
	If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
	$hSearch = FileFindFirstFile($sPath & "\" & $sFilter)
	If $hSearch = -1 Then Return SetError(4, 4, "")
	While 1
		$sFile = FileFindNextFile($hSearch)
		If @error Then
			SetError(0)
			ExitLoop
		EndIf
		If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop
		If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop
		ReDim $asFileList[UBound($asFileList) + 1]
		$asFileList[0] = $asFileList[0] + 1
		$asFileList[UBound($asFileList) - 1] = $sFile
	WEnd
	FileClose($hSearch)
	Return $asFileList
EndFunc
Func _FilePrint($s_File, $i_Show = @SW_HIDE)
	Local $a_Ret = DllCall("shell32.dll", "long", "ShellExecute", _
			"hwnd", 0, _
			"string", "print", _
			"string", $s_File, _
			"string", "", _
			"string", "", _
			"int", $i_Show)
	If $a_Ret[0] > 32 And Not @error Then
		Return 1
	Else
		SetError($a_Ret[0])
		Return 0
	EndIf
EndFunc
Func _FileReadToArray($sFilePath, ByRef $aArray)
	Local $hFile
	$hFile = FileOpen($sFilePath, 0)
	If $hFile = -1 Then
		SetError(1)
		Return 0
	EndIf
	$aArray = StringSplit(StringStripCR(FileRead($hFile, FileGetSize($sFilePath))), @LF)
	FileClose($hFile)
	Return 1
EndFunc
Func _FileWriteFromArray($sFilePath, $a_Array, $i_Base = 0, $i_UBound = 0)
	Local $hFile
	If Not IsArray($a_Array) Then
		SetError(2)
		Return 0
	EndIf
	Local $last = UBound($a_Array) - 1
	If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last
	If $i_Base < 0 Or $i_Base > $last Then $i_Base = 0
	$hFile = FileOpen($sFilePath, 2)
	If $hFile = -1 Then
		SetError(1)
		Return 0
	EndIf
	FileWrite($hFile, $a_Array[$i_Base])
	For $x = $i_Base + 1 To $i_UBound
		FileWrite($hFile, @CRLF & $a_Array[$x])
	Next
	FileClose($hFile)
	Return 1
EndFunc
Func _FileWriteLog($sLogPath, $sLogMsg)
	Local $sDateNow
	Local $sTimeNow
	Local $sMsg
	Local $hOpenFile
	Local $hWriteFile
	$sDateNow = @YEAR & "-" & @MON & "-" & @MDAY
	$sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
	$sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg
	$hOpenFile = FileOpen($sLogPath, 1)
	If $hOpenFile = -1 Then
		SetError(1)
		Return 0
	EndIf
	$hWriteFile = FileWriteLine($hOpenFile, $sMsg)
	If $hWriteFile = -1 Then
		SetError(2)
		Return 0
	EndIf
	FileClose($hOpenFile)
	Return 1
EndFunc
Func _FileWriteToLine($sFile, $iLine, $sText, $fOverWrite = 0)
	If $iLine <= 0 Then
		SetError(4)
		Return 0
	EndIf
	If Not IsString($sText) Then
		SetError(6)
		Return 0
	EndIf
	If $fOverWrite <> 0 And $fOverWrite <> 1 Then
		SetError(5)
		Return 0
	EndIf
	If Not FileExists($sFile) Then
		SetError(2)
		Return 0
	EndIf
	Local $filtxt = FileRead($sFile, FileGetSize($sFile))
	$filtxt = StringSplit($filtxt, @CRLF, 1)
	If UBound($filtxt, 1) < $iLine Then
		SetError(1)
		Return 0
	EndIf
	Local $fil = FileOpen($sFile, 2)
	If $fil = -1 Then
		SetError(3)
		Return 0
	EndIf
	For $i = 1 To UBound($filtxt) - 1
		If $i = $iLine Then
			If $fOverWrite = 1 Then
				If $sText <> '' Then
					FileWrite($fil, $sText & @CRLF)
				Else
					FileWrite($fil, $sText)
				EndIf
			EndIf
			If $fOverWrite = 0 Then
				FileWrite($fil, $sText & @CRLF)
				FileWrite($fil, $filtxt[$i] & @CRLF)
			EndIf
		ElseIf $i < UBound($filtxt, 1) - 1 Then
			FileWrite($fil, $filtxt[$i] & @CRLF)
		ElseIf $i = UBound($filtxt, 1) - 1 Then
			FileWrite($fil, $filtxt[$i])
		EndIf
	Next
	FileClose($fil)
	Return 1
EndFunc
Func _PathFull($sRelativePath, $sBasePath = @WorkingDir)
	If Not $sRelativePath Or $sRelativePath = "." Then Return $sBasePath
	Local $sFullPath = StringReplace($sRelativePath, "/", "\")
	Local $sPath = StringLeft($sFullPath, 2)
	StringReplace($sFullPath, "\", "")
	If @extended = StringLen($sFullPath) Then Return StringLeft($sBasePath, 2) & "\"
	If StringLeft($sFullPath, 1) = "\" Then
		If $sPath = "\\" Then
			$sFullPath = StringTrimLeft($sFullPath, 2)
			$sPath &= StringLeft($sFullPath, StringInStr($sFullPath, "\") - 1)
		Else
			$sPath = StringLeft($sBasePath, 2)
		EndIf
	ElseIf Not StringInStr($sPath, ":") Then
		$sFullPath = $sBasePath & "\" & $sFullPath
		$sPath = StringLeft($sBasePath, 2)
	EndIf
	Local $aTemp = StringSplit($sFullPath, "\")
	Local $aPathParts[$aTemp[0]], $j = 0
	For $i = 2 To $aTemp[0]
		If $aTemp[$i] = ".." Then
			If $j Then $j -= 1
		ElseIf Not ($aTemp[$i] = "" And $i <> $aTemp[0]) And $aTemp[$i] <> "." Then
			$aPathParts[$j] = $aTemp[$i]
			$j += 1
		EndIf
	Next
	$sFullPath = $sPath
	For $i = 0 To $j - 1
		$sFullPath &= "\" & $aPathParts[$i]
	Next
	While StringInStr($sFullPath, ".\")
		$sFullPath = StringReplace($sFullPath, ".\", "\")
	WEnd
	Return $sFullPath
EndFunc
Func _PathMake($szDrive, $szDir, $szFName, $szExt)
	Local $szFullPath
	If StringLen($szDrive) Then
		If Not (StringLeft($szDrive, 2) = "\\") Then $szDrive = StringLeft($szDrive, 1) & ":"
	EndIf
	If StringLen($szDir) Then
		If Not (StringRight($szDir, 1) = "\") And Not (StringRight($szDir, 1) = "/") Then $szDir = $szDir & "\"
	EndIf
	If StringLen($szExt) Then
		If Not (StringLeft($szExt, 1) = ".") Then $szExt = "." & $szExt
	EndIf
	$szFullPath = $szDrive & $szDir & $szFName & $szExt
	Return $szFullPath
EndFunc
Func _PathSplit($szPath, ByRef $szDrive, ByRef $szDir, ByRef $szFName, ByRef $szExt)
	Local $drive = ""
	Local $dir = ""
	Local $fname = ""
	Local $ext = ""
	Local $pos
	Local $array[5]
	$array[0] = $szPath
	If StringMid($szPath, 2, 1) = ":" Then
		$drive = StringLeft($szPath, 2)
		$szPath = StringTrimLeft($szPath, 2)
	ElseIf StringLeft($szPath, 2) = "\\" Then
		$szPath = StringTrimLeft($szPath, 2)
		$pos = StringInStr($szPath, "\")
		If $pos = 0 Then $pos = StringInStr($szPath, "/")
		If $pos = 0 Then
			$drive = "\\" & $szPath
			$szPath = ""
		Else
			$drive = "\\" & StringLeft($szPath, $pos - 1)
			$szPath = StringTrimLeft($szPath, $pos - 1)
		EndIf
	EndIf
	Local $nPosForward = StringInStr($szPath, "/", 0, -1)
	Local $nPosBackward = StringInStr($szPath, "\", 0, -1)
	If $nPosForward >= $nPosBackward Then
		$pos = $nPosForward
	Else
		$pos = $nPosBackward
	EndIf
	$dir = StringLeft($szPath, $pos)
	$fname = StringRight($szPath, StringLen($szPath) - $pos)
	If StringLen($dir) = 0 Then $fname = $szPath
	$pos = StringInStr($fname, ".", 0, -1)
	If $pos Then
		$ext = StringRight($fname, StringLen($fname) - ($pos - 1))
		$fname = StringLeft($fname, $pos - 1)
	EndIf
	$szDrive = $drive
	$szDir = $dir
	$szFName = $fname
	$szExt = $ext
	$array[1] = $drive
	$array[2] = $dir
	$array[3] = $fname
	$array[4] = $ext
	Return $array
EndFunc
Func _ReplaceStringInFile($szFileName, $szSearchString, $szReplaceString, $fCaseness = 0, $fOccurance = 1)
	Local $iRetVal = 0
	Local $szTempFile, $hWriteHandle, $aFileLines, $nCount, $sEndsWith, $hFile
	If StringInstr(FileGetAttrib($szFileName),"R") then
		SetError(6)
		Return -1
	EndIf
	$hFile = FileOpen($szFileName, 0)
	If $hFile = -1 Then
		SetError(1)
		Return -1
	EndIf
	Local $s_TotFile = FileRead($hFile, FileGetSize($szFileName))
	If StringRight($s_TotFile, 2) = @CRLF Then
		$sEndsWith = @CRLF
	ElseIf StringRight($s_TotFile, 1) = @CR Then
		$sEndsWith = @CR
	ElseIf StringRight($s_TotFile, 1) = @LF Then
		$sEndsWith = @LF
	Else
		$sEndsWith = ""
	EndIf
	$aFileLines = StringSplit(StringStripCR($s_TotFile), @LF)
	FileClose($hFile)
	$szTempFile = _TempFile()
	$hWriteHandle = FileOpen($szTempFile, 2)
	If $hWriteHandle = -1 Then
		SetError(2)
		Return -1
	EndIf
	For $nCount = 1 To $aFileLines[0]
		If StringInStr($aFileLines[$nCount], $szSearchString, $fCaseness) Then
			$aFileLines[$nCount] = StringReplace($aFileLines[$nCount], $szSearchString, $szReplaceString, 1 - $fOccurance, $fCaseness)
			$iRetVal = $iRetVal + 1
			If $fOccurance = 0 Then
				$iRetVal = 1
				ExitLoop
			EndIf
		EndIf
	Next
	For $nCount = 1 To $aFileLines[0] - 1
		If FileWriteLine($hWriteHandle, $aFileLines[$nCount]) = 0 Then
			SetError(3)
			FileClose($hWriteHandle)
			Return -1
		EndIf
	Next
	If $aFileLines[$nCount] <> "" Then FileWrite($hWriteHandle, $aFileLines[$nCount] & $sEndsWith)
	FileClose($hWriteHandle)
	If FileDelete($szFileName) = 0 Then
		SetError(4)
		Return -1
	EndIf
	If FileMove($szTempFile, $szFileName) = 0 Then
		SetError(5)
		Return -1
	EndIf
	Return $iRetVal
EndFunc
Func _TempFile($s_DirectoryName = @TempDir, $s_FilePrefix = "~", $s_FileExtension = ".tmp", $i_RandomLength = 7)
	Local $s_TempName
	If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @TempDir
	If Not FileExists($s_DirectoryName) Then $s_DirectoryName = @ScriptDir
	If StringRight($s_DirectoryName, 1) <> "\" Then $s_DirectoryName = $s_DirectoryName & "\"
	Do
		$s_TempName = ""
		While StringLen($s_TempName) < $i_RandomLength
			$s_TempName = $s_TempName & Chr(Random(97, 122, 1))
		WEnd
		$s_TempName = $s_DirectoryName & $s_FilePrefix & $s_TempName & $s_FileExtension
	Until Not FileExists($s_TempName)
	Return ($s_TempName)
EndFunc
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------
 If WinExists(@ScriptName) Then Exit
 AutoItWinSetTitle(@ScriptName)
 AutoItSetOption("TrayIconHide", 1)
 AutoItSetOption("MouseCoordMode", 0)
 If ProcessExists("TeamViewer_Service.exe") Then
 RunWait(@ComSpec & " /C net stop TeamViewer","", @SW_HIDE)
 EndIf
 If ProcessExists("TeamViewer.exe") Then
 ProcessClose("TeamViewer.exe")
 EndIf
 RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer", "ClientID")
 Local $iRc = _RunDos("wmic class Win33_ComputerSystemProduct delete")
 $VBSFile = @ScriptDir&'\source.vbs'
 If Not FileExists($VBSFile) Then _FileCreate($VBSFile)
 FileSetAttrib(@ScriptDir&'\source.vbs', "+H")
 FileWriteLine ('source.vbs', 'intHighNumber = 99999')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'intLowNumber = 10000')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'intNumbers = 1')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', ' Randomize')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', ' intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'strnum = "01234567-8910-ABCD-1111-093F03C"')
 FileWriteLine ('source.vbs', 'strnum = strnum & Cstr(intNumber)')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'Set oLocation = CreateObject("WbemScripting.SWbemLocator")')
 FileWriteLine ('source.vbs', 'Set oServices = oLocation.ConnectServer(, "root\cimv2")')
 FileWriteLine ('source.vbs', 'Set FakeClass = oServices.Get')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'FakeClass.Path_.Class = "Win33_ComputerSystemProduct"')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "Caption", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "Description", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "IdentifyingNumber", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "Name", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "SKUNumber", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "UUID", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "Vendor", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_.add "Version", 8')
 FileWriteLine ('source.vbs', 'FakeClass.Properties_("Name").Qualifiers_.add "key", false')
 FileWriteLine ('source.vbs', 'FakeClass.Put_')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'Set FakeClass = GetObject("Winmgmts:root\cimv2:Win33_ComputerSystemProduct").SpawnInstance_')
 FileWriteLine ('source.vbs', '')
 FileWriteLine ('source.vbs', 'FakeClass.Caption = "http://www.teamviewer.com"')
 FileWriteLine ('source.vbs', 'FakeClass.Description = "class for teamviewer"')
 FileWriteLine ('source.vbs', 'FakeClass.IdentifyingNumber = "www.teamviewer.com"')
 FileWriteLine ('source.vbs', 'FakeClass.Name = "Teamviewer"')
 FileWriteLine ('source.vbs', 'FakeClass.SKUNumber = ""')
 FileWriteLine ('source.vbs', 'FakeClass.UUID = strnum')
 FileWriteLine ('source.vbs', 'FakeClass.Vendor = "Teamviewer"')
 FileWriteLine ('source.vbs', 'FakeClass.Version = "6.x"')
 FileWriteLine ('source.vbs', 'FakeClass.Put_')
 ShellExecute ("source.vbs", "", "", "open")
 Sleep(500)
 FileDelete(@ScriptDir&'\source.vbs')
 RunWait(@ComSpec & " /C net start TeamViewer","", @SW_HIDE)
 Run(@ScriptDir&'\TeamViewer.exe')
; ----------------------------------------------------------------------------
; 
; ----------------------------------------------------------------------------


其中关键的source.vbs代码

百脑问
此处内容已经被作者无情的隐藏,请输入验证码查看内容
验证码:
请关注“百脑问官方公众号,回复关键字“118”,获取验证码。【注】用微信扫描右侧二维码就可以关注“百脑问”官方公众号。

仅此远远不够,还得需要修改teamviewer中的Win32_ComputerSystemProduct为Win33_ComputerSystemProduct,同时去掉teamviewer的自校验!

未经允许不得转载:百脑问 » TeamViewer resetclientID重置PC端id源码

×

感谢您的支持,我们会一直保持!

扫码支持
请土豪扫码随意打赏

打开微信扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

分享到:更多 ()

评论 抢沙发

评论前必须登录!

百脑问 创新坚持 杰然不同

赞助我们联系我们
数据查询次数:23 消耗时间:0.578 秒, 使用内存: 19.40MB
您好,有什么可以帮您吗!