コード例 #1
0
ファイル: dhcpv6.py プロジェクト: farikonsec/veripy
    def build_dhcpv6_reply(self,
                           q,
                           server,
                           client,
                           ias=True,
                           T1=300,
                           T2=300,
                           trid=None,
                           dns_servers=[],
                           dns_domains=[],
                           pref=True,
                           server_id=True):
        p = DHCP6_Reply(trid=(trid == None and q.trid or trid))/ \
                DHCP6OptClientId(duid=q[DHCP6OptClientId].duid)

        if server_id:
            p = p / DHCP6OptServerId(
                duid=builder.duid(server.iface(0).ll_addr))

        if ias:
            for ia in builder.ias(q[DHCP6OptIA_NA], client, T1, T2):
                p = p / ia

        if len(dns_servers) > 0:
            p = p / DHCP6OptDNSServers(dnsservers=dns_servers)

        if len(dns_domains) > 0:
            p = p / DHCP6OptDNSDomains(dnsdomains=dns_domains)

        if pref:
            p = p / DHCP6OptPref()

        return p
コード例 #2
0
ファイル: dhcpv6.py プロジェクト: bobdoah/veripy
    def build_dhcpv6_advertisement(self, s, server, client, options=True, ias=True, T1=300, T2=300):
        a = DHCP6_Advertise(trid=s.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)
        if options:
            for option in builder.options(s[DHCP6OptOptReq].reqopts):
                a = a/option
        if ias:
            for ia in builder.ias(s[DHCP6OptIA_NA], client, T1, T2):
                a = a/ia
        a = a/DHCP6OptPref()

        return a
コード例 #3
0
ファイル: dhcpv6.py プロジェクト: farikonsec/veripy
    def build_dhcpv6_advertisement(self,
                                   s,
                                   server,
                                   client,
                                   options=True,
                                   ias=True,
                                   T1=300,
                                   T2=300):
        a = DHCP6_Advertise(trid=s.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)
        if options:
            for option in builder.options(s[DHCP6OptOptReq].reqopts):
                a = a / option
        if ias:
            for ia in builder.ias(s[DHCP6OptIA_NA], client, T1, T2):
                a = a / ia
        a = a / DHCP6OptPref()

        return a
コード例 #4
0
ファイル: dhcpv6.py プロジェクト: bobdoah/veripy
    def build_dhcpv6_reply(self, q, server, client, ias=True, T1=300, T2=300, trid=None, dns_servers=[], dns_domains=[], pref=True, server_id=True):
        p = DHCP6_Reply(trid=(trid == None and q.trid or trid))/ \
                DHCP6OptClientId(duid=q[DHCP6OptClientId].duid)

        if server_id:
            p = p/DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))

        if ias:
            for ia in builder.ias(q[DHCP6OptIA_NA], client, T1, T2):
                p = p/ia

        if len(dns_servers) > 0:
            p = p/DHCP6OptDNSServers(dnsservers=dns_servers)

        if len(dns_domains) > 0:
            p = p/DHCP6OptDNSDomains(dnsdomains=dns_domains)

        if pref:
            p = p/DHCP6OptPref()

        return p