This Is My First Blog
Fisrt You Need to Know Things That Are Necessary To Make Antivirus
1.We Must To Know A Checksum Value File(With crc32)
2.Then We Enter the value to the database checksums
3.Then We Scan The File
Now I Will Show to All Of You How To Make A Simple Antivirus With Visual Basic 6.0
First Make 1 Form,3 Command Button,2 Label,2 TextBox,1 Commond Dialog
Like This Here!!
Then
Write This Code To The Form
Dim iJumlahDB As Long
Private Sub cmdCekVirus_Click()
Dim iCount As Long
Dim szCrcFile As String
szCrcFile = GetCrc32File(Text1.Text)
For iCount = 1 To iJumlahDB
If szCrcFile = szCeksumVirus(iCount - 1) Then
Text2.Text = szNamaVirus(iCount - 1) & " : menurut database"
Exit Sub
End If
Next iCount
Text2.Text = "Bukan virus menurut database"
End Sub
Private Sub Command1_Click()
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Text1.Text = CommonDialog1.FileName
End If
End Sub
Private Sub Command2_Click()
Text2.Text = GetCrc32File(Text1.Text)
End Sub
Private Sub Form_Load()
iJumlahDB = LoadDatabase("database.db")
End Sub
Write This Code To The Module
Private Declare Function RtlComputeCrc32 Lib "ntdll.dll" (ByVal dwInitialize As Long, ByVal pBufferData As Long, ByVal pBufferDataLen As Long) As Long
Public szCeksumVirus() As String
Public szNamaVirus() As String
Public Function GetCrc32File(ByVal szFileTarget As String) As String
Dim bDataFile() As Byte
Dim iUkuranFile As Long
Open szFileTarget For Binary As #1
iUkuranFile = LOF(1)
ReDim bDataFile(iUkuranFile - 1) As Byte
Get #1, , bDataFile()
Close #1
GetCrc32File = Hex$(RtlComputeCrc32(0, VarPtr(bDataFile(0)), iUkuranFile))
End Function
Public Function LoadDatabase(ByVal szDatabaseFilePath As String) As Long
Dim szLoadRow() As String
Dim szTmpData() As String
Dim szIsiFile As String
Dim iCount As Long
Open szDatabaseFilePath For Binary As #1
szIsiFile = Space(LOF(1))
Get #1, , szIsiFile
Close #1
szLoadRow = Split(szIsiFile, vbNewLine, -1, vbTextCompare)
ReDim szCeksumVirus(UBound(szLoadRow())) As String
ReDim szNamaVirus(UBound(szLoadRow())) As String
For iCount = 0 To UBound(szLoadRow())
szTmpData = Split(szLoadRow(iCount), "=", -1, vbTextCompare)
If UBound(szTmpData()) > 0 Then
szCeksumVirus(iCount) = szTmpData(0)
szNamaVirus(iCount) = szTmpData(1)
LoadDatabase = LoadDatabase + 1
End If
Next iCount
End Function
https://www.facebook.com/numan.coolen
And I Will Give You A Simple Antivirus To Learn

No comments:
Post a Comment