logo       

Net class and domain names: msg#00005

security.scapy.general

Subject: Net class and domain names

Hi,

The following code is producin errors:

>>> t=Ether()/IP(dst='www.kame.net'); t.display()
---[ Ethernet ]---
WARNING: more Dest mac not calculated if more than 1 dest IP (<Net www.kame.net>)
dst = None
src = None
<cut>

Whereas t=Ether()/IP(dst='203.178.141.194'); t.display() work as expected (i.e. MAC addesses are filled).

The problem sits in SourceMACField and DestMACField classes when testing if dstip is an instance of Gen. One more test should be added to take care of domain names. The following patch fix the problem and allows the following output:

>>> t=Ether()/IP(dst='www.kame.net'); t.display()
---[ Ethernet ]---
dst = 00:03:47:10:fc:3c
src = 00:11:43:cd:3b:1c
<cut>

Guillaume


--- scapy.py 2005-09-21 00:49:51.000000000 +0900
+++ scapy-name.py 2005-10-06 16:07:09.957206384 +0900
@@ -2475,8 +2475,12 @@
elif isinstance(pkt.payload, ARP):
dstip = pkt.payload.pdst
if isinstance(dstip, Gen):
- warning("Dest mac not calculated if more than 1 dest IP (%s)"%repr(dstip))
- return None
+ l = list(dstip.__iter__())
+ if len(l) == 1:
+ dstip = l[0]
+ else:
+ warning("Dest mac not calculated if more than 1 dest IP (%s)"%repr(dstip))
+ return None
x = "ff:ff:ff:ff:ff:ff"
if dstip is not None:
m=getmacbyip(dstip)
@@ -2499,8 +2503,12 @@
elif isinstance(pkt.payload, ARP):
dstip = pkt.payload.pdst
if isinstance(dstip, Gen):
- warning("Source mac not calculated if more than 1 dest IP (%s)"%repr(dstip))
- return None
+ l = list(dstip.__iter__())
+ if len(l) == 1:
+ dstip = l[0]
+ else:
+ warning("Dest mac not calculated if more than 1 dest IP (%s)"%repr(dstip))
+ return None
x = "00:00:00:00:00:00"
if dstip is not None:
iff,a,gw = conf.route.route(dstip)


---------------------------------------------------------------------
Desinscription: envoyez un message a: scapy.ml-unsubscribe@xxxxxxxxxx
Pour obtenir de l'aide, ecrivez a: scapy.ml-help@xxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise