您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關如何使用VBS修改二進制文件HEX數據的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
可用之處還是有的,如:隱藏快捷方式中目標文件位置;破解XP中TCP/IP連接數限制;去掉RAR右鍵解壓菜單等等。
復制代碼 代碼如下:
Public BinaryData
If (lcase(right(wscript.fullname,11))="wscript.exe") Then
WScript.Quit(0)
End If
If wscript.arguments.count<4 Then
Wscript.Echo "Change File Hex. By: lxzzr lxzzr@21cn.com"
Wscript.Echo ""
Wscript.Echo "Usage: cscript.exe " & WScript.ScriptName & " FilePath SavePath sHEX dHEX"
Wscript.Echo " : cscript.exe CHex.vbs "".\test.exe"" "".\new.exe"" ""80 7A 01 61"" ""80 7A 01 61"""
WScript.Quit(0)
End If
sHEX = Replace(LCase(Wscript.Arguments(2)), " ", "")
dHEX = Replace(LCase(Wscript.Arguments(3)), " ", "")
Wscript.Echo "File: " & Wscript.Arguments(0)
Wscript.Echo "sHEX: " & Wscript.Arguments(2)
Wscript.Echo "dHEX: " & Wscript.Arguments(3)
ReadBinary(Wscript.Arguments(0))
MyData = Replace(BinaryData, sHEX, dHEX)
WriteBinary Wscript.Arguments(1), MyData
Wscript.Echo "All done."
Wscript.Quit(0)
Function ReadBinary(FileName)
Dim Stream, ObjXML, MyNode
Set ObjXML = CreateObject("Microsoft.XMLDOM")
Set MyNode = ObjXML.CreateElement("binary")
Set Stream = CreateObject("ADODB.Stream")
MyNode.DataType = "bin.hex"
Stream.Type = 1
Stream.Open
Stream.LoadFromFile FileName
MyNode.NodeTypedValue = Stream.Read
Stream.Close
BinaryData = MyNode.Text
Set MyNode = Nothing
Set Stream = Nothing
Set ObjXML = Nothing
End Function
Function WriteBinary(FileName, BufferData)
Dim Stream, ObjXML, MyNode
Set ObjXML = CreateObject("Microsoft.XMLDOM")
Set MyNode = ObjXML.CreateElement("binary")
Set Stream = CreateObject("ADODB.Stream")
MyNode.DataType = "bin.hex"
MyNode.Text = BufferData
Stream.Type = 1
Stream.Open
Stream.Write MyNode.NodeTypedValue
Stream.SaveToFile FileName, 2
Stream.Close
Set stream = Nothing
Set MyNode = Nothing
Set ObjXML = Nothing
End Function
感謝各位的閱讀!關于“如何使用VBS修改二進制文件HEX數據”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。