Jordan, Thinker, Steven,
Thanks for your responses. Makes more sense now! I can run my program from the
console.
I added the self parameter to the the chassis_id function, however I now have a
problem and question regarding encoding MAC addresses for a struct. What string
format am I supposed to use?
Also, I think I will get rid of Scapy in my small program. Any references I can
use to easily send (no need to receive) a packet with a Layer 1 and 2 only?
(i.e. only Ethernet and LLDP - no need for IP, UDP, TCP etc. I wish to create
something like Ethernet | LLDP msg1 | LLDP msg2 | ... | LLDP msgn)
Thanks!
This is what I got now:
#!/usr/bin/python
import scapy
import struct
class lldp_class:
def __init__(self):
self.chassis_id_tlv = None
def chassis_id(self, subtype, chassis_info):
if subtype == 4:
chassis_data = struct.pack("!B",chassis_info)
subtype_data = struct.pack("!B",subtype)
self.chassis_id_tlv = subtype_data + chassis_data
def __main__():
p = lldp_class()
p.chassis_id(4, "01:80:C2:00:00:0E")
payload = p.chassis_id_tlv
ether = scapy.Ether(dst="01:02:03:04:05:06")
fullpayload = ether + payload
sendp(fullpayload)
__main__()
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
--
http://mail.python.org/mailman/listinfo/python-list