import pyfixbuf # Test that the argument number is correct if (len(sys.argv) != 4): print "Must supply a hostname, port, and transport protocol." print "Usage: sample_net_exporter.py hostname port transport" sys.exit() #create the information model with the standard IPFIX elements infomodel = pyfixbuf.InfoModel() # add YAF's HTTP IPFIX elements for a sub template infomodel.add_element_list(pyfixbuf.YAF_HTTP_LIST) # create the "outer" template tmpl = pyfixbuf.Template(infomodel) # create a template that will be exported in the STML sub_tmpl = pyfixbuf.Template(infomodel) # create a template that will be exported in the STL stl_tmpl = pyfixbuf.Template(infomodel) # add elements we want in our "outer" template export_list = [ pyfixbuf.InfoElementSpec("sourceIPv4Address"), pyfixbuf.InfoElementSpec("destinationIPv4Address"), pyfixbuf.InfoElementSpec("sourceTransportPort"), pyfixbuf.InfoElementSpec("destinationTransportPort"), pyfixbuf.InfoElementSpec("protocolIdentifier"), pyfixbuf.InfoElementSpec("packetTotalCount"),
import sys import pyfixbuf # Test that the argument number is correct if (len(sys.argv) != 3): print "Must supply an IPFIX file to read and to write to." print "Usage: sample_mediator.py infile.ipfix outfile.ipfix" sys.exit() infomodel = pyfixbuf.InfoModel() infomodel.add_element_list(pyfixbuf.YAF_LIST) infomodel.add_element_list(pyfixbuf.YAF_HTTP_LIST) infomodel.add_element_list(pyfixbuf.YAF_DNS_LIST) tmpl = pyfixbuf.Template(infomodel) statstmpl = pyfixbuf.Template(infomodel) exportertmpl = pyfixbuf.Template(infomodel) data_list = [ pyfixbuf.InfoElementSpec("flowStartMilliseconds"), pyfixbuf.InfoElementSpec("flowEndMilliseconds"), pyfixbuf.InfoElementSpec("octetTotalCount"), pyfixbuf.InfoElementSpec("reverseOctetTotalCount"), pyfixbuf.InfoElementSpec("packetTotalCount"), pyfixbuf.InfoElementSpec("reversePacketTotalCount"), pyfixbuf.InfoElementSpec("sourceIPv4Address"), pyfixbuf.InfoElementSpec("destinationIPv4Address"), pyfixbuf.InfoElementSpec("sourceTransportPort"),
sys.exit() # Create an InfoModel infomodel = p.InfoModel() # Add basic YAF & stats elements to the infomodel infomodel.add_element_list(p.YAF_LIST) infomodel.add_element_list(p.YAF_STATS_LIST) infomodel.add_element_list(p.YAF_DNS_LIST) infomodel.add_element_list(p.YAF_HTTP_LIST) # Create a Template tmpl = p.Template(infomodel) # Create a Stats Template stats_tmpl = p.Template(infomodel) # Add some elements to the data template data_list = [ p.InfoElementSpec("flowStartMilliseconds"), p.InfoElementSpec("flowEndMilliseconds"), p.InfoElementSpec("octetTotalCount"), p.InfoElementSpec("reverseOctetTotalCount"), p.InfoElementSpec("packetTotalCount"), p.InfoElementSpec("reversePacketTotalCount"), p.InfoElementSpec("sourceIPv4Address"),
import pyfixbuf if (len(sys.argv) < 4): print "Usage: sample_listener.py hostname port transport [out_file]." print "This script runs forever" sys.exit() #create the information model with the standard IPFIX elements infomodel = pyfixbuf.InfoModel() # add YAF's HTTP IPFIX elements for a sub template infomodel.add_element_list(pyfixbuf.YAF_LIST) infomodel.add_element_list(pyfixbuf.YAF_HTTP_LIST) infomodel.add_element_list(pyfixbuf.YAF_DNS_LIST) infomodel.add_element_list(pyfixbuf.YAF_FLOW_STATS_LIST) tmpl = pyfixbuf.Template(infomodel) data_list = data_list = [pyfixbuf.InfoElementSpec("flowStartMilliseconds"), pyfixbuf.InfoElementSpec("flowEndMilliseconds"), pyfixbuf.InfoElementSpec("octetTotalCount"), pyfixbuf.InfoElementSpec("reverseOctetTotalCount"), pyfixbuf.InfoElementSpec("packetTotalCount"), pyfixbuf.InfoElementSpec("reversePacketTotalCount"), pyfixbuf.InfoElementSpec("sourceIPv4Address"), pyfixbuf.InfoElementSpec("destinationIPv4Address"), pyfixbuf.InfoElementSpec("sourceTransportPort"), pyfixbuf.InfoElementSpec("destinationTransportPort"), pyfixbuf.InfoElementSpec("protocolIdentifier"), pyfixbuf.InfoElementSpec("subTemplateMultiList")] tmpl.add_spec_list(data_list)
import sys import pyfixbuf # Test that the argument number is correct if (len(sys.argv) != 3): print "Must supply an IPFIX file to read and text file to write to." sys.exit() #create the information model with the standard IPFIX elements infomodel = pyfixbuf.InfoModel() # add YAF's HTTP IPFIX elements for a sub template infomodel.add_element_list(pyfixbuf.YAF_HTTP_LIST) # create the "outer" template tmpl = pyfixbuf.Template(infomodel) # add elements we want in our "outer" template import_list = [ pyfixbuf.InfoElementSpec("flowStartMilliseconds"), pyfixbuf.InfoElementSpec("packetTotalCount"), pyfixbuf.InfoElementSpec("reversePacketTotalCount"), pyfixbuf.InfoElementSpec("sourceIPv4Address"), pyfixbuf.InfoElementSpec("destinationIPv4Address"), pyfixbuf.InfoElementSpec("sourceTransportPort"), pyfixbuf.InfoElementSpec("destinationTransportPort"), pyfixbuf.InfoElementSpec("protocolIdentifier"), pyfixbuf.InfoElementSpec("subTemplateMultiList") ] # add elements to template
sys.exit() # Create an InfoModel infomodel = pyfixbuf.InfoModel() # Add basic YAF & stats elements to the infomodel infomodel.add_element_list(pyfixbuf.YAF_LIST) infomodel.add_element_list(pyfixbuf.YAF_STATS_LIST) infomodel.add_element_list(pyfixbuf.YAF_DNS_LIST) infomodel.add_element_list(pyfixbuf.YAF_HTTP_LIST) # Create a Template tmpl = pyfixbuf.Template(infomodel) # Create a Stats Template stats_tmpl = pyfixbuf.Template(infomodel) # Add some elements to the data template data_list = [pyfixbuf.InfoElementSpec("flowStartMilliseconds"), pyfixbuf.InfoElementSpec("flowEndMilliseconds"), pyfixbuf.InfoElementSpec("octetTotalCount"), pyfixbuf.InfoElementSpec("reverseOctetTotalCount"), pyfixbuf.InfoElementSpec("packetTotalCount"), pyfixbuf.InfoElementSpec("reversePacketTotalCount"), pyfixbuf.InfoElementSpec("sourceIPv4Address"), pyfixbuf.InfoElementSpec("destinationIPv4Address"),