Blog

9 Mar 2017

Uphuhliso lweZofthiwe: Yintoni iHolo?

Uphuhliso lweZofthiwe: Yintoni iHolo?

Sifanele Siyazi Ngeentlobo ezimbalwa zeHolo.

Yintoni iHook?Kuphuhliso lwesofthiwe, ukucoca ngumbono ovumela ukutshintsha ukuziphatha kwenkqubo. Ikhowudi yenokuthi ikunika ukuba utshintshe ukuziphatha kokuqala kwento ngaphandle kokutshintsha ikhowudi yakho yokuthelekisa iklasi. Oku kugqityiwe ngokugqithisa amaqhinga okuloba.

Olu hlobo lusetyenziso luncedo kakhulu ngenxa yokongeza imisebenzi emitsha kwizicelo, ukongezelela ukukhuthaza unxibelelwano phakathi kwezinye iinkqubo kunye nemilayezo yenkqubo. Iifoloko zithatha ukunciphisa inkqubo yokunyusa ngokunyusa umthwalo olungiselelwe ukuba inkqubo ifune ukuyenza ngomyalezo ngamnye. Kufuneka kuqaliswe ngokufanelekileyo xa kufunwa kwaye kuphunyezwe kwithuba lokuqala.

Cinga ukuba usebenzisa iNkqubo yoLawulo lwabaThengi (CMS) ukusuka kumntu ongaphandle kwaye unokufuna ukuba ulawulo oluphezulu luqaphele nge-imeyile ngalunye ixesha elinye iposi lihanjisiwe kwaye ukuba le ndlela ayiyiyo imiselweyo yesixhobo. Kuza kubakho iindlela ezihamba phambili:

Ukutshintsha ikhowudi yomthombo weCMS akuyiyo ingcamango ehlakaniphile, emva kokuhlaziya okulandelayo kwesixhobo uza kuhlangabezana nobunzima bokulahlekelwa utshintsho lwakho okanye ungabi namandla okuqhubeka yonke into ehlaziyiweyo;

  • Yenza i-CMS yakho enye ingcamango engathandekiyo, zonke izinto ezicatshangelwayo, awunayo amandla okwaneleyo okanye ixabiso elaneleyo ukwenza izinto ezintsha okanye ukugcina oko uyenzayo;
  • Hlola amathuba okusebenzisa i-hook, oko kukuthi, khangela ukuba i-CMS ibheka kwiimodyuli zangaphandle okanye iimodyuli zezinto ezinikwe igama eliza kuqhutywa ngcaciso emfutshane, ngenxa yale meko, ukusasazwa kwezithuba ezintsha.
  • Ukuhla ehlabathini inxalenye yokusebenzisa iigwegwe ziguqukayo ngokubanzi ukusuka kwisixhobo ukuya kwisixhobo. Isimiselo esifanelekileyo seengwegwe asiyikutshintsha ikhowudi yokuqala. Kuzo zonke iincwadi zokusebenza eziphambili zazo zonke izixhobo ezisemgangathweni ezivulekileyo ezihlaziya i-mantra ezizihlaziyayo zitshintshi iziko. Nangona ukwenza ukuhlaziywa kungenakucingeka, nawuphi na ozayo kamva ukuba ahlale esilondoloze akayi kucinga ngenguqu, kwaye umntu ongenakukuxubusha ngolu hlobo nguwe, kungekhona okokusebenza.

Ukongezwa ngenye indlela ekhethiweyo yokusebenzisa amaqhinga okuloba avumele ukuba isicelo senze i-interfaces zayo zizinzile. Izicwangciso ze-Hook zidibanisa ukungqinelana okuzinzile kunye nokuziphatha kwendawo ehlukileyo ekwazi ukuvela kwisiseko sokufakwa kwesicelo esithile.

IziCwangciso zeNkcazo zeNnovative unikezwa ngeComputer Training Training kuGurgaon, Delhi NCR eIndiya.

Iifolothi njengeModeli yoyilo

Kuyathakazelisa ukuphawula ukuba ezininzi (zonke) ezicwangcisiweyo zenzelwe ukubonisa iimpawu zee-hook. Bathetha nendlela yokuqhuba iisistim eenkalo zeengxaki. Abanye baxhomekeke kumgaqo wokuphuhliswa kwamashishini: Abstract, Factory, Builder, Command, Interpreter, Observer, Prototype, State kunye neSicwangciso.

Enye kwimimiselo yomabini kunye nokuphuhliswa kwesahlulo: I-Template Method and Bridge.

I-Semantics ikwaziswa ngokuqhelekileyo kwigama le-hook (umzekelo, kwi-Command, icebo libizwa ngokuthi lenze ()).

Indlela efanelekileyo yokuHlola

Uphuhliso lweZofthiwe - Yintoni i-Hook - Point I-1Viyo zobuchule ziziswa ngendlela engabonakaliyo ukusuka kwizicwangciso ezicwangcisiweyo, kodwa ekubeni iindlela ezibonakalayo zingatshintshwa, i-compiler ayikwazi idilesi yesimo esithile esicacileyo xa usibiza ngekhowudi yakho. I-compiler, ngoko, idibanisa i-Virtual Method Table (VMT), enika indlela yophando ukuze ikwazi ukufumana iadesi ngexesha lokusebenza. Isicwangciso ngasinye sesicatshulwa sisasebenza ngexesha lokusebenza ngeVMT. I-VMT yombuzo iqulethe zonke izicwangciso ezibonakalayo zabaphambili, kwaye ngaphezu koko ezo zivakalisa. Ngako oko, izisombululo ezibonakalayo zisebenzisa imemori engaphezulu kunezicwangciso zezinto, nangona bahamba ngokukhawuleza.

Ekubeni iVMT yithebhile equlethe izikhombisi kunye neederesi zeememori zekhono loxhumo, kufuneka kwenziwe ntoni ukuhambisa idilesi yokuqala yeemori kunye nedilesi yomsebenzi wokuloba ngokusemthethweni. Kule miqolo, inkqubo ebizwa ngokuba iya kubhalwa, kwaye ukuziphatha okutsha komkhono kuya kwenziwa.

I-API yokuHlola

Uphuhliso lweZofthiwe - Yintoni i-Hook - I-2 Inkqubo yokuHlola i-API ikuvumela ukuba uvuselele kwakhona iinkqubo zenkqubo yokusebenza. Ngokukwazi ukubamba iintlawulo ezinjalo, ungatshintsha iiparitha zabo ngokutshintsha umsebenzi oza kwenziwa ekuqaleni.

Kucingelwa, umzekelo, ukucima ukhenxiswa kwerekhodi ethile, gcina isicelo ekusebenzeni, kwaye ufune ukuqinisekiswa komthengi ukuba ungalondolozi indawo yokugcinwa kwirekhodi, kunye nendawo.

Enyanisweni, isigqibo esinqununu sesigqibo sisendaweni yokhuseleko, umzekelo, unqulo wesi arab kunye ne-antispyware. Yiba nokuba kunjalo, kukho iimeko ekuqhutyweni kwethu ngokuqhelekileyo apho iPooking API, ingaba yindlela ephuma phambili.

I-interface yolwazi Ukujongana, kwiimeko zethu ezithile, kuthetha ukufumana i-API kwi-OS, okanye nakuphi na i-DLL, kwaye utshintshe ukuqhutyelwa kwayo ngokuqhelekileyo kwenye indawo, ngokukodwa, nakwezinye izakhono. Kukho iindlela ezimbini ezibalulekileyo:

I-EAT kunye ne-IAT: yonke i-EXE / i-DLL iqukethe i-API ukungenisa nokuhlawula amatafula. Ezi thebhile ziqulethe izikhombisi ezibonisa indawo ye-API yokungena. Ngokutshintsha ezi zikhombisi-ndlela, zibenza zibonise ukubuyela kwethu, sinokholo. Yiba nokuba kunjalo, ukuba le EXE / DLL ayifaki ukungenisa ii-API, esi sicwangciso asiyi kusebenza;

Ikhowudi yokuLawulwa koLwazi oluPhezulu: Njengoko kwangaphambili, xa kwenzeka ukuba kufakwe umnxeba kwi-callback yethu ekuqaleni kwekhodi ye-API, sinokuthi "sincede", senze ukuba amandla ethu asebenze nantoni na i-API ibizwa ngayo. Yiyo yonke into, kukho umba: ukuba emva kokuba ikhowudi yethu iphathwe ngayo, kwakudingeka sibize i-API yokuqala, siza kuphinda sibuyele kwi-callback yethu, kwaye kuza kuvela umkhukula. Elinye ilungiselelo lilungisa i-hook ukuze ibe nekhono lokubiza i-API, ukuyizama kwakhona emva kokuba yenziwe. Yiba nokuba kunjalo, phakathi kweli lizwe, kusetyenziswe iifowuni ezimbalwa ze-API kwaye aziyi kuqhuba i-callback;

I-Holine Hook yinqanaba apho sifumana khona izikhokelo eziphambili zesikhundla, kwaye sithengisa i-Jump, Push okanye ifowuni yethu yamandla.

Ukufundwa okufundwayo: Inkqubo yokusebenza yeWindows yongezelela kwakhona i-API yokupaka. Sifanele sazi indlela iWindows API yokusebenza ngayo?

Ngexesha lokuHlola

Uphuhliso lweZofthiwe - Yintoni i-Hook - I-3A i-hook yeendlela zokukhangela ukudibanisa ukungena kunye nokuziphatha kweendawo ezahlukeneyo ezinokuvela kwi-instantiation yesicelo sesimo esithile senzeke ukuguqulwa kolawulo. Izixhobo zeso sihlandlo zilungisa ukulungisa amanyathelo. Ekupheleni kosuku, xa kwenzeka isiganeko, umphathi uyaphendula amacebo okuloba kwizinto ezibhalwe ngaphambili ezenza umsebenzi othile ukulungiselela imisebenzi. Iziganeko zeziganeko: imiyalezo yefestile, ukuxhamla kwiindawo zokungena.

Ngaphakathi kweIAT Hooking

Uphuhliso lweZofthiwe - Yintoni i-Hook - Point 4Inye inkqubo kwi-Windows inetafile ebizwa ngokuba yiTheyibrari yokuLungisa iNdawo (IAT), egcina izalathisi kwiinkcukacha ezithunyelwe yi-DLL nganye kwinkqubo nganye. Le tafile iqhutywe ngokuqhubekayo kunye nedilesi yezinto zeDLL ngexesha lokusebenza.

Ukusebenzisa amandla athile, sinokwenza itafile ze-IAT zibhalwe, zicingeke ukuba zitshintshe idilesi yayo ngedilesi yesikhundla somkhuba, ukuchaza kwakhona itafile njengoko kufundwa-emva kolu tshintsho. Kwinqanaba xa inkqubo izama ukubiza umnxeba, idilesi yayo ifumaneke kwitafile ze-IAT, kwaye i-pointer ibuyiselwa. Njengoko itheyibhile ye-IAT ishintshiwe, umthamo wesintu uziswa ngokusekwa kwekhono lokuqala kunye nekhowudi engeniswe kwenkqubo.

Netfilter Hook

Uphuhliso lweZofthiwe - Yintoni i-Hook - I-5Netfilter yinkqutyana ye-Linux eyona nto ibonakala ngaphezu kwe-2.4. Kuphethe uxanduva lokuhlukana, i-NAT, i-firewall, i-redirection, phakathi kwabanye. I-Netfilter ilula kakhulu, kwaye amaxwebhu ayo aphelile. Ushiya amathuba okusebenzisa ii-Hook kwi-Kernel code, okwenza ukusetyenziswa kwayo kuguquguquke kwaye ngokubanzi kufunyenwe yiqela. Ezi ziHokhi ziphuma kwiziphumo ezimbalwa ezibonakalayo kwaye zizakuzalisa njengeziphumo zexesha elithile.

Isiphelo:

Uphuhliso lweZofthiwe - Yintoni iHook - conclusionUkucwangcisa inkqubo yokucwangcisa kusebenza kwaye kuvula iziphumo zeengcali zeenjineli, kodwa ke kufuneka zisetyenziswe ngokuqaphela kuba zibandakanya i-intricacy ephawulekayo kwimigudu yeenkqubo kunye nokutshintsha okokuqala ukuziphatha kwe-OS, izicelo okanye ezinye izicwangciso zeekhompyutheni, okwenza kube nzima ukuqonda ingcamango yesofthiwe. Ngaphandle koko, njengoko kukhankanywe ngaphambili kweli nqaku, ukusetyenziswa kwezi nkqubo ngaphandle kweparadigm kunganqumla ukuphunyezwa kwezicelo.

&bsp

GTranslate Your license is inactive or expired, please subscribe again!