Python error.Scapy_Exception() Examples

The following are 30 code examples of error.Scapy_Exception(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module error , or try the search function .
Example #1
Source File: route.py    From dash-hack with MIT License 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #2
Source File: utils.py    From smod-1 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, filename):
        self.filename = filename
        try:
            self.f = gzip.open(filename,"rb")
            magic = self.f.read(4)
        except IOError:
            self.f = open(filename,"rb")
            magic = self.f.read(4)
        if magic == "\xa1\xb2\xc3\xd4": #big endian
            self.endian = ">"
        elif  magic == "\xd4\xc3\xb2\xa1": #little endian
            self.endian = "<"
        else:
            raise Scapy_Exception("Not a pcap capture file (bad magic)")
        hdr = self.f.read(20)
        if len(hdr)<20:
            raise Scapy_Exception("Invalid pcap file (too short)")
        vermaj,vermin,tz,sig,snaplen,linktype = struct.unpack(self.endian+"HHIIII",hdr)

        self.linktype = linktype 
Example #3
Source File: route.py    From smod-1 with GNU General Public License v2.0 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #4
Source File: route.py    From POC-EXP with GNU General Public License v3.0 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #5
Source File: utils.py    From POC-EXP with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, filename):
        self.filename = filename
        try:
            self.f = gzip.open(filename,"rb")
            magic = self.f.read(4)
        except IOError:
            self.f = open(filename,"rb")
            magic = self.f.read(4)
        if magic == "\xa1\xb2\xc3\xd4": #big endian
            self.endian = ">"
        elif  magic == "\xd4\xc3\xb2\xa1": #little endian
            self.endian = "<"
        else:
            raise Scapy_Exception("Not a pcap capture file (bad magic)")
        hdr = self.f.read(20)
        if len(hdr)<20:
            raise Scapy_Exception("Invalid pcap file (too short)")
        vermaj,vermin,tz,sig,snaplen,linktype = struct.unpack(self.endian+"HHIIII",hdr)

        self.linktype = linktype 
Example #6
Source File: utils.py    From dash-hack with MIT License 6 votes vote down vote up
def __init__(self, filename):
        self.filename = filename
        try:
            self.f = gzip.open(filename,"rb")
            magic = self.f.read(4)
        except IOError:
            self.f = open(filename,"rb")
            magic = self.f.read(4)
        if magic == "\xa1\xb2\xc3\xd4": #big endian
            self.endian = ">"
        elif  magic == "\xd4\xc3\xb2\xa1": #little endian
            self.endian = "<"
        else:
            raise Scapy_Exception("Not a pcap capture file (bad magic)")
        hdr = self.f.read(20)
        if len(hdr)<20:
            raise Scapy_Exception("Invalid pcap file (too short)")
        vermaj,vermin,tz,sig,snaplen,linktype = struct.unpack(self.endian+"HHIIII",hdr)

        self.linktype = linktype 
Example #7
Source File: route.py    From CVE-2016-6366 with MIT License 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #8
Source File: route.py    From CyberScan with GNU General Public License v3.0 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #9
Source File: route.py    From dash-hack with MIT License 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #10
Source File: route.py    From isip with MIT License 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #11
Source File: route.py    From mptcp-abuse with GNU General Public License v2.0 6 votes vote down vote up
def make_route(self, host=None, net=None, gw=None, dev=None):
        if host is not None:
            thenet,msk = host,32
        elif net is not None:
            thenet,msk = net.split("/")
            msk = int(msk)
        else:
            raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
        if gw is None:
            gw="0.0.0.0"
        if dev is None:
            if gw:
                nhop = gw
            else:
                nhop = thenet
            dev,ifaddr,x = self.route(nhop)
        else:
            ifaddr = get_if_addr(dev)
        return (atol(thenet), itom(msk), gw, dev, ifaddr) 
Example #12
Source File: utils.py    From dash-hack with MIT License 6 votes vote down vote up
def __init__(self, filename):
        self.filename = filename
        try:
            self.f = gzip.open(filename,"rb")
            magic = self.f.read(4)
        except IOError:
            self.f = open(filename,"rb")
            magic = self.f.read(4)
        if magic == "\xa1\xb2\xc3\xd4": #big endian
            self.endian = ">"
        elif  magic == "\xd4\xc3\xb2\xa1": #little endian
            self.endian = "<"
        else:
            raise Scapy_Exception("Not a pcap capture file (bad magic)")
        hdr = self.f.read(20)
        if len(hdr)<20:
            raise Scapy_Exception("Invalid pcap file (too short)")
        vermaj,vermin,tz,sig,snaplen,linktype = struct.unpack(self.endian+"HHIIII",hdr)

        self.linktype = linktype 
Example #13
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #14
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance") 
Example #15
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #16
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance") 
Example #17
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #18
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #19
Source File: packet.py    From isip with MIT License 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance") 
Example #20
Source File: packet.py    From isip with MIT License 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #21
Source File: packet.py    From isip with MIT License 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #22
Source File: packet.py    From POC-EXP with GNU General Public License v3.0 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance") 
Example #23
Source File: packet.py    From POC-EXP with GNU General Public License v3.0 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #24
Source File: packet.py    From POC-EXP with GNU General Public License v3.0 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #25
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance") 
Example #26
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #27
Source File: packet.py    From dash-hack with MIT License 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #28
Source File: packet.py    From mptcp-abuse with GNU General Public License v2.0 5 votes vote down vote up
def sprintf(self, fmt, relax):
        if relax:
            return "??"
        else:
            raise Scapy_Exception("Format not found [%s]"%fmt) 
Example #29
Source File: packet.py    From mptcp-abuse with GNU General Public License v2.0 5 votes vote down vote up
def fragment(self, *args, **kargs):
        raise Scapy_Exception("cannot fragment this packet") 
Example #30
Source File: packet.py    From mptcp-abuse with GNU General Public License v2.0 5 votes vote down vote up
def add_payload(self, payload):
        raise Scapy_Exception("Can't add payload to NoPayload instance")