DYNAMICS of MALWARE SPREADING, DETECTION AND REMOVAL OF DECENTRALIZED SECURED PEER TO PEER NETWORKS A PROJECT REPORT Submitted by M.MONIKA 51108104049 G.REVATY 511081041!4 J.SOPNA 5110810409"
DYNAMICS of MALWARE SPREADING, DETECTION AND REMOVAL OF DECENTRALIZED SECURED PEER TO PEER NETWORKS A PROJECT REPORT Submitted by M.MONIKA 51108104049 G.REVATY 511081041!4 J.SOPNA 5110810409"
DYNAMICS of MALWARE SPREADING, DETECTION AND REMOVAL OF DECENTRALIZED SECURED PEER TO PEER NETWORKS A PROJECT REPORT Submitted by M.MONIKA 51108104049 G.REVATY 511081041!4 J.SOPNA 5110810409"
SECURED PEER TO PEER NETWORKS A PROJECT REPORT Submitted by M.MONIKA 51108104049 G.REVATY 511081040!4 J.SOPNA 5110810409" In partial fulfillment for the award of the degree of #ACELOR OF ENGINEERING IN COPUTER SCIENCE AND ENGINEERING RANIPPETTAI ENGINEERING COLLEGE TENKADAPPANTANGAL
ANNA UNIVERSITY $ CENNAI %00 0"5 APRIL "01" DYNAMICS OF MALWARE SPREADING, DETECTION AND REMOVAL OF DECENTRALIZED SECURED PEER TO PEER NETWORKS A PROJECT REPORT Submitted by M.MONIKA 51108104049 G.REVATY 511081040!4 J.SOPNA 5110810409" In partial fulfillment for the award of the degree of #ACELOR OF ENGINEERING IN COMPUTER SCIENCE AND ENGINEERING RANIPPETTAI ENGINEERING COLLEGE TENKADAPPANTANGAL ANNA UNIVERSITY$ CENNAI %00 0"5 APRIL "01" ANNA UNVIERSITY $ CENNAI %00 0"5 #ONAFIDE CERTIFICATE Certified that this project report DYNAMICS OF MALWARE SPREADING,DETECTION AND REMOVAL OF DECENTRALIZED SECURED PEER TO PEER NETWORKS& is the bonafide or! of 'M.MONIKA, G.REVAT,AND J.SOPNA & ho carried o"t the project or! "nder #$ s"per%ision& SIGNATURE SIGNATURE Mr.S.#ALAJI,M.E., M(.M.MEKALA, M.T)*+., EAD OF TE DEPARTMENT, SUPERVISOR, LECTURER, DEPARTMENT O' CSE( DEPARTMENT O' CSE( Ranippettai En)ineerin) Co**e)e( Ranippettai En)ineerin) Co**e)e( Then!adappanthan)a*( Then!adappanthan)a*( +a*aja Ta*"!( +a*aja Ta*"!( ,e**ore - ./012/& ,e**ore - ./012/&
Submitted for the viva-voce examination held on at Ranipettai Engineering college. INTERNAL E,AMINER E,TERNAL E,AMINER ACKNOWLEDGEMENT +e ish to e3press o"r heartfe*t ob*i)ation to K-./0 K-/-.-1&, S+10.#.#2(), o"r fo"nder( Chair#an for the faci*ities pro%ided for to "s d"rin) the co"rse& +e are %er$ #"ch indebted to o"r be*o%ed Principa* P123.A.A.A10/-.-4-1, M.T)*+., P+D.( for his #ora* s"pport to "nderta!e this or!& +e e3press o"r sincere than!s to S.#ALAJI, M.E., )-5 23 6+) D)7-168)96 23 C287:6)1 S*0)9*) A95 E9409))1094 for pro%idin) "s ith a** the faci*ities and reso"rces re4"ired for the s"ccessf"* co#p*etion of o"r project or!& +e than! o"r Project S"per%isor M&MEKALA,M.T)*+., L)*6:1)1 in Depart#ent of Co#p"ter Science And En)ineerin)( for her %a*"ab*e )"idance in brin)in) "p this or! a s"ccess& &'ina**$ e ish to than! a** o"r teachin) and non5teachin) staff #e#bers of o"r depart#ent ho ha%e direct*$ and indirect*$ he*ped "s in co#p*etin) this project TA#LE OF CONTENTS CAPTER NO TITLE PAGE NO A#STRACT 0 LIST OF FIGURES 00 LIST OF SYM#OLS 000 LIST OF A##REVATIONS 0/
A#STRACT In this paper( e for#"*ate an ana*$tica* #ode* to characteri<e the spread of #a*are in decentra*i<ed( Gn"te**a t$pe peer5to5peer =P0P> netor!s and st"d$ the d$na#ics associated ith the spread of #a*are& Usin) a co#part#enta* #ode*( e deri%e the s$ste# para#eters or netor! conditions "nder hich the P0P netor! #a$ reach a #a*are free e4"i*ibri"#& The #ode* a*so e%a*"ates the effect of contro* strate)ies *i!e node 4"arantine on stif*in) the spread of #a*are& The #ode* is then e3tended to consider the i#pact of P0P netor!s on the #a*are spread in netor!s of s#art ce** phones&The "se of peer5to5peer =P0P> netor!s as a %ehic*e to spread #a*are offers so#e i#portant ad%anta)es o%er or#s that spread b$ scannin) for %"*nerab*e hosts& This is pri#ari*$ d"e to the #ethodo*o)$ e#p*o$ed b$ the peers to search for content& Th"s( rapid pro*iferation of #a*are can pose a serio"s sec"rit$ threat to the f"nctionin) of P0P netor!s& This paper addresses this iss"e and de%e*ops an ana*$tic fra#eor! for #ode*in) the spread of #a*are in P0P netor!s hi*e acco"ntin) for the architect"ra*( topo*o)ica*( and "ser re*ated factors& I
LIST OF FIGURES F04 N2 T06.) P-4) N2 7&2 Architect"re ; 7&0 Use case Dia)ra# ? 7&/ Se4"ence Dia)ra# @ 7&7 Co**aboration Dia)ra# @ 7&1 Acti%it$ Dia)ra# 2A
ii
LIST OF SYM#OLS S.NO SYM#OL NAME SYM#OL DESCRIPTION 2 Actor Actors are the "sers of the s$ste# and other e3terna* entit$ that react ith the s$ste#& 0 Use Case A "se case is a interaction beteen the s$ste# and the e3terna* en%iron#ent& / Re*ation =Uses> It is "sed for additiona* process co##"nication& 7 Co##"nication It is the co##"nication beteen %ario"s "se cases& 1 State It represents the state of a process& Each state )oes thro")h %ario"s f*os& . Initia* State It represents the initia* state of the object& ; 'ina* State iii It represents the fina* state of the object& ? Contro* '*o It represents the %ario"s contro* f*o beteen the states& @ E3terna* Entit$ It represent an$ e3terna* entit$ s"ch as !e$board( sensors etc hich are "sed in the s$ste#& 2A Transition It represent an$ co##"nication that occ"rs beteen the processes& 22 Object 6ife*ine Object *ife*ines represents the %ertica* di#ension that objects co##"nicates& 20 Messa)e It represents the #essa)es e3chan)ed& i% LIST OF A##REVATIONS
IP Internet Protoco* P0P Peer5To5Peer TT6 Ti#e To 6i%e 9,M 9a%a ,irt"a* Machine API App*ication Pro)ra##in) Interface BM6 E3tend Mar!"p 6an)"a)e OS Operatin) S$ste# 9DC 9a%a De%e*op#ent Cit GUIs Graphica* User Interfaces A+T Abstract +indo Too*!it 9'C 9a%a 'o"ndation C*asses 9RE 9a%a R"nti#e En%iron#ent 8TM6 8$per Te3t Mar!"p 6an)"a)e 9DDC 9a%a Data Dase Connecti%it$ ODDC Open Data Dase Connecti%it$ S:6 Str"ct"red :"er$ 6an)"a)e %
CAPTER 1 INTRODUCTION A08$ The #ain sta$ of this project is to a%oid the spreadin) of #a*are in decentra*i<ed #ode b$ "sin) the concept of f*oodin) to perfor# a sec"red peer to peer netor!s . S>927(0($ The "se of peer5to5peer =P0P> netor!s as a %ehic*e to spread #a*are offers so#e i#portant ad%anta)es o%er or#s that spread b$ scannin) for %"*nerab*e hosts& 'or instance( in decentra*i<ed P0P architect"res s"ch as Gn"te**a here search is done b$ f*oodin) the netor!( a peer forards the 4"er$ to its i##ediate nei)hbors and the process is repeated "nti* a specified thresho*d ti#e5to5*i%e( TT6( is reached& 8ere TT6 is the thresho*d representin) the n"#ber of o%er*a$ *in!s that a search 4"er$ tra%e*s& 8a%in) infected a host in the netor!( the or# c*oa!s itse*f for other Gn"te**a "sers& E%er$ ti#e a Gn"te**a "ser searches for #edia fi*es in the infected co#p"ter( the %ir"s a*a$s appears as an anser to the re4"est( *eadin) the "ser to be*ie%e that it is the fi*e the "ser searched for& The desi)n of the search techni4"e has the fo**oin) i#p*icationsE first( the or#s can spread #"ch faster( since the$ do not ha%e to probe for s"sceptib*e hosts and second( the rate of fai*ed connections is *ess& Th"s( rapid pro*iferation of #a*are can pose a serio"s sec"rit$ threat to the f"nctionin) of P0P netor!s& This paper addresses this iss"e and de%e*ops an ana*$tic fra#eor! for #ode*in) the spread of #a*are in P0P netor!s hi*e acco"ntin) for the architect"ra*( topo*o)ica*( and "ser re*ated factors& 2 CAPTER " ".1 L06)1-6:1) S:1/)>E ".1.1 A R)7:6-6029 #-()5 A7712-*+ 321 C+22(094 R).0-?.) R)(2:1*)( 09 P))1 62 P))1 N)6@21A( Peer5to5peer =P0P> app*ications ha%e seen an enor#o"s s"ccess( and recent*$ introd"ced P0P ser%ices ha%e reached tens of #i**ions of "sers& A feat"re that si)nificant*$ contrib"tes to the s"ccess of #an$ P0P app*ications is "ser anon$#it$& 8oe%er( anon$#it$ opens the door to possib*e #is"ses and ab"ses( e3p*oitin) the P0P netor! as a a$ to spread ta#pered ith reso"rces( inc*"din) Trojan 8orses( %ir"ses( and spa#& To address this prob*e# e propose a se*f5re)"*atin) s$ste# here the P0P netor! is "sed to i#p*e#ent a rob"st rep"tation #echanis#& Rep"tation sharin) is rea*i<ed thro")h a distrib"ted po**in) a*)orith# b$ hich reso"rce re4"estors can assess the re*iabi*it$ of a reso"rce ordered b$ a participant before initiatin) the don*oad& This a$( spreadin) of #a*icio"s contents i** be red"ced and e%ent"a**$ b*oc!ed& O"r approach can be strai)htforard*$ pi))$ bac!ed on e3istin) P0P protoco*s and re4"ires #odest #odifications to c"rrent i#p*e#entations& ".1." A F01(6 L22A -6 P))1 62 P))1 W218( $ T+1)-6( -95 D)3)9()( AbstractFPeer5to5peer =P0P> or#s e3p*oit co##on %"*nerabi*ities in #e#ber hosts of a P0P netor! and spread topo*o)ica**$ in the P0P netor!( a potentia**$ #ore effecti%e strate)$ than rando# scannin) for *ocatin) %icti#s& 0 This paper describes the dan)er posed b$ P0P or#s and initiates the st"d$ of possib*e #iti)ation #echanis#s& In partic"*ar( the paper e3p*ores the feasibi*it$ of a se*f5defense infrastr"ct"re inside a P0P netor!( o"t*ines the cha**en)es( e%a*"ates ho e** this defense #echanis# contains P0P or#s( and re%ea*s corre*ations beteen contain#ent and the o%er*a$ topo*o)$ of a P0P netor!& ".1.; M25).094 -95 P)13218-9*) A9-.>(0( 23 #06 T211)96 L0A) P))1B62BP))1 N)6@21A( In this paper( e de%e*op si#p*e #ode*s to st"d$ the perfor#ance of Dit Torrent( a second )eneration peer5to5peer =P0P> app*ication& +e first present a si#p*e f*"id #ode* and st"d$ the sca*abi*it$( perfor#ance and efficienc$ of s"ch a fi*e5sharin) #echanis#& +e then consider the b"i*t5in incenti%e #echanis# of Dit Torrent and st"d$ its effect on netor! perfor#ance& +e a*so pro%ide n"#erica* res"*ts based on both si#"*ations and rea* traces obtained fro# the Internet& ".1.4 S)1/0*) C-7-*06> 23 P))1 62 P))1 N)6@21A( In this paper e st"d$ the Gser%ice capacit$H of peer to peer =P0P> fi*e sharin) app*ications& +e be)in b$ considerin) a transient re)i#e hich is !e$ to capt"rin) the abi*it$ of s"ch s$ste#s to hand*e b"rst traffic( e&)&( f*ash crods& In this conte3t o"r #ode*s( based on a)e dependent branchin) processes( e3hibit e3ponentia* )roth in ser%ice capacit$( and per#it the st"d$ of sensiti%it$ of this )roth to s$ste# po*icies and para#eters& Then e consider a #ode* for s"ch s$ste#s in stead$ state and sho ho the a%era)e de*a$ seen b$ peers o"*d sca*e in the offered *oad and rate at hich peers e3it the s$ste#& / In partic"*ar the de*a$s are "pper bo"nded b$ so#e constant )i%en an$ offered *oad and e%en decrease in the offered *oad if peers e3it the s$ste# s*o*$& ".1.5 M25).094 -95 A9-.>C094 P-((0/) W218( 2/)1 U9(61:*6:1)5 P))1B62B P))1 N)6@21A( Passi%e or# ha%e posed serio"s sec"rit$ threats to the f"nctionin) of "nstr"ct"red P0P netor!s& A de*a$ed SEIRS epide#ic #ode* ith death( off*ine and on*ine rate is constr"cted based on the act"a* sit"ation of P0P "sers& The basic reprod"ction n"#ber that )o%erns hether a passi%e or# is e3tinct or not is obtained& The i#pact of different para#eters on this #ode* is st"died ith si#"*ation res"*ts( especia**$ the effect of ti#e de*a$( hich can pro%ide an i#portant )"ide*ine in the contro* of "nstr"ct"red P0P netor!s as e** as passi%e or# defense& "." E,ISTING SYSTEM The transfer of infor#ation in a P0P netor! is initiated ith a search re4"est for it& This paper ass"#es that the search #echanis# e#p*o$ed is f*oodin)( as in Gn"te**a netor!s& In this scenario( a peer searchin) for a fi*e forards a 4"er$ to a** its nei)hbors& A peer recei%in) the 4"er$ first responds affir#ati%e*$ if in possession of the fi*e and then chec!s the TT6 of the 4"er$& If this %a*"e is )reater than <ero( it forards the 4"er$ o"tards to its nei)hbors( e*se( the 4"er$ is discarded& In o"r scenario( it s"ffices to distin)"ish an$ fi*e in the netor! as bein) either #a*are or otherise& This is beca"se( as noted ear*ier( an infected peer rep*ies affir#ati%e*$ 7 to a** the 4"eries that it recei%es ith the #a*are bein) s"bstit"ted for the fi*e bein) searched for a User A( #a!es a :"er$ in a Peer to Peer Netor! ith a 'i3ed TT6 = 6ife ti#e of the :"er$> ( and AI shos #ore interest in b*ind*$ acceptin) the Res"*tant Data fro# an$ Peer if TT6 is *ess than the Ti#e fi3ed& ".; PROPOSED SYSTEM In the Proposed S$ste# of i#p*e#entation( e%er$ nodes Deha%ior is %erified contin"o"s*$ b$ the rest of the Peers& If the abnor#a* Deha%ior is shon a peer then rest of the peers i** identif$ the #a*icio"s acti%it$ ith respect to that PeerHs Deha%ior& 'ina**$ the +or# affected Peer i** be re#o%ed fro# the netor! and :"arantine is pro%ided to !i** the Ma*are acti%it$ and to re#o%e the +or# fro# that Peer& On*$ then the or# is re#o%ed( the peer is added a)ain in the netor!& In this #ethod( the f*o of peers beteen the states are ritten in the for# of to %ectors ' and ,& +e are findin) the Ma*are b$ co#parin) the Deha%ior Patterns of Peers& If the Deha%ior is abnor#a*( then the Patches are distrib"ted to !i** the +or#s& ".4 MODIFICATIONS Are achie%ed in the Mode*in) of +or#s& +e Mode* To +or#s na#e*$( Sh"t Don +or# and Ne 'o*der Creation +or#& Patches are distrib"ted d$na#ica**$ to !i** the +or#s in the P0P Netor! 1 CAPTER ; RE<UIREMENT SPECIFICATIONS ;.1 INTRODUCTION The re4"ire#ents specification is a technica* specification of re4"ire#ents for the softare prod"cts& It is the first step in the re4"ire#ents ana*$sis process it *ists the re4"ire#ents of a partic"*ar softare s$ste# inc*"din) f"nctiona*( perfor#ance and sec"rit$ re4"ire#ents& The re4"ire#ents a*so pro%ide "sa)e scenarios fro# a "ser( an operationa* and an ad#inistrati%e perspecti%e& The p"rpose of softare re4"ire#ents specification is to pro%ide a detai*ed o%er%ie of the softare project( its para#eters and )oa*s& This describes the project tar)et a"dience and its "ser interface( hardare and softare re4"ire#ents& It defines ho the c*ient( tea# and a"dience see the project and its f"nctiona*it$& ;." ARDWARE AND SOFTWARE SPECIFICATION ;.".1 ARDWARE RE<UIREMENTS RAM E 120 MD Processor E Penti"# I, 8ard Dis! E ?A GD ;."." SOFTWARE RE<UIREMENTS Operatin) S$ste# E +indos BP 'ront End E 9a%a 9DC2&1 Dac! End E MS5S:6 Ser%er . CAPTER 4 4.1 ARCITECTURE DIAGRAM FOR MALWARE DETECTION AND REMOVAL F04 4.1 A1*+06)*6:1) 50-41-8 321 8-.@-1) 5)6)*6029 -95 1)82/-. ; 4." USE CASE DIAGRAM Respond to the query before the TTL User request the data Network Check the TTL and respond Find the malware Malware Node Node Attacker ource !limination
CAPTER 5 5.1 MODULES 2&Netor! constr"ction 0&TT6 ca*c"*ation /&+or# #ode*in) 7&+or# detection 1&D$na#ic patch distrib"tion .&Attac!er so"rce e*i#ination 5." MODULE E,PLANATION N)6@21A C29(61:*6029 This #od"*e is de%e*oped in order to create a d$na#ic netor!& In a netor!( nodes are interconnected ith the ad#in( hich is #onitorin) a** the other nodes& Thro")h the connection on*$ is possib*e to spread the or#& A** nodes are sharin) their infor#ation ith each others& TTL C-.*:.-6029 Ti#e5to5*i%e is a %a*"e in an Internet Protoco* =IP> pac!et that te**s a netor! ro"ter hether or not the pac!et has been in the netor! too *on) and sho"*d be discarded& 'or a n"#ber of reasons( pac!ets #a$ not )et de*i%ered to their destination in a reasonab*e *en)th of ti#e& A so*"tion is to discard the pac!et after a certain ti#e and send a #essa)e to the ori)inator( ho can decide hether to resend the pac!et& W218 825).094 Dased on o"r ana*$sis of the inco#in) attac!s( e deter#ined the$ ere 22 *i!e*$ a"to#ated based on the beha%ior of the attac!in) a)ent&More specifica**$( after each co#pro#ise in this e3ercise( the attac!in) a)ent atte#pted to don*oad additiona* #a*icio"s code and attac! other %icti#s b$ rep*icatin) itse*f to other s$ste#s& This is t$pica* beha%ior of a or#& That or# i** be "sed to sh"tdon and creation of ne fo*der to increase the o%erhead& W218 5)6)*6029 +hen a host as deter#ined to be beni)n it o"*d no *on)er be obser%ed& Netor! or#s are #a*icio"s pro)ra#s that spread a"to#atica**$ across netor!s b$ e3p*oitin) %"*nerabi*ities that affect a *ar)e n"#ber of hosts& Deca"se of the speed at hich or#s spread to *ar)e co#p"ter pop"*ations( co"nter#eas"res based on h"#an reaction ti#e are not feasib*e& D$ #onitorin) the beha%ior e can ab*e to find hether the s$ste# is affected or not& D>9-80* 7-6*+ 50(610?:6029 User periodica**$ chec!s a** the contro*s of his s$ste#& If he sees an$ t$pes of beha%iora* chan)es then i##ediate*$ he i** prod"ce the patch fi*e and !i** the or#& This process of i#p*e#entation o"*d be of "sef"* in pro%idin)( the correspondin) patches to the #achine hich i** affected d$na#ica**$ J to !i** the or#s& A66-*A)1 S2:1*) E.0809-6029 Once e app*$ the IP Trace bac! s$ste#( e can identif$ the e3act so"rce of the s$ste# hich is in%o*%ed in spreadin) of the or#s& +e are identif$in) the So"rce of +or# creator J e can e*i#inate that s$ste# fro# the netor!& This process of e*i#ination o"*d create #ore sec"red co##"nication& 20 CAPTER % SOFTWARE CONFIGURATION %.1 L-94:-4) (7)*030*-6029 Abo"t the 9a%a Techno*o)$ 9a%a techno*o)$ is both a pro)ra##in) *an)"a)e and a p*atfor#& T+) J-/- P1241-88094 L-94:-4) The 9a%a pro)ra##in) *an)"a)e is a hi)h5*e%e* *an)"a)e that can be characteri<ed b$ a** of the fo**oin) b"<<ordsE Si#p*e Architect"re ne"tra* Object oriented Portab*e Distrib"ted 8i)h perfor#ance M"*tithreaded Rob"st D$na#ic Sec"re The #achine *an)"a)e of the 9a%a ,irt"a* Machine 2 =9a%a ,M>& The java *a"ncher too* then r"ns $o"r app*ication ith an instance of the 9a%a ,irt"a* Machine& A9 2/)1/0)@ 23 6+) (236@-1) 5)/).278)96 712*)((. 2/ Deca"se the 9a%a ,M is a%ai*ab*e on #an$ different operatin) s$ste#s( the sa#e &c*ass fi*es are capab*e of r"nnin) on Microsoft +indos( the So*aris TM Operatin) S$ste# =So*aris OS>( 6in"3( or Mac OS& So#e %irt"a* #achines( s"ch as the 9a%a 8otSpot %irt"a* #achine( perfor# additiona* steps at r"nti#e to )i%e $o"r app*ication a perfor#ance boost& This inc*"de %ario"s tas!s s"ch as findin) perfor#ance bott*enec!s and reco#pi*in) =to nati%e code> fre4"ent*$ "sed sections of code& Thro")h the 9a%a ,M( the sa#e app*ication is capab*e of r"nnin) on #"*tip*e p*atfor#s& T+) J-/- P.-63218 A p*atfor# is the hardare or softare en%iron#ent in hich a pro)ra# r"ns& 9a%a p*atfor# differs fro# #ost other p*atfor#s in that itKs a softare5on*$ p*atfor# that r"ns on top of other hardare5based p*atfor#s& 27 T+) J-/- 7.-63218 +-( 6@2 *28729)96(E The 9a%a ,irt"a* Machine The 9a%a App*ication Pro)ra##in) Interface =API> The API is a *ar)e co**ection of read$5#ade softare co#ponents that pro%ide #an$ "sef"* capabi*ities& It is )ro"ped into *ibraries of re*ated c*asses and interfacesL these *ibraries are !non as pac!a)es& So#e of the f"nctiona*it$ pro%ided b$ the API& The API and 9a%a ,irt"a* Machine ins"*ate the pro)ra# fro# the "nder*$in) hardare& As a p*atfor#5independent en%iron#ent( the 9a%a p*atfor# can be a bit s*oer than nati%e code D)/).278)96 T22.(E The de%e*op#ent too*s pro%ide e%er$thin) $o"K** need for co#pi*in)( r"nnin)( #onitorin)( deb"))in)( and doc"#entin) $o"r app*ications& As a ne de%e*oper( the #ain too*s $o"K** be "sin) are the ja%ac co#pi*er( the ja%a *a"ncher( and the ja%a doc doc"#entation too*& A77.0*-6029 P1241-88094 I96)13-*) EAPIFE The API pro%ides the core f"nctiona*it$ of the 9a%a pro)ra##in) 15 *an)"a)e& It offers a ide arra$ of "sef"* c*asses read$ for "se in $o"r on app*ications& It spans e%er$thin) fro# basic objects( to netor!in) and sec"rit$( to BM6 )eneration and database access( and #ore& The core API is %er$ *ar)eL to )et an o%er%ie of hat it contains( cons"*t the 9a%a SE De%e*op#ent Cit . =9DC TM .> doc"#entation& D)7.2>8)96 T)*+92.240)( The 9DC softare pro%ides standard #echanis#s s"ch as the 9a%a +eb Start softare and 9a%a P*")5In softare for dep*o$in) $o"r app*ications to end "sers& U()1 I96)13-*) T22.A06( The Sin) and 9a%a 0D too*!its #a!e it possib*e to create sophisticated Graphica* User Interfaces =GUIs>& A5506029-. F)-6:1)( O3 J-/- A**)((0?0.06> 3128 -9> .2*-6029 09 6+) @21.5E 9a%a is an internet pro)ra##in) *an)"a)e&The eb pro%ides accessibi*it$ to a co#p"ter fro# an$here in the or*d V01:( 31)) S>(6)8 9a%a is sec"re =i&e> an$ chan)es #ade to the co#p"ter are ta))ed as errors and the pro)ra# i** not e3ec"te P.-63218 I95)7)95)96 L-94:-4) 9a%a co#pi*er co#pi*es ja%a code to an inter#ediate b$te code that is "nderstood b$ 9,M=ja%a %irt"a* #achine> 2. To e3ec"te the b$te codes the s$ste# sho"*d ha%e ja%a interpreter or ja%a enab*ed internet broser S7))5 9a%a is a 8i)h perfor#ance *an)"a)e faster than pro)ra#s ritten in other interpreter *an)"a)e s"ch as DASIC ( faster than C( CMM& D)/).278)96 608) 9a%a is si#p*e (in ja%a pro)ra##ers do not need to #anip"*ate #e#or$ G-1?-4) C2..)*6029 ItHs the process that a"to#atica**$ frees the #e#or$ of objects that are no #ore in "se& There is no specification of a techni4"e for )arba)e co**ection %." JAVA PROGRAMMING$ 9a%a is an object oriented pro)ra##in) *an)"a)e de%e*oped b$ S"n Micros$ste#s b$ chief pro)ra##er 9a#es Gos*in)&9a%a Pro)ra#s fa**s in to cate)ories 2&>A77.0*-6029( An app*ication is a pro)ra# that e can e3ec"te fro# an$ operatin) s$ste#& indos app*ications ha%e a )raphica* "ser interfaceconso*e app*ications are character based netor!ed app*ications can "se reso"rces that are a%ai*ab*e o%er a netor!& Distrib"ted app*ications can access objects that e3ec"te across #an$ co#p"ters o%er a netor!& App*ications can a*so estab*ish netor! connections( access reso"rces across a netor! and *a"nch app*ications o%er a netor! 2; ".FA77.)6( App*ets are ja%a pro)ra#s that e3ec"te inside ebpa)e&Therefore "n*i!e app*ications( app*ets re4"ire a ja%a enab*ed broser *i!e Microsoft internet E3p*orer 7&A (Netscape na%i)ator 7&A or abo%e( or 8ot ja%a& An app*et is *oaded and e3ec"ted hen a "ser *oads a +eb pa)e thro")h a +eb Droser& App*ets ha%e Graphica* "ser interface &It ha%e *ess sec"rit$ pri%i*e)es than app*ications R:9 T08) E9/01298)96 I9 J-/- 9a%a r"n ti#e en%iron#ent has to access the #ain= > #ethod to e3ec"te a pro)ra# therefore the #ain= > #ethod sho"*d be dec*ared p"b*ic& It sho"*d be dec*ared (6-60* beca"se it has to )G0(6 before an$ object of the c*ass is created &The co##and *ine para#eter is a strin) t$pe %ariab*e - #ain=Strin) ar)sNO>& The n"#ber of ar)"#ents is deter#ined b$ the Strin) c*ass object EG)*:6094 A J-/- P1241-8 A pro)ra# ca**ed 9,M=ja%a %irt"a* #achine> e3ec"tes ja%a pro)ra#s &The 9,M contains r"n ti#e en%iron#ent and the c*ass *oader&+hen e co#pi*e a &ja%a fi*e ( a &c*ass fi*e is created To co#pi*e a fi*e "se ja%ac "ti*it$ To e3ec"te a &c*ass fi*e ( $o" "se the ja%a "ti*it$ E9*-7(:.-6029 A c*ass is a b*"eprint or protot$pe fro# hich objects are created&Objects are !e$ to "nderstandin) object5oriented techno*o)$& 2? Objects consist of state and re*ated beha%ior& 8idin) interna* state and re4"irin) a** interaction to be perfor#ed thro")h an objectKs #ethods is !non as data encaps"*ation F a f"nda#enta* princip*e of object5oriented pro)ra##in)& Inheritance Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. S>96-G At the be)innin) of $o"r c*ass dec*aration( "se the extends !e$ord( fo**oed b$ the na#e of the c*ass to inherit fro# Interface An interface is a contract beteen a c*ass and the o"tside or*d( and this contract is enforced at b"i*d ti#e b$ the co#pi*er& +hen a c*ass i#p*e#ents an interface( it pro#ises to pro%ide the beha%ior p"b*ished b$ that interface& I#p*e#entin) an interface a**os a c*ass to beco#e #ore for#a* abo"t the beha%ior it pro#ises to pro%ide P-*A-4)( Usin) 087216 state#ent e can "se ja%a pac!a)es in a pro)ra# =its si#i*ar to inc*"de state#ent in CMM> Pac!a)e contains on*$ c*asses( hereas a header fi*e can contain independent #ethods& 2@ The$ ha%e hierarchica* str"ct"re if the pac!a)e na#e is not specified c*ass beco#es the #e#ber of the defa"*t pac!a)e EG*)76029( The 9a%a pro)ra##in) *an)"a)e "ses e3ceptions to hand*e errors and other e3ceptiona* e%ents& An e3ception is an e%ent that occ"rs d"rin) the e3ec"tion of a pro)ra# that disr"pts the nor#a* f*o of instr"ctions& The disc"ssion inc*"des the tr$( catch( and fina**$ b*oc!s( as e** as chained e3ceptions and *o))in)& Searchin) the ca** stac! for the e3ception hand*er& The Three Kinds of Exceptions Checked exception are exceptional conditions that a well-written application should anticipate and recover from. !rrors are an exceptional condition that are external to the application and that the application usually cannot anticipate or recover from. 0A "untime exceptions are exceptional conditions that are internal to the application and that the application usually cannot anticipate or recover from. The fina**$ b*oc! a*a$s e3ec"tes hen the tr$ b*oc! e3its& C28729)96 ,is"a* contro*s s"ch as te3tbo3es( chec!bo3es( *istbo3es( b"ttons J co#bo bo3es are ca**ed co#ponents& Each co#ponent inherits the properties of its parent container s"ch as font J co*or& C296-09)1($ Top *e%e* indos that ho*d these co#ponents are ca**ed containers& The container a*so contro*s the position of co#ponents p*aced in it F1-8) W0952@$ Containers are contained ithin the fra#e indo( hich is another t$pe of a container& The fra#e indo is the top *e%e* indo J as s"ch it does not ha%e a parent container& AWT E-?(61-*6 @0952@ 622.A06F$ In ja%a 2&A "ser interfaces are created "sin) A+T& The front end app*ications created "sin) A+T is different on different p*atfor#s& J-/- F2:95-6029 C.-(()( EJFCF$ 9'C is an e3tension of the ori)ina* A+T& It is an e3tension of A+T& It is first de*i%ered as a part of the ja%a p*atfor#& It has a rich set of co#ponents that are co#p*ete*$ cross p*atfor# independent J offer i#pro%ed perfor#ance& +e can create *ar)e sca*e internet J intranet app*ications "sin) 9'C. 02 A?2:6 6+) JFC -95 S@094 9'C is short for 9a%a 'o"ndation C*asses( hich enco#pass a )ro"p of feat"res for b"i*din) )raphica* "ser interfaces =GUIs> and addin) rich )raphics f"nctiona*it$ and interacti%it$ to 9a%a app*ications& C2870.094 -95 R:99094 S@094 P1241-8( This section e3p*ains ho to co#pi*e and r"n a Sin) app*ication& The co#pi*ation instr"ctions or! for a** Sin) pro)ra#s F app*ets( as e** as app*ications& 8ere are the steps $o" need to fo**oE Insta** the *atest re*ease of the 9a%a SE p*atfor#( if $o" ha%enKt a*read$ done so& Create a pro)ra# that "ses Sin) co#ponents& Co#pi*e the pro)ra#& R"n the pro)ra#& C.0)96HS)1/)1 T)*+92.24> C*ientPSer%er co#p"tin) is an en%iron#ent that distrib"tes processin) accross #an$ co#p"ters& C*ientPSer%er s$ste# is "sed to access different databases or ser%ices %ia a netor! tho")h to5tier or three5tier architect"re& F04:1) 1$ T@2B60)1 A1*+06)*6:1) 321 D-6- A**)((. 00 QThe job of a c*ient is to re4"est for a ser%ice and the job of the ser%er is to ser%e the re4"est&Q #-(0*-..> 6+)1) -1) 6@2 6>7)( 23 *.0)96(. Dependent C*ients& Independent C*ient& Dependent c*ients are s"ch c*ients ho can connect on*$ to a sin)*e database hi*e independent c*ients connect to %ario"s databases thro")h so#e specific DDMS independent standards *i!e ODDC=Open Database Connecti%it$>( 9DDC etc& O7)9 D-6-?-() C299)*60/06> EOD#CF Open Database Connecti%it$ is MicrosoftKs strate)ic interface for accessin) data in a hetero)eneo"s en%iron#ent of re*ationa* and non5re*ationa* database #ana)e#ent s$ste#s& ODDC stands as a trans*ator con%ertin) the *oca* S:6 to the nati%e S:6& As far as ODDC is concerned the bac! end co"*d be an$ pop"*ar RDDMSKs *i!e Orac*e( S:6 ser%er( and so on& The pro)ra##er at the front5end need not orr$ abo"t the "ni4"e s$nta3 of an RDDMS& The pro)ra##er si#p*$ )i%es )eneric pro)ra##in) state#ents hich the dri%er #ana)er passes on to the dri%er ith specific s$nta3 =ODDC S:6>( hich is then con%erted to RDDMS "nderstandab*e Nati%e S:6 state#ents& T+) J-/- D-6-?-() C299)*60/06> EJD#CF Man$ app*ication de%e*opers o"*d *i!e to rite code that is independent of the partic"*ar DDMS or database connecti%it$ #echanis# bein) "sed( and a 0/ DDMS5independent interface is a*so the fastest a$ to i#p*e#ent access to the ide %ariet$ of DDMSs& 9DDC a**os pro)ra##ers to rite to a sin)*e database interface enab*in) DDMS5independent ja%a app*ication and a**os database connecti%it$ %endors to pro%ide a %ariet$ of different connecti%it$ so*"tions& 9a%a Database Connecti%it$ pro%ides "nifor# access to ide ran)e of re*ationa* databases& It is si#p*$ a set of c*asses and interfaces ritten in 9a%a Pro)ra##in) *an)"a)e to pro%ide a standard API =App*ication pro)ra# Interface> for too*Pdatabase de%e*opers& U(094 JD#C 06 0( 72((0?.) 62 52 6+1)) 8-I21 -*60/060)(. 5 Estab*ish a connection ith a database 5 Send S:6 state#ents 5 Process the res"*ts& W+> JD#C 09(6)-5 23 OD#C ODDC API is the #ost ide*$ "sed interface for accessin) a** pop"*ar re*ationa* databases and has the abi*it$ to connect to a*#ost a** databases on a*#ost a** p*atfor#s& So it is possib*e to "se ODDC fro# ja%a ith the he*p of 9DDC in the for# of the 9DDC5ODDC Drid)e& P063-..( 09 OD#C ODDC is not appropriate for direct "se fro# ja%a bec"ase it "ses c interface& Ca**s fro# ja%a to nati%e C code ha%e a n"#ber of drabac!s in the sec"rit$ i#p*e#entation ( rob"stness( and a"to#atic portabi*it$ of app*ications& A *itera* trans*ation of the ODDC into a ja%a API o"*d not be desirab*e& 07 JD#CBOD#C #1054). 9DDC 5 ODDC brid)e is a 9DDC dri%er( hich i#p*e#ents 9DDC operations b$ trans*atin) the# into ODDC operations( so to ODDC it appears as a nor#a* app*ication pro)ra#& The 9DDC5ODDC Drid)e i#p*e#ents 9DDC API for an$ database hich has an ODDC dri%er& The Drid)e is i#p*e#ented thro")h the s"n&jdbc&odbc ja%a pac!a)e and contains a nati%e *ibrar$ "sed to access ODDC JD#C P125:*6 C28729)96( JD#C 09*.:5)( 32:1 *28729)96($ T+) JD#C API J The 9DDCR API pro%ides pro)ra##atic access to re*ationa* data fro# the 9a%aR pro)ra##in) *an)"a)e& Usin) the 9DDC API( app*ications can e3ec"te S:6 state#ents( retrie%e res"*ts( and propa)ate chan)es bac! to an "nder*$in) dataso"rce& JD#C D10/)1 M-9-4)1 J The 9DDC Dri%er Mana)er c*ass defines objects hich can connect 9a%a app*ications to a 9DDC dri%er& Dri%er Mana)er has traditiona**$ been the bac!bone of the 9DDC architect"re& It is 4"ite s#a** and si#p*e& The Standard E3tension pac!a)es ja%a3&na#in) and ja%a3&s4* *et $o" "se a DataSo"rce object re)istered ith a 9a%a Na#in) and Director$ Interface =9NDI> na#in) ser%ice to estab*ish a connection ith a data so"rce& So" can "se either connectin) #echanis#( b"t "sin) a DataSo"rce object is reco##ended hene%er possib*e& JD#C T)(6 S:06) The 9DDC dri%er test s"ite he*ps $o" to deter#ine that 9DDC dri%ers i** r"n $o"r pro)ra#& These tests are not co#prehensi%e or e3ha"sti%e( b"t the$ do e3ercise #an$ of the i#portant feat"res in the 9DDC API& JD#CBOD#C#1054) The 9a%a Softare brid)e pro%ides 9DDC access %ia ODDC dri%ers& Note that $o" need to *oad ODDC binar$ code onto each c*ient #achine that "ses this dri%er& As a res"*t( the ODDC dri%er is #ost appropriate on a corporate netor! here c*ient insta**ations are not a #ajor prob*e#( or for app*ication ser%er code ritten in 9a%a in a three5tier architect"re& This Trai* "ses the first to of these fo"r 9DDC co#ponents to connect to a database and then b"i*d a ja%a pro)ra# that "ses S:6 co##ands to co##"nicate ith a test Re*ationa* Database& The *ast to co#ponents are "sed in specia*i<ed en%iron#ents to test eb app*ications( or to co##"nicate ith ODDC5aare DDMSs& J-/-.(D. 7-*A-4). 9DDC c*asses and interfaces are rea**$ #ade a%ai*abe in the ja%a&s4* pac!a)e& It consists of %ario"s c*asses and interfaces those s"pport ca**s to %ario"s databases& The fo**oin) are the i#portant c*asses and interfaces a%ai*ab*e in the ja%a&s4* pac!a)e& 5 Dri%erMana)er C*ass 5 T$pes C*ass 5 Date C*ass 5 Connection Interface 5 State#ent Interface 5 PreparedState#ent Interface 5 Ca**ab*eState#ent Interface 01 E(6-?.0(+094 JD#C C299)*6029 The fo**oin) processes are re4"ired for a 9a%a pro)a# to co##"nicate to a database& Estab*ish a connection beteen the ja%a pro)ra# and the database #ana)er& Send a S:6 state#ent to the database b$ "sin) a state#ent object& Read the res"*ts bac! fro# the database and "se the# in pro)ra#s& T+) D10/)1 M-9-4)1 *.-((. The Dri%erMana)er c*ass is the #ana)e#ent *a$er of 9dbc( hich or!s as an interface beteen the "ser and database dri%ers& 'or si#p*e app*ications the on*$ #ethod in this c*ass that a )enera* pro)ra##er needs to "se direct*$ is Dri%erMana)er&)etConnection=>( hich is a p"b*ic static #ethod& T+) C299)*6029 I96)13-*). The connection interface is one of the #ajor interfaces in 9DDC& A connection object represents a connection ith a database& A connection session inc*"des the S:6 state#ents that are e3ec"ted and the res"*ts that are ret"rned o%er that connection& 'or E3a#p*eE Connection conL conTDri%erMana)er&)etConnection=QjdbcEodbcEoradsnQ(QscottQ(Qti)erQ>L 0. EG)*:6094 S<L (6-6)8)96(. Once a connection is estab*ished it is "sed to pass s4* state#ents to the database& 9dbc pro%ides three c*asses for sendin) S:6 state#ents to the database( and three #ethods in the connection interface create instances of these interfaces& I96)13-*) D)(*1076029 A((2*0-6)5 8)6+25 State#ent Si#p*e S:6 itho"t para#eters createState#ent=> PreparedState#ent S4* ith one or #ore In para#eters prepare State#ent=> Ca**ab*e State#ent Used to ca** stored proced"res prepareCa**=> T+) S6-6)8)96 I96)13-*). Once the connection object to a data so"rce is s"ccessf"*( that connection can be "sed to send S:6 state#ents& A state#ent object is created ith the connection #ethod createState#ent as fo**os& State#ent st#tTcon&createState#ent=>L The state#ent interface pro%ides three different #ethods for e3ec"tin) S:6 state#ents the$ are as fo**os& e3ec"te:"er$=> 5 is desi)ned for nor#a* se*ect state#ents e3ec"teUpdate=> 5 is "sed to e3ec"te Insert( Update( De*ete( CreateTab*e( Drop Tab*e& The ret"rn %a*"e is an inte)er& e3ec"te=> 5 is "sed to e3ec"te an$ state#ents that ret"rn #ore than one res"*t 0; set& it ret"rns a boo*ean %a*"e( tr"e 5 ret"rns a res"*t set or %ice %ersa& T+) R)(:.6S)6 I96)13-*) A Res"*tSet pro%ides access to the records in a tab*e& E3ec"tin) a state#ent object "s"a**$ )enerates a Res"*tSet& If a 4"er$ state#ent is e3ec"ted it ret"rns the ros that satisfies the 4"er$ and s"ch ros are stored in the Res"*tSet object& The )et #ethods retrei%e data for the c"rrent ro and it can be retrei%ed either "sin) the inde3 n"#ber of the co*"#n or b$ the na#e of the co*"#n& %.; A#OUT S<L S:6 stands for Str"ct"red :"er$ 6an)"a)e S:6 *ets $o" access and #anip"*ate databases& It is an ANSI =A#erican Nationa* Standards Instit"te> standard U(094 S<L 09 Y2:1 W)? S06) To b"i*d a eb site that shos so#e data fro# a database( $o" i** need the fo**oin): An RDDMS database pro)ra# =i&e& MS Access( S:6 Ser%er( M$S:6> A ser%er5side scriptin) *an)"a)e( *i!e P8P or ASP(S:6(8TM6 P CSS RD#MS RDDMS stands for Re*ationa* Database Mana)e#ent S$ste#& RDDMS is the basis for S:6( and for a** #odern database s$ste#s *i!e MS S:6 Ser%er( IDM DD0( Orac*e( M$S:6( and Microsoft Access&The data in RDDMS is stored in database objects ca**ed tab*es& 0? S<L DML -95 DDL S:6 can be di%ided into to partsE The Data Manip"*ation 6an)"a)e =DM6> and the Data Definition 6an)"a)e =DD6>& The 4"er$ and "pdate co##ands for# the DM6 part of S:6E SELECT 5 e3tracts data fro# a database UPDATE 5 "pdates data in a database DELETE 5 de*etes data fro# a database INSERT INTO 5 inserts ne data into a database The DD6 part of S:6 per#its database tab*es to be created or de*eted& It a*so define inde3es =!e$s>( specif$ *in!s beteen tab*es( and i#pose constraints beteen tab*es& The SQL SELECT Statement The SE6ECT state#ent is "sed to se*ect data fro# a database& #$% #!%!C& #yntax SE6ECT co*"#nUna#e=s> 'ROM tab*eUna#e and SE6ECT V 'ROM tab*eUna#e SE6ECT 6astNa#e ('irstNa#e 'ROM Persons 8ere( 6astNa#e( 'irstNa#e are co*"#n na#e in tab*e persons S)80*2.29 -36)1 S<L S6-6)8)96(? So#e database s$ste#s=e3cept MS Access and S:6 Ser%er 0AAA> re4"ire a se#ico*on at the end of each S:6 state#ent& Se#ico*on is the standard a$ to separate each S:6 state#ent in database s$ste#s that a**o #ore than one S:6 state#ent to be e3ec"ted in the 0@ sa#e ca** to the ser%er& N-/04-6029 09 - R)(:.6B()6 Most database softare s$ste#s a**o na%i)ation in the res"*t5set ith pro)ra##in) f"nctions( *i!eE Mo%e5To5'irst5Record( Get5Record5Content( Mo%e5To5Ne3t5Record( etc& T+) S<L SELECT DISTINCT S6-6)8)96 The DISTINCT !e$ord can be "sed to ret"rn on*$ distinct =different> %a*"es& Syntax: #!%!C& '(#&()C& column*name+s, -"O. table*name EG-87.)$ SE6ECT DISTINCT Cit$ 'ROM Persons T+) WERE C.-:() The +8ERE c*a"se is "sed to e3tract on*$ those records that f"*fi** a specified criterion& S>96-G$ SE6ECT co*"#nUna#e=s>'ROM tab*eUna#e +8ERE co*"#nUna#e operator %a*"e <:26)( A12:95 T)G6 F0).5( S:6 "ses sin)*e 4"otes aro"nd te3t %a*"es =#ost database s$ste#s i** a*so accept do"b*e 4"otes>& A*tho")h( n"#eric %a*"es sho"*d not be enc*osed in 4"otes& EG-87.)E SE6ECT V 'ROM Persons +8ERE 'irstNa#eTKTo%eK /A This is ron)E SE6ECT V 'ROM Persons +8ERE 'irstNa#eTTo%e S<L AND K OR O7)1-621( AND Operator E3a#p*eE SE6ECT V 'ROM Persons +8ERE 'irstNa#eTKTo%eK AND 6astNa#eTKS%ndsonK OR O7)1-621 EG-87.) SE6ECT V 'ROM Persons +8ERE 'irstNa#eTKTo%e OR 'irstNa#eTKO*aK C28?09094 AND K OR SE6ECTV'ROMPersons+8ERE6astNa#eTKS%endsonKAND='irstNa#eTKTo%eK OR 'irstNa#eTKO*aK> T+) ORDER #Y K)>@215 The ORDER DS !e$ord is "sed to sort the res"*t5set b$ a specified co*"#n( b$ defa"*t sort the records in ascendin) order& SE6ECT co*"#nUna#e=s> 'ROM tab*eUna#e ORDERDS co*"#nUna#e=s> ASCWDESC T+) INSERT INTO S6-6)8)96 The INSERT INTO state#ent is "sed to insert a ne ro or record in a tab*e& /2 S<L INSERT INTO S>96-G It is possib*e to rite the INSERT INTO state#ent in to for#s& The first for# doesnKt specif$ the co*"#n na#es here the data i** be inserted( on*$ their %a*"esE INSERT INTO tab*eUna#e ,A6UES =%a*"e2( %a*"e0( %a*"e/(&&&> The second for# specifies both the co*"#n na#es and the %a*"es to be insertedE INSERTINTOtab*eUna#e=co*"#n2(co*"#n0(co*"#n/(&&&>,A6UES =%a*"e2( %a*"e0( %a*"e/(&&&> E3a#p*eE INSERT INTO Persons ,A6UES =7(KNi*senK( K9ohanK( KDa!!en 0K( KSta%an)erK> INSERT INTO Persons=PUId(6astNa#e('irstNa#e> ,A6UES=1( KTjesse#K( K9a!obK> T+) UPDATE S6-6)8)96 The UPDATE state#ent is "sed to "pdate e3istin) records in a tab*e& Syntax UPDATE tab*eUna#e SET co*"#n2T%a*"e ( co*"#n0T%a*"e0(&&& +8ERE so#eUco*"#nTso#eU%a*"e UPDATE Persons SETAddressTKNissestien.;K(Cit$TKSandnesK+8ERE 6astNa#eTKTjesse#K AND 'irstNa#eTK9a!obK /0 CAPTER ! TESTING The p"rpose of testin) is to disco%er errors& Testin) is the process of tr$in) to disco%er e%er$ concei%ab*e fa"*t or ea!ness in a or! prod"ct& It pro%ides a a$ to chec! the f"nctiona*it$ of co#ponents( s"b asse#b*ies( asse#b*ies andPor a finished prod"ct It is the process of e3ercisin) softare ith the intent of ens"rin) that the Softare s$ste# #eets its re4"ire#ents and "ser e3pectations and does not fai* in an "nacceptab*e #anner& There are %ario"s t$pes of test& Each test t$pe addresses a specific testin) re4"ire#ent& !.1 UNIT TESTING Unit testin) in%o*%es the desi)n of test cases that %a*idate that the interna* pro)ra# *o)ic is f"nctionin) proper*$( and that pro)ra# inp"t prod"ces %a*id o"tp"ts& A** decision branches and interna* code f*o sho"*d be %a*idated& It is the testin) of indi%id"a* softare "nits of the app*ication &it is done after the co#p*etion of an indi%id"a* "nit before inte)ration& This is a str"ct"ra* testin)( that re*ies on !no*ed)e of its constr"ction and is in%asi%e& Unit tests perfor# basic tests at co#ponent *e%e* and test a specific b"siness process( app*ication( andPor s$ste# confi)"ration& Unit tests ens"re that each "ni4"e path of a b"siness process perfor#s acc"rate*$ to the doc"#ented specifications and contains c*ear*$ defined inp"ts and e3pected res"*ts& Unit testin) is "s"a**$ cond"cted as part of a co#bined code and "nit test phase of the softare *ifec$c*e( a*tho")h it is not "nco##on for codin) and "nit testin) to be cond"cted as to distinct phases& // !." INTEGRATION TESTING Inte)ration tests are desi)ned to test inte)rated softare co#ponents to deter#ine if the$ act"a**$ r"n as one pro)ra#& Testin) is e%ent dri%en and is #ore concerned ith the basic o"tco#e of screens or fie*ds& Inte)ration tests de#onstrate that a*tho")h the co#ponents ere indi%id"a**$ satisfaction( as shon b$ s"ccessf"**$ "nit testin)( the co#bination of co#ponents is correct and consistent& Inte)ration testin) is specifica**$ ai#ed at e3posin) the prob*e#s that arise fro# the co#bination of co#ponents& Softare inte)ration testin) is the incre#enta* inte)ration testin) of to or #ore inte)rated softare co#ponents on a sin)*e p*atfor# to prod"ce fai*"res ca"sed b$ interface defects& The tas! of the inte)ration test is to chec! that co#ponents or softare app*ications( e&)& co#ponents in a softare s$ste# or - one step "p - softare app*ications at the co#pan$ *e%e* - interact itho"t error& !.; ACCEPTANCE TESTING User Acceptance Testin) is a critica* phase of an$ project and re4"ires si)nificant participation b$ the end "ser& It a*so ens"res that the s$ste# #eets the f"nctiona* re4"ire#ents& !.4 FUNCTIONAL TESTING '"nctiona* tests pro%ide s$ste#atic de#onstrations that f"nctions tested are a%ai*ab*e as specified b$ the b"siness and technica* re4"ire#ents( s$ste# doc"#entation and "ser #an"a*s& '"nctiona* testin) is centered on the fo**oin) ite#sE ,a*id Inp"t E identified c*asses of %a*id inp"t #"st be accepted& /7 In%a*id Inp"t E identified c*asses of in%a*id inp"t #"st be rejected& '"nctions E identified f"nctions #"st be e3ercised& O"tp"t E identified c*asses of app*ication o"tp"ts #"st be e3ercised& S$ste#sPProced"res E interfacin) s$ste#s or proced"res #"st be in%o!ed& Or)ani<ation and preparation of f"nctiona* tests is foc"sed on re4"ire#ents( !e$ f"nctions( or specia* test cases& In addition ( s$ste#atic co%era)e pertainin) to identif$& D"siness process f*osL data fie*ds( predefined processes( and s"ccessi%e processes #"st be considered for testin)& Defore f"nctiona* testin) is co#p*ete( additiona* tests are identified and the effecti%e %a*"e of c"rrent tests is deter#ined& !.5 SYSTEM TESTING S$ste# testin) ens"res that the entire inte)rated softare s$ste# #eets re4"ire#ents& It tests a confi)"ration to ens"re !non and predictab*e res"*ts& An e3a#p*e of s$ste# testin) is the confi)"ration oriented s$ste# inte)ration test& S$ste# testin) is based on process descriptions and f*os( e#phasi<in) pre5dri%en process *in!s and inte)ration points& WITE #O, TESTING +hite Do3 Testin) is a testin) in hich the softare tester has !no*ed)e of the inner or!in)s( str"ct"re and *an)"a)e of the softare( or at *east its p"rpose& It is "sed to test areas that cannot be reached fro# a b*ac! bo3 *e%e*& /1 #LACK #O, TESTING D*ac! Do3 Testin) is testin) the softare itho"t an$ !no*ed)e of the inner or!in)s( str"ct"re or *an)"a)e of the #od"*e bein) tested& D*ac! bo3 tests( as #ost other !inds of tests( #"st be ritten fro# a definiti%e so"rce doc"#ent( s"ch as specification or re4"ire#ents doc"#ent( s"ch as specification or re4"ire#ents doc"#ent& It is a testin) in hich the softare "nder test is treated( as a b*ac! bo3 $o" cannot seeI into it& The test pro%ides inp"ts and responds to o"tp"ts itho"t considerin) ho the softare or!s& TEST RESULTS$ A** the test cases #entioned abo%e passed s"ccessf"**$& No defects enco"ntered& /. CAPTER 8 CODINGS NODE i#port ja%a&at&VL i#port ja%a&at&e%ent&VL i#port ja%a3&sin)&VL i#port ja%a3&sin)&tab*e&Defa"*tTab*eMode*L i#port ja%a&"ti*&VL i#port ja%a&net&VL p"b*ic c*ass Node e3tends 9'ra#e i#p*e#ents R"nnab*e X static 9Tab*e tab*eL int ro T AL static Strin) na#e T QQL DDConnect connectL ProcessRe4"est re4"estL int portL static Defa"*tTab*eMode* t#ode*L /; static Strin) co*sNOL PP9RadioD"tton rando#+a*!(f*ood(psearchL PPPD"ttonGro"p b) T n"**L Strin) searchCate)or$ T n"**L pri%ate InetAddress address T n"**L pri%ate Strin) iipaddressL pri%ate static 9Te3tArea tUres"*t T n"**L p"b*ic Node=> X s"per=QNode QMna#e>L tr$X add+indo6istener=ne +indoAdapter=>X p"b*ic %oid indoC*osin)=+indoE%ent e>X tr$X address T InetAddress&)et6oca*8ost=>L iipaddress T address&)et8ostAddress=>L connect&"pdateNode=na#e( QO''Q(iipaddress>L /? Ycatch=E3ception er2>XY S$ste#&e3it=A>L Y Y>L connect T ne DDConnect=>L S$ste#&o"t&print*n=QConnection createdQ>L address T InetAddress&)et6oca*8ost=>L iipaddress T address&)et8ostAddress=>L portT connect&"pdateNode=na#e( QONQ(iipaddress>L initCo#ponent=>L Thread t T ne Thread=this>L PPt&start=>L start=>L Ycatch=E3ception err>Xerr&printStac!Trace=>LY Y p"b*ic %oid initCo#ponent=> X
set6a$o"t=ne Dorder6a$o"t=>>L 96abe* *Ubaner T ne 96abe*=QD$na#ic Ma*areQ( 96abe*&CENTER>L *Ubaner&set'ont=ne 'ont=QTi#es Ne Ro#anQ('ont&P6AIN( 01>>L add=*Ubaner( Dorder6a$o"t&NORT8>L PPrando#+a*! T ne 9RadioD"tton=QScanQ>L PPf*ood T ne 9RadioD"tton=QSearchQ>L PPpsearch T ne 9RadioD"tton=QDe*eteQ>L PPb) T ne D"ttonGro"p=>L PPb)&add=rando#+a*!>L PPb)&add=f*ood>L PPb)&add=psearch>L 9TabbedPane pane T ne 9TabbedPane=>L 9Pane* pana*Usearch T ne 9Pane*=>L pana*Usearch&set6a$o"t=n"**>L 96abe* *Udata T ne 96abe*=Q'i*e Na#e Q>L PP*Udata&set'ont=ne 'ont=QTi#es Ne Ro#anQ('ont&P6AIN( 20>>L *Udata&setDo"nds=1A(0A(21A(00>L 7A pana*Usearch&add=*Udata>L fina* 9Te3t'ie*d tUdata T ne 9Te3t'ie*d=>L tUdata&setDo"nds=201(/A(2?A(0/>L pana*Usearch&add=tUdata>L 96abe* *Uti#e T ne 96abe*=QTi#e Q>L PP*Udata&set'ont=ne 'ont=QTi#es Ne Ro#anQ('ont&P6AIN( 20>>L *Uti#e&setDo"nds=1A(;A(21A(00>L pana*Usearch&add=*Uti#e>L fina* 9Te3t'ie*d tUti#e T ne 9Te3t'ie*d=>L tUti#e&setDo"nds=201(;A(2?A(0/>L pana*Usearch&add=tUti#e>L 96abe* *Ures"*t T ne 96abe*=QSearch Res"*ts E Q>L *Ures"*t&setDo"nds=1A(20A(2AA(0A>L pana*Usearch&add=*Ures"*t>L tUres"*t T ne 9Te3tArea=>L 9Scro**Pane pan Tne 9Scro**Pane=tUres"*t( 0A(/A>L pan&setDo"nds=1A(2.A(01A(2/A>L 72 tUres"*t&setEditab*e=fa*se>L pana*Usearch&add=pan>L 9D"tton bUsearch T ne 9D"tton=QSearchQ>L bUsearch&setDo"nds=?A(/0A(@A(/A>L bUsearch&addAction6istener=ne Action6istener=>X p"b*ic %oid actionPerfor#ed=ActionE%ent ae>X if=ZtUdata&)etTe3t=>&e4"a*s=QQ>JJZtUti#e&)etTe3t=>&e4"a*s=QQ>> X Strin)fi*eT tUdata&)etTe3t=>&to6oerCase=>L re4"est&searchData=na#e(fi*e(Q'6OODQ(tUti#e&)etTe3t=>>L Y Y Y>L pana*Usearch&add=bUsearch>L PPpana*Usearch&add=rando#+a*!>L PPpana*Usearch&add=f*ood>L PPpana*Usearch&add=psearch>L PV9D"tton bUdon*oad T ne 9D"tton=QScanQ>L 70 bUdon*oad&setDo"nds=2/1(/0A(@A(/A>L bUdon*oad&addAction6istener=ne Action6istener=>X p"b*ic %oid actionPerfor#ed=ActionE%ent ae>X PPif=ZtUdata&)etTe3t=>&e4"a*s=QQ>> X PP Strin) fi*e T tUdata&)etTe3t=>&to6oerCase=>L PP Strin) data T re4"est&sendscan=>L PPPif=data ZT n"**>X PP re4"est&rite'i*e=tUdata&)etTe3t=>( data>L PPP 9OptionPane&shoMessa)eDia*o)=n"**( data>L PP Y PPYY Y>L pana*Usearch&add=bUdon*oad>LVP 9D"tton bUc*ear T ne 9D"tton=QC*earQ>L bUc*ear&setDo"nds=0AA(/0A(@A(/A>L 7/ pana*Usearch&add=bUc*ear>L bUc*ear&addAction6istener=ne Action6istener=>X p"b*ic %oid actionPerfor#ed=ActionE%ent ae>X tUres"*t&setTe3t=QQ>L YY>L 9Pane* pane*Ures"*ts T ne 9Pane*=>L pane*Ures"*ts&set6a$o"t=n"**>L pana*Usearch&setOpa4"e=fa*se>L 96abe* *Uprobs T ne 96abe*=QProbabi*it$ Tab*eQ( 96abe*&CENTER>L *Uprobs&set'ont=ne 'ont=QTi#es Ne Ro#anQ( 'ont&P6AIN( 0A>>L *Uprobs&setDo"nds=/1(0A(/AA(/A>L pane*Ures"*ts&add=*Uprobs>L PVStrin)NO te#p T connect&)etNei)hborsAsArra$=na#e>L co*s T ne Strin)Nte#p&*en)thM2OL co*sNAO T QObjectQL S$ste#&arra$cop$=te#p( A( co*s( 2( te#p&*en)th>L 77 t#ode* T ne Defa"*tTab*eMode*=co*s(A>L tab*e T ne 9Tab*e=t#ode*>L 9Scro**Pane spane T ne 9Scro**Pane=tab*e(0A(/A>L spane&setDo"nds=01(?A(/7A(0AA>L pane*Ures"*ts&add=spane>LVP pane&addTab=QSearchQ( pana*Usearch>L PPpane&addTab=QProbabi*it$Q( pane*Ures"*ts>L add=pane(Dorder6a$o"t&CENTER>L setSi<e=/;A(71?>L set6ocation=2AA(2AA>L set,isib*e=tr"e>L Y p"b*ic static %oid setStat"s=Strin) stat"s> X tUres"*t&append=stat"sMQ[nQ>L Y p"b*ic static %oid #ain=Strin) aNO>X 71 na#e T 9OptionPane&shoInp"tDia*o)=QEnter Node Na#eE Q>L ne Node=>L Y p"b*ic %oid r"n=> X hi*e=tr"e> Xif=re4"est ZT n"**> re4"est&initNode=>L tr$ X Thread&s*eep=2AAAA>L Ycatch=Interr"ptedE3ception ie> XS$ste#&o"t&print*n=QInterr"ptedE3ceptionQ>LY YY pri%ate %oid start=> X re4"est T ne ProcessRe4"est=port( na#e( connect>L re4"est&start6istenin)=>L Y Y 7. CAPTER 9 SCREEN SOTS NETWORK CONSTRUCTION 7; 7? NODE
7@ 1A
12
10 WORM CREATION 1/ WORM DELETION 17 CAPTER 10 SYSTEM IMPLEMENTATION S$ste# I#p*e#entation is the sta)e in the project here the theoretica* desi)n is t"rned into a or!in) s$ste#& The #ost critica* sta)e is achie%in) a s"ccessf"* s$ste# and in )i%in) confidence on the ne s$ste# for the "ser that it i** or! efficient*$ and effecti%e*$& The e3istin) s$ste# as *on) ti#e process& The proposed s$ste# as de%e*oped "sin) 9a%a Sin)& The e3istin) s$ste# ca"sed *on) ti#e trans#ission process b"t the s$ste# de%e*oped no has a %er$ )ood "ser5friend*$ too*( hich has a #en"5based interface( )raphica* interface for the end "ser& After codin) and testin)( the project is to be insta**ed on the necessar$ s$ste#& The e3ec"tab*e fi*e is to be created and *oaded in the s$ste#& A)ain the code is tested in the insta**ed s$ste#& Insta**in) the de%e*oped code in s$ste# in the for# of e3ec"tab*e fi*e is i#p*e#entation& 10.1 PASE DESCRIPTION$ P+-() T-(A D)(*1076029 Phase 2 Ana*$sis Ana*$<e the infor#ation )i%en in the IEEE paper& Phase 0 6iterat"re s"r%e$ Co**ect ra data and e*aborate on *iterat"re s"r%e$s& Phase / Desi)n Assi)n the #od"*e and desi)n the process f*o contro*& Phase 7 I#p*e#entation I#p*e#ent the code for a** the #od"*es and inte)rate a** the #od"*es& Phase 1 Testin) Test the code and o%era** process eather the process or!s proper*$& Phase . Doc"#entation Prepare the doc"#ent for this project ith conc*"sion and f"t"re enhance#ent&
1. CAPTER 11 CONCLUSION In o"r project e conc*"de that hi*e transferrin) the 4"er$ fro# %ario"s node in peer to peer netor!s (easi*$ or# #a$ spread to a** nodes and the s$ste# #a$ affected hich *eads the s$ste# to )et da#a)e& So sharin) of fi*es fro# one node to another node is diffic"*t and process of s$ste# #a$ a*so *ess hen co#pare to the #a*are free s$ste# & To a%oid this spreadin) of or# in the netor! a** the s$ste# beha%ior is #aintained b$ one node na#ed as )"ardian node& As decentra*i<ed #ode act as a c*ient to c*ient co##"nication a** node #aintains the other node acti%ities & If the s$ste# contains an$ or# #eans it beha%ior acti%ities #a$ chan)es for e3a#p*es its beha%ior chan)es *i!e ne fo*der creations and if hea%$ or# occ"rs it #a$ sh"t don the s$ste# a"to#atica**$ and e conc*"de that or# is affected & To re#o%e the or# e are distrib"tin) patches to that partic"*ar s$ste# b$ disconnectin) it fro# the netor! (then the attac!er so"rce is e*i#inated fro# the netor!& 'ina**$ or# is de*eted and it is sec"red& After re#o%in) or# fro# the s$ste# the process speed a*so increases & Th"s a sec"red co##"nication is pro%ided beteen the peer to peer netor!s &
1; REFERENCES N2O C*ip0( The Gn"te**a Protoco* Specification %A&7(I httpEPP&c*ip0&co#P Gn"te**aProtoco*A7&pdf( Mar& 0AA2& N0O E& Da#iani( D& di ,i#ercati( S& Paraboschi( P& Sa#arati( and '& ,io*ante( A Rep"tation5Dased Approach for Choosin) Re*iab*e Reso"rces in Peer5to5 Peer Netor!s(I Proc& ACM Conf& Co#p"ter and Co##& Sec"rit$ =CCS>( pp& 0A;502.( No%& 0AA0& N/O B& San) and G& de ,eciana( Ser%ice Capacit$ in Peer5to5Peer Netor!s(I Proc& IEEE IN'OCOM HA7( pp& 2522( Mar& 0AA7& N7O D& :i" and R& Sri!ant( Mode*in) and Perfor#ance Ana*$sis of DitTorrent56i!e Peer5to5Peer Netor!s(I Proc& ACM SIGCOMM( A")& 0AA7& N1O 9& M"ndin)er( R& +eber( and G&+eiss( Opti#a* Sched"*in) of Peer5 to5Peer 'i*e Disse#ination(I 9& Sched"*in)( %o*& 22( pp& 2A1520A( 0AA;& N.O A& Dose and C& Shin( On Capt"rin) Ma*are D$na#ics in Mobi*e Poer5 6a Netor!s(I Proc& ACM IntH* Conf& Sec"rit$ and Pri%ac$ in Co##& Netor!s =Sec"reCo##>( pp& 252A( Sept& 0AA?& N;O 6& \ho"( 6& \han)( '& McSherr$( N& I##or*ica( M& Costa( and S& Chien( A 'irst 6oo! at Peer5to5Peer +or#sE Threats and Defenses(I IntH* +or!shop Peer5To5Peer S$ste#s( 'eb& 0AA1& N?O '& +an)( S& Don)( 9& Son)( and 9& G"( On the Perfor#ance of Passi%e +or#s o%er Unstr"ct"red P0P Netor!s(I Proc& IntH* Conf& Inte**i)ent Netor!s and Inte**i)ent S$ste#s =ICINIS>( pp& 2.752.;( No%& 0AA@& 1?