Blog

9 Mar 2017

Software Development: Chii Chinonzi Hook?

/
Posted By

Software Development: Chii Chinonzi Hook?

Tinofanira Kuziva Pamusoro Pezvinhu Zvishomanana zveHook.

Chii chiri Hook?Mukufambisa software, Hooking isiri pfungwa inobvumira kuchinja mufambiro wepurogiramu. Nhamba yekodzero inokupa iwe kuti uchinje mufambiro wekutanga wechinhu chisina kuchinja code yako yekuenzanisa kirasi. Izvi zvakapedzisira kugadziriswa maitiro ekukohwa.

Uku kushandiswa kwakanyanya kunobatsira nekuda kwekuwedzera zvishandiso zvitsva zvekushanda, nekuwedzera kukurudzira mabhairirano pakati penzira dzakasiyana nemashoko ehurongwa. Hooks inowanzoita kuderedza kushandiswa kwekutengesa kuburikidza nekuwedzera kwegadziriro yekugadzirira iyo hurongwa hunofanirwa kuita kune umwe neumwe mharidzo. Inofanirwa kujekeswa apo painodiwa uye inobviswa pane imwe nguva yekutanga.

Funga kuti iwe uri kushandisa Customer Management System (CMS) kubva kune mumwe kunze uye iwe ungada kuti mukuru wepamusoro anyevererwe neimeri nguva imwe neimwe imwe nzvimbo yakagoverwa uye kuti mufambiro uyu hausi wekutadza kwechigadzirwa. Panova nemigwagwa miviri mberi:

Shanduro yeCMS code source haisi fungiro yakajeka, mushure mezvose mukuvandudza kunotevera kwechigadziro iwe uchasangana nekutambudzika kwekurasikirwa shanduko yako kana kuti usine simba rekupfuurira zvinhu zvose zvinovandudzwa;

  • Ita yako CMS chaiye imwe pfungwa yakaipa, zvinhu zvose zvinofungidzirwa, iwe hauna simba rakakwana kana zvinhu zvakakwana kuti uite zvinhu zvitsva kana kunyange kuchengetedza zvaunofanira kuita;
  • Tsvaga mukana wekushandisa hokore, kureva, chengetedza kana CMS inotarisa kunze kwema modules kana ma modules zvezvinhu zvezita rinopihwa rinofanira kuitwa pamaminitsi aida, nekuda kweizvi, kugoverwa kwemashure matsva.
  • Izvo pasi pano chikamu chekushandisa zvikorekedzo zvinowanzochinja kubva pachigadzirwa kusvika kune chiridzwa. Nheyo inonyanya kukosha yezvikoti haisi kuchinja yekutanga code. Mune manyorero makuru emitambo yezvinhu zvose zvakasununguka zvigadziri izvo zvinongodzokorora mantra iyo inodzosera pachayo haina kuchinja pakati. Asi zvisinei nekuvandudza zvisingafungidziki, chero munhu anouya mushure mekugadzira haazofungi nezvekushanduka, uye munhu anenge asingatauri nezvazvo iwe, kwete iyo midziyo.

Izvo zvakakosha ndeimwe nzira yakasarudzwa yekushandisa nzira dzekugadzira dzinobvumira kushandiswa kuwedzera kushanda kwayo kwakasimba. Nzira dzekutengesa dzinodonha hukama hwakagadzikana uye mufambiro wenzvimbo dzakasiyana-siyana dzinogona kubuda kubva pakugadzirisa kwechikumbiro chekugadzirisa kumwe.

Innovative Technology Solutions inopa Software Software Development Training muGurgaon, Delhi NCR muIndia.

Hooks Sekugadzira Maitiro

Zvinonakidza kuziva kuti akawanda (ose) marondedzero ekugadzirwa anoratidza semantics ye hooks. Vanotaura nekuti vangaita sei maitiro ematambudziko. Vamwe vanovimba nekutonga kwekushanda kwemasasa: Abstract, Factory, Build, Command, Interpreter, Observer, Prototype, State, uye Strategic.

Mimwe mienzaniso miviri yekubatana uye kugoverana kwezvikamu: Template Method uye Bridge.

Semantics inowanzonzikaniswa muzita rekugadzira mbatya (somuenzaniso, mumurairo, sarudzo inonzi iite ()).

 

Virtual Method Table Hooking

Software Development - Chii chinonzi Hook - Chiratidzo 1Vhidhiyo maitiro anounzwa nenzira isinganzwisisiki kubva kumagadzirirwo akaoma, asi sezvo maitiro chaiwo anogona kuchinjwa, munyori wacho haazive kero yehuwandu hwemhando yakakwana kana iwe uchiitumidza mukhodi yako. Iyo nyanzvi, saka, inounganidza Virtual Method Table (VMT), iyo inopa nzira yekubvunza kuti kugadzirisa maatisi munguva yekumhanya. Zvose zvinowanzoita sarudzo inoshandiswa panguva yekumhanya kuburikidza neVMT. IVMT yemubvunzo ine mitambo yose yakakwana yezvirevo zvayo, uyezve iyo inoparidza. Nokudaro, maitiro chaiwo anoshandisa chiyeuchidzo chepamusoro pane matanho ezvinhu, pasinei nekuti ivo vanomhanya zvakasimba.

Sezvo VMT iri tafura ine zvinyorwa uye nhepfenyuro yekuyeuka kwehutauriri hwehutano, chii chinofanira kuitwa ndechokubvisa kero yekutanga yekuyeuka nekero rebasa rakagadziriswa. Pakati pemitsara iyi, iyo inonzi yakagadzirwa ichagadziriswa, uye hutsika hutsva hwekuda huchaitwa.

 

Hooking API

Software Development - Chii chiri Hook - Chiratidzo 2Iyo nzira yeHooking API inokubvumira kuti udzose zvakare zvinhu zvebasa rekushanda. Nokukwanisa kutora mhaka dzakadaro, unogona kuchinja mararamiro avo nekuchinja basa raizoitwa pakutanga.

Iko kunofungidzirwa, somuenzaniso, kubvisa kubviswa kwerekodhi chaiyo, chengeta chikumbiro kubva pakushanda, uye utsvake kutsigirwa kwevatengi kuti vasachengetedze nhoroondo yekuendesa kune denderedzwa, uye nezvera.

Zvechokwadi, iyo yakanyanya kugadziriswa kwechisarudzo iri munharaunda yekuchengeteka, somuenzaniso, antivirus uye antispyware. Izvo zvingaita, pane mamiriro ezvinhu muhupenyu hwedu huripo apo Hooking API, inogona kunge iri nzira huru yekubuda nayo.

Programming interface Kusangana, mumamiriro edu ezvinhu, zvinoreva kuwana API kubva kune OS, kana kubva kune chero DLL, uye kuchinja kuparidzirwa kwayo kune imwe nzvimbo, kunyanya, kune rimwe simba. Pane zvinyorwa zviviri zvinoenderana:

EAT neIAT: yose EXE / DLL ine API kuisa uye kutengesa matafura. Iyi mahwendefa ane zvinyorwa zvinoratidza API Entry Point. Nokugadzirisa zvinyorwa izvi, zvichiita kuti zviratidze kudanwa kwedu, tine hook. Iva sezvazvinogona, kana iyi EXE / DLL isingatumi ma API, urongwa uhwu hahuzoshandi;

Kururamisa Purogiramu Yokudzvora: Sezvakaitika kare, pazvingaita kuti kuwedzerwa kudanwa kudivi redu rekuenda kunotanga purogiramu ye API, tinokwanisa "kuitora", tichiita kuti tikwanise kumhanya chero ipi zvayo API yaidanwa. Izvo zvingaita, pane dambudziko: kana mushure memutsetse wedu wakagadziriswa, taida kudana iyo API yekutanga, tinenge tadzokera kumashure rekudzoka kwedu, uye mafashamo emvura aizogadzirwa. Chimwe chigadziro chinogadzirisa hove kuti ive nekwanisi yekudana API, kuidzoka zvakare kana ichiitwa. Iva sezvazvinogona, pakati pemamiriro ezvinhu epakati, nzvimbo shomanana dze API dzingagadzirwa uye hadzingashandisi kudzokorora kwedu;

Inline Hook ndiyo pfungwa yatinowana nayo mazano makuru ehutano, uye tinoshambadzira Jump, Push kana Call kuti tive nesimba.

Inyorenga kuverenga: Windows working system inowedzera pasi pasi hooking API. Tinofanira kuziva kuti Windows API inobata sei mabasa?

 

Nguva yekuvhima

Software Development - Chii chinonzi Hook - Chigadziko 3A chekugadzira mbambo dzinoita kuti zvinyatsogadziriswa zvisimbiso uye mufambiro weimwe nzvimbo yakasiyana inogona kubuda kubva pakugadzirisa kwekushandiswa kwekugadzirisa zvimwe zvinhu kunoitika kuchinja kwekutonga. Zvimwe zviitiko handlers zvinogadzirisa kugadzirira matanho. Pakupera kwezuva, kana chiitiko chikaitika, mubati anopindura anongedza mazano ekukoresa pane zvinhu zvakanyorwa zvisati zvaitika zvinoshandisa nguva chaiyo kugadzirira mabasa. Mhosva dzezviitiko: mawindo emawindo, mabhomba achiuya kubva kumakorani emakungwa.

 

Mukati IAT Hooking

Software Development - Chii chiri Hook - Chiratidzo 4Zvino nzira ye Windows ine tafura inonzi Import Address Table (IAT), iyo inochengetedza zvinyorwa kuhutano hwakatumirwa neDLLs pane imwe nzira. Iyi tafura inowanikwa zvishoma nezvishoma nekero rezvinhu zveDLL panguva yekumhanya.

Tichishandisa simba rakakwana, tinogona kuita tafura yeIAT kunyorwa, tichifungidzirwa kushandura kero yayo nekero yenzira yekudzidzira, kutorazve tafura sekuverengwa-kungotevera mushanduko uyu. Panguva iyo iyo nzira inoedza kudana simba, kero yaro inowanikwa mutafura yeIAT, uye pointer inodzorerwa. Sezvo tafura yeIAT yashandurwa, tsika yekodzero inounzwa yakagadziridzwa yekutanga kukwanisa uye kero yakakonzerwa muitiro yacho yakawanikwa.

 

Netfilter Hook

Software Development - Chii chinonzi Hook - Chiratidzo 5Netfilter inonzi Linux piece subsystem inokosha kupfuura 2.4. Icho chiri kutarisira bundle kuparadzanisa, NAT, firewall, redirection, pakati pevamwe. Netfilter yakanyanyogadziriswa, uye zvinyorwa zvayo zvapera. Inosiya mukana wekushandisa Hooks muKernel code, zvichiita kuti kushandiswa kwayo kushanduke zvakanyanya uye kazhinji kugamuchirwa neboka. Aya Hooks anosiya zvishoma zvingagadziriswa uye anogona kuzadza sechichikonzera nguva dzakasiyana.

 

mhedziso:

Software Development - Chii chinonzi Hook - kugumisaIkugadzira mapurogiramu epurogiramu inoshanda uye inozarura kuwanda kwemigumisiro inofungidzirwa yezvinowanzogadzira software, zvisinei iyo inofanira kushandiswa nekuchenjerera sezvo ichibatanidza chinonyanya kukoshesa mukugadzirisa kwehutano uye kuchinja yekutanga mufambiro we OS, maitiro kana zvimwe zvikamu zvepurogiramu, zvichiita kuti zvive nyore kunzwisisa chinangwa che software. Zvimwe kunze kweiyo, sezvakataurwa kare munyaya ino, kushandiswa kwezvinhu izvi pasina paradigm kunogona kuderedza kushandiswa kwemabasa.

Leave a Reply

 
GTranslate Please upgrade your plan for SSL support!
GTranslate Your license is inactive or expired, please subscribe again!