如果将配置信息写入EXE文件,有实例,但不成功,我不是做木马。
写了公司的一些小软件,每一个软件都有,一些固定的值,但不能用INI文件保存,只好,写到EXE里
在EXE里固定读取三个常量。
用生成器把这三个常量替换值。如下是网上的列子。
On Error Resume Next Dim ip() As Byte Dim port() As Byte Dim password() As Byte If LenB(Text1.Text) > 40 Then MsgBox "字符超出长度", vbOKOnly + 16, "提示" Exit Sub End If If Val(Text2.Text) <= 0 Or Val(Text2.Text) > 65535 Then MsgBox "端口错误", vbOKOnly + 16, "提示" Exit Sub End If If Len(Text3.Text) > 6 Then MsgBox "密码字符超出长度", vbOKOnly + 16, "提示" Exit Sub End If ip = Text1.Text port = Text2.Text password = Text3.Text Kill App.Path & "\1.EXE" FileCopy App.Path & "\1.DAT", App.Path & "\1.EXE" ReDim Preserve ip(LenB(Text1.Text) - 1) ReDim Preserve port(LenB(Text2.Text) - 1) ReDim Preserve password(LenB(Text3.Text) - 1) Open App.Path & "\1.exe" For Binary Access Write As #1 Seek #1, &H1829 Put #1, , ip Close #1 Open App.Path & "\1.exe" For Binary Access Write As #1 Seek #1, &H1859 Put #1, , port Close #1 Open App.Path & "\1.exe" For Binary Access Write As #1 Seek #1, &H1869 Put #1, , password Close #1 MsgBox "1.exe已经配置成功", vbOKOnly + 48, "提示"
Option ExplicitConst ip As String = " " '20个空格Const port As String = " " '五个空格Const password As String = " " '六个空格Private Sub Command1_Click()If Len(Trim(ip)) = 0 Then MsgBox "未配置正确", vbOKOnly + 16, "提示" Exit SubEnd IfMsgBox "ip" & Trim(ip)MsgBox "port" & Trim(port)MsgBox "password" & Trim(password)End Sub