<s> import socket <EOL> import time <EOL> import datetime <EOL> import sys <EOL> import os <EOL> import winsound <EOL> import subprocess <EOL> debug = <NUM_LIT:0> <EOL> waittime = <NUM_LIT> * <NUM_LIT> <EOL> def dns_lookup ( address ) : <EOL> subprocess . call ( "<STR_LIT>" , stdout = False , stderr = False ) <EOL> query = socket . getaddrinfo ( address , <NUM_LIT> ) <EOL> query = "<STR_LIT:.>" . join ( [ str ( x ) for x in query ] ) <EOL> query = query . split ( "<STR_LIT:'>" ) [ <NUM_LIT:3> ] <EOL> print address , "<STR_LIT:->" , query <EOL> date = datetime . datetime . now ( ) . strftime ( "<STR_LIT>" ) <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> FILE = open ( "<STR_LIT>" , "<STR_LIT:r>" ) <EOL> entries = FILE . readlines ( ) <EOL> FILE . close ( ) <EOL> lastentry = entries [ - <NUM_LIT:1> ] . split ( "<STR_LIT:|>" ) [ <NUM_LIT:1> ] <EOL> if debug : <EOL> print query . strip , lastentry <EOL> print address . strip ( ) . lower ( ) , entries [ - <NUM_LIT:1> ] . split ( "<STR_LIT:|>" ) [ <NUM_LIT:0> ] . strip ( ) . lower ( ) <EOL> if ( address . strip ( ) . lower ( ) == entries [ - <NUM_LIT:1> ] . split ( "<STR_LIT:|>" ) [ <NUM_LIT:0> ] . strip ( ) . lower ( ) ) : <EOL> if query . strip ( ) != lastentry . strip ( ) : <EOL> print "<STR_LIT>" % ( lastentry . strip ( ) , query ) <EOL> winsound . PlaySound ( "<STR_LIT>" , winsound . SND_ALIAS ) <EOL> line = address + "<STR_LIT:|>" + query + "<STR_LIT:|>" + date + "<STR_LIT:\n>" <EOL> FILE = open ( "<STR_LIT>" , "<STR_LIT:a>" ) <EOL> FILE . writelines ( line ) <EOL> FILE . close ( ) <EOL> else : <EOL> line = address + "<STR_LIT:|>" + query + "<STR_LIT:|>" + date + "<STR_LIT:\n>" <EOL> FILE = open ( "<STR_LIT>" , "<STR_LIT:w>" ) <EOL> FILE . writelines ( line ) <EOL> FILE . close ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if sys . platform == '<STR_LIT>' or sys . platform == '<STR_LIT>' : <EOL> os . system ( "<STR_LIT>" ) <EOL> elif sys . platform == '<STR_LIT:win32>' : <EOL> os . system ( "<STR_LIT>" ) <EOL> else : <EOL> os . system ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> print u"<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> if debug : <EOL> print len ( sys . argv ) <EOL> if len ( sys . argv ) < <NUM_LIT:2> : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> if len ( sys . argv ) > <NUM_LIT:2> : <EOL> waittime = int ( sys . argv [ <NUM_LIT:2> ] ) * <NUM_LIT> <EOL> try : <EOL> while ( <NUM_LIT:1> ) : <EOL> dns_lookup ( sys . argv [ <NUM_LIT:1> ] ) <EOL> time . sleep ( waittime ) <EOL> except KeyboardInterrupt : <EOL> print "<STR_LIT>" </s>
