phaethon / kamene

Network packet and pcap file crafting/sniffing/manipulation/visualization security tool. Originally forked from scapy in 2015 and providing python3 compatibility since then.
GNU General Public License v2.0
868 stars 191 forks source link

getmacbyip6 final cases are broken #235

Closed dkg closed 6 years ago

dkg commented 6 years ago

in scapy/layers/inet6.py, the function getmacbyip6() ends with the following:

    res = neighsol(ip6, a, iff, chainCC=chainCC)

    if res is not None:
        if ICMPv6NDOptDstLLAddr in res:
            mac = res[ICMPv6NDOptDstLLAddr].lladdr
    else:
        mac = res.src
        conf.netcache.in6_neighbor[ip6] = mac
        return mac

    return None

This doesn't make sense. in the stanza following if statement, mac is set but never used (and None is returned). In the else stanza -- where res must be None -- it references a subfield of res , which is guaranteed to fail.

gpotter2 commented 6 years ago

Hi ! This bug is fixed on the official scapy repo (secdev/scapy), which now supports Python 3. I recommend you to have a look https://github.com/secdev/scapy

Good day

gpotter2 commented 6 years ago

@GhostOfGoes To avoid "confuse emojis", I'll provide the proof.

Here's current secdev/scapy implementation of the getmacbyip6 function: https://github.com/secdev/scapy/blob/0aeb049606bee9335e62afea58479915bd6e2344/scapy/layers/inet6.py#L116-L155

    res = neighsol(ip6, a, iff, chainCC=chainCC)

    if res is not None:
        if ICMPv6NDOptDstLLAddr in res:
            mac = res[ICMPv6NDOptDstLLAddr].lladdr
        else:
            mac = res.src
        conf.netcache.in6_neighbor[ip6] = mac
        return mac

    return None

What I'm saying is only the truth: this has INDEED been fixed on the main branch. Now please either contribute to scapy3k, or let me point out to users how outdated this fork is.

GhostofGoes commented 6 years ago

Thanks for clearing that up, and the link to the fix is appreciated. 😄

I just wasn't sure if the specific issues raised here were fixed in mainline scapy, due to the same message being used across issues.

gpotter2 commented 6 years ago

Thanks for clarifying :)

phaethon commented 6 years ago

Issue fixed in the latest commit.

gpotter2 commented 6 years ago

@phaethon Good luck