[TIP] Generating 1024 Macs/vlan(urgent help)
Michael Lausch
mla at lausch.at
Mon Mar 22 01:17:10 PDT 2010
The python program itself contains at least one error:
str(r) does not do hex conversion.
>>> print str(10)
'10'
but it should be '0A'
the % formatting takes care of this
eth=sys.argv[1]
destmac = '00:0D:03:00:00:01'
for lastbyte in range(0, 80):
srcmac = "00:20:11:11:22:%02X" % lastbyte
print srcmac
frame = scapy.Ether(dst=destmac,src=srcmac)/scapy.IP(dst="2.2.2.2",src="2.2.2.1")
scapy.sendp(p,iface=eth)
this works (verifyed with wireshark)
On Mon, 2010-03-22 at 09:21 +0530, Jishnu Banerjee (jbanerje) wrote:
> Hi Folks,
> I am new to this forum and a novice in Python/Scapy.
>
> Can anybody help me out with a script which will generate 1024 MACs/vlan
> spanning over 32 vlans.
>
> I have done this:
> qq
q
> scmac = '00:20:11:11:22:'
> lastbyte = 1
> eth = sys.argv[1]
> destmac = '00:0D:03:00:00:01'
>
> r=0
> while (r<80):
> print 'r='
> print r
> srcmac = scmac + str(r)
> print srcmac
> p =
> (scapy.Ether(dst=destmac,src=srcmac)/scapy.IP(dst="2.2.2.2",src="2.2.2.1
> "))
> scapy.sendp(p,iface=eth)
> r= r+1
>
> It seems to me that my above script is not generating Unique MACs, I am
> yet to capture those packets.
>
> Any help is sppreciated.
>
> Regards,
> Jishnu
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
More information about the testing-in-python
mailing list