14 from optparse import OptionParser
17 parser = OptionParser()
19 """ Action options """
20 parser.add_option("-L", "--listen", action="store_true",dest="listen", help="",default="False")
21 parser.add_option("-E", "--emit", action="store_true",dest="emit", help="", default="False")
22 parser.add_option("-R", "--readable-conversion", action="store_true",dest="readable", help="", default="False")
23 parser.add_option("-B", "--binary-conversion", action="store_true",dest="binary", help="", default="False")
26 parser.add_option("-s", "--source-file", action="store",dest="source", help="", default="False", type="string")
27 parser.add_option("-d", "--destination-file", action="store",dest="destination", help="", default="False", type="string")
31 (options, args) = parser.parse_args()
39 for Action in (options.listen,options.emit,options.readable,options.binary) :
40 if Action == True : ActionSum += 1
42 print "Command line error : [-L -E -R -B] Only one of these actions can be taken."
45 if options.readable == True : r_conversion()
52 def emit(address,port) :
56 rawdata = rawdata = sys.stdin.read()
57 while ( len(rawdata)>0 ) :
58 readdata = dhcp_packet.DhcpPacket()
59 readdata.DecodePacket(rawdata)
60 readdata.PrintHeaders()
61 readdata.PrintOptions()
62 rawdata = rawdata = sys.stdin.read()