Tuesday, March 6, 2012

Membuat Fix File dengan Visual Basic


WM/VB.BG (terdeteksi oleh Antivir)
Trojan Backdoor Generic6.GMX (terdeteksi oleh AVG)
Backdoor.Delf (terdeteksi oleh Norton Anti Virus)
TR/Drop.Loops.A.1 (terdeteksi oleh Antivir)
w32/delf.cd worm (terdeteksi oleh Avira)
Inti dari perbaikan file ini ada 3 yaitu:
- Mendeteksi Ukuran File
- Memotong badan file yang berisi virus
- Menyimpan file yang telah jadi
seperti penjelasan di artikel sebelumnya, ukuran virus yang menempel di badan file sehat itu adalah 331299 byte, untuk itu kita akan melakukan pendeletan virus yang menyisip di file tersebut, caranya … buka visual basic, atau alat andalan utnuk membuat tools
MENDETEKSI UKURAN FIE
untuk dapat menjalankan fungsi pendeteksian file, cukup ketik fungsi BytesInBytes di bawah ini…
Function BytesInBytes(bIn() As Byte, bFind() As Byte, startPosn As Long) As Long
Dim I, iFinal, iLimit, xLimit, uIn, uFind As Long ’2GB limit
Dim X As Integer
uFind = UBound(bFind)
iLimit = UBound(bIn) – uFind + 1
xLimit = uFind – 1
uIn = UBound(bIn)
For I = startPosn To iLimit
For X = 0 To xLimit
If I + X <= uIn Then
If bIn(I + X) <> bFind(X + 1) Then Exit For
If X + 1 = uFind Then
iFinal = BytesInBytes(bIn, bFind, I + 1)
If iFinal > I Then I = iFinal
BytesInBytes = I
Exit Function
End If
End If
Next X
Next I
BytesInBytes = -1
End Function
MEMOTONG BAGIAN VIRUS YANG MENEMPEL DI FILE
Untuk dapat memotong virus tersebut, cukup ketikkan kode di bawah ini:
Private Sub CutPaste(OP As Boolean, PasteBytes() As Byte)
‘TRUE=Cut..FALSE=Paste
SL = 331299 ’662598 ’331299
If SFP >= 0 Or SL > 0 Then
Dim nBytes As Long
Dim I As Long
If OP = False Then ‘Paste
nBytes = UBound(PasteBytes)
ReDim Preserve WorkSpace(1 To FL + nBytes)
‘ Move the bytes DOWN in the Array–Dest,Src,Bytes to move
If FL – SFP > 0 Then Call CopyMemory(ByVal VarPtr(WorkSpace(nBytes + SFP + 1)), ByVal VarPtr(WorkSpace(SFP + 1)), FL – SFP)
‘ Copy the selected data to the Array–Dest,Src,Bytes to move
Call CopyMemory(ByVal VarPtr(WorkSpace(SFP + 1)), PasteBytes(1), nBytes)
FL = FL + nBytes
Else ‘Cut
If FL – SL > 0 Then
‘ Move the Data UP in the Array–Dest,Src,Bytes to move
If FL – (SL + SFP) > 0 Then Call CopyMemory(ByVal VarPtr(WorkSpace(SFP + 1)), ByVal VarPtr(WorkSpace(SL + SFP + 1)), FL – (SL + SFP))
FL = FL – SL
ReDim Preserve WorkSpace(1 To FL)
Else
ReDim WorkSpace(1 To 1)
FL = 1
End If
End If
If FF > FL Then FF = FL
If FF < 0 Then FF = 0
‘ShowFileInfo
End If
End Sub
guna skrip di atas tadi adalah untuk memotong bagian yang berukuran 331299 byte atau ukuran virus itu sendiri … lalu setelah dipotong, bagaimana cara menyimpannya?
MENYIMPAN FILE YANG TELAH DIBERSIHKAN
Cukup ketikkan kode di bawah ini:
Private Sub goSave()
On Error GoTo CLSerr
Dim Fnum As Integer
Dim Fname As String
Dim saveok As Boolean
If optxls.Value = True Then
‘MsgBox Left(CommonDialog1.FileName, Len(CommonDialog1.FileName) – 3)
Fname = Left(CommonDialog1.FileName, Len(CommonDialog1.FileName) – 4) & “_fix” & “.xls”
‘MsgBox Right(Fname, 4), 0, “dsasd”
End If
If optdoc.Value = True Then
Fname = Left(CommonDialog1.FileName, Len(CommonDialog1.FileName) – 4) & “_fix” & “.doc”
‘MsgBox Right(Fname, 3), 0, “dsasd”
End If
If FSO.FileExists(Fname) Then FSO.DeleteFile (Fname)
Fnum = FreeFile
Open Fname For Binary Access Write As Fnum
Put Fnum, , WorkSpace()
Close Fnum
OpenFileName = Fname
FL = FSO.GetFile(OpenFileName).Size
Exit Sub
CLSerr:
If Err <> 32755 Then MsgBox (Error & vbCr & vbCr & “Error Number: ” & Str(Err)), vbCritical, “! ERROR !”
End Sub
File yang dibersihkan akan disimpan sesuai nama file dan extensinya, tapi nama file-nya ditambahi judul “_fix” gitu untuk membedakan file yang sakit dan yang sehat…
nah mudah bukan??? 

Semoga bermanfaat..!!!
Selamat mencoba,,,

No comments:

Post a Comment