示例#1
0
for d in dump_list:
    print "\n  Obradjujem datoteku " + file_list[file_list_brojac] + "\n"
    file_list_brojac = file_list_brojac + 1

    for mrth, bgph, bgpm in d:

        as_temp = []  #lista AS-ova u pojedinom Update-u
        index = -1
        for el in bgpm.data.attributes:  #od svih atributa u pojedinom updateu
            if el.type == 2:  # type=2 znaci da je atribut AS path
                as_double = 0
                for seg in el.data.segments:
                    for AS in seg.path:
                        if (as_double != int(AS)):
                            as_temp.append(
                                klase.As(int(AS))
                            )  #u listu AS-ova upisuju se instance klase As
                            as_double = int(AS)

        if bgpm.data.announced:

            for ek in bgpm.data.announced:  #gledamo sve prefikse iz tog Update-a
                #temp= socket.inet_ntoa(ek.prefix)+"/"+str(ek.len)
                index = klase.ReturnIndexAnn(lista_ann, ek.prefix, ek.len)

                #prvo dodajemo na kraj liste novu instancu objavljenog prefiksa Ann_Prefix

                if index == -1:

                    lista_ann.append(
                        klase.Ann_Prefix(
示例#2
0
    d = BGPDump((dircur + "/dumpovi/" + sys.argv[1]))
else:
    d = BGPDump((dircur + '/dumpovi/proba'))

lista_ann = []

for mrth, bgph, bgpm in d:

    y = []
    for el in bgpm.data.attributes:  #od svih atributa u pojedinom updateu
        if el.type == 2:  # type=2 znaci da je atribut AS path
            as_double = 0
            for seg in el.data.segments:
                for AS in seg.path:
                    if (as_double != AS):
                        y.append(klase.As(AS))
                        as_double = AS

    if bgpm.data.announced:

        for ek in bgpm.data.announced:

            lista_ann.append(
                klase.Ann_Prefix(
                    socket.inet_ntoa(ek.prefix), ek.len, mrth.ts, y,
                    socket.inet_ntoa(struct.pack('>L', bgph.src_ip))))

brojac = 0

for elem in lista_ann: