<s> import hashlib <EOL> from core . packages . clint . textui import colored <EOL> class Javascript : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , link , body , js_hash = None , is_embedded = False ) : <EOL> self . link = link <EOL> self . body = body <EOL> self . is_embedded = is_embedded <EOL> self . js_hash = js_hash <EOL> if self . js_hash is None : <EOL> self . js_hash = hashlib . md5 ( self . body ) . hexdigest ( ) <EOL> self . sources = [ ] <EOL> self . sinks = [ ] <EOL> def addSource ( self , line , pattern ) : <EOL> s = ( line , pattern ) <EOL> self . sources . append ( s ) <EOL> def addSink ( self , line , pattern ) : <EOL> s = ( line , pattern ) <EOL> self . sinks . append ( s ) <EOL> def printResult ( self ) : <EOL> if len ( self . sources ) > <NUM_LIT:0> | len ( self . sinks ) > <NUM_LIT:0> : <EOL> print "<STR_LIT>" % self . link <EOL> if self . is_embedded : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" + colored . green ( "<STR_LIT:%s>" % len ( self . sources ) ) <EOL> for s in self . sources : <EOL> print "<STR_LIT>" % ( s [ <NUM_LIT:0> ] , s [ <NUM_LIT:1> ] ) <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" + colored . green ( "<STR_LIT:%s>" % len ( self . sinks ) ) <EOL> for s in self . sinks : <EOL> print "<STR_LIT>" % ( s [ <NUM_LIT:0> ] , s [ <NUM_LIT:1> ] ) <EOL> print "<STR_LIT>" </s>
