當前位置: 首頁>>代碼示例>>Python>>正文


Python conf.raw_layer方法代碼示例

本文整理匯總了Python中config.conf.raw_layer方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.raw_layer方法的具體用法?Python conf.raw_layer怎麽用?Python conf.raw_layer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在config.conf的用法示例。


在下文中一共展示了conf.raw_layer方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: read_packet

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def read_packet(self, size=MTU):
        rp = RawPcapReader.read_packet(self,size)
        if rp is None:
            return None
        s,(sec,usec,wirelen) = rp
        
        try:
            p = self.LLcls(s)
        except KeyboardInterrupt:
            raise
        except:
            if conf.debug_dissector:
                raise
            p = conf.raw_layer(s)
        p.time = sec+0.000001*usec
        return p 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:18,代碼來源:utils.py

示例2: add_payload

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def add_payload(self, payload):
        if payload is None:
            return
        elif not isinstance(self.payload, NoPayload):
            self.payload.add_payload(payload)
        else:
            if isinstance(payload, Packet):
                self.__dict__["payload"] = payload
                payload.add_underlayer(self)
                for t in self.aliastypes:
                    if payload.overload_fields.has_key(t):
                        self.overloaded_fields = payload.overload_fields[t]
                        break
            elif type(payload) is str:
                self.__dict__["payload"] = conf.raw_layer(load=payload)
            else:
                raise TypeError("payload must be either 'Packet' or 'str', not [%s]" % repr(payload)) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:19,代碼來源:packet.py

示例3: do_dissect_payload

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def do_dissect_payload(self, s):
        if s:
            cls = self.guess_payload_class(s)
            try:
                p = cls(s, _internal=1, _underlayer=self)
            except KeyboardInterrupt:
                raise
            except:
                if conf.debug_dissector:
                    if isinstance(cls,type) and issubclass(cls,Packet):
                        log_runtime.error("%s dissector failed" % cls.name)
                    else:
                        log_runtime.error("%s.guess_payload_class() returned [%s]" % (self.__class__.__name__,repr(cls)))
                    if cls is not None:
                        raise
                p = conf.raw_layer(s, _internal=1, _underlayer=self)
            self.add_payload(p) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:19,代碼來源:packet.py

示例4: hexraw

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def hexraw(self, lfilter=None):
        """Same as nsummary(), except that if a packet has a Raw layer, it will be hexdumped
        lfilter: a truth function that decides whether a packet must be displayed"""
        for i in range(len(self.res)):
            p = self._elt2pkt(self.res[i])
            if lfilter is not None and not lfilter(p):
                continue
            print "%s %s %s" % (conf.color_theme.id(i,fmt="%04i"),
                                p.sprintf("%.time%"),
                                self._elt2sum(self.res[i]))
            if p.haslayer(conf.raw_layer):
                hexdump(p.getlayer(conf.raw_layer).load) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:14,代碼來源:plist.py

示例5: getfield

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def getfield(self, pkt, s):
        l = self.length_from(pkt)
        try:
            i = self.m2i(pkt, s[:l])
        except Exception:
            if conf.debug_dissector:
                raise
            i = conf.raw_layer(load=s[:l])
        return s[l:],i 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:11,代碼來源:fields.py

示例6: recv

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def recv(self, x=MTU):
        return conf.raw_layer(self.ins.recv(x)) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:4,代碼來源:supersocket.py

示例7: __init__

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def __init__(self, sock, basecls=None):
        if basecls is None:
            basecls = conf.raw_layer
        SimpleSocket.__init__(self, sock)
        self.basecls = basecls 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:7,代碼來源:supersocket.py

示例8: __div__

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def __div__(self, other):
        if isinstance(other, Packet):
            cloneA = self.copy()
            cloneB = other.copy()
            cloneA.add_payload(cloneB)
            return cloneA
        elif type(other) is str:
            return self/conf.raw_layer(load=other)
        else:
            return other.__rdiv__(self) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:12,代碼來源:packet.py

示例9: __rdiv__

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def __rdiv__(self, other):
        if type(other) is str:
            return conf.raw_layer(load=other)/self
        else:
            raise TypeError 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:7,代碼來源:packet.py

示例10: __gen_send

# 需要導入模塊: from config import conf [as 別名]
# 或者: from config.conf import raw_layer [as 別名]
def __gen_send(s, x, inter=0, loop=0, count=None, verbose=None, realtime=None, *args, **kargs):
    if type(x) is str:
        x = conf.raw_layer(load=x)
    if not isinstance(x, Gen):
        x = SetGen(x)
    if verbose is None:
        verbose = conf.verb
    n = 0
    if count is not None:
        loop = -count
    elif not loop:
        loop=-1
    try:
        while loop:
            dt0 = None
            for p in x:
                if realtime:
                    ct = time.time()
                    if dt0:
                        st = dt0+p.time-ct
                        if st > 0:
                            time.sleep(st)
                    else:
                        dt0 = ct-p.time 
                s.send(p)
                n += 1
                if verbose:
                    os.write(1,".")
                time.sleep(inter)
            if loop < 0:
                loop += 1
    except KeyboardInterrupt:
        pass
    s.close()
    if verbose:
        print "\nSent %i packets." % n 
開發者ID:theralfbrown,項目名稱:smod-1,代碼行數:38,代碼來源:sendrecv.py


注:本文中的config.conf.raw_layer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。