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


Python Type.typestr方法代碼示例

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


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

示例1: storeRR

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def storeRR(self, u):
        r = {}
        r['name'], r['type'], r['class'], r[
            'ttl'], r['rdlength'] = u.getRRheader()
        r['typename'] = Type.typestr(r['type'])
        r['classstr'] = Class.classstr(r['class'])
        # print 'name=%s, type=%d(%s), class=%d(%s), ttl=%d' \
        #      % (name,
        #        type, typename,
        #        klass, Class.classstr(class),
        #        ttl)
        mname = 'get%sdata' % r['typename']
        if hasattr(u, mname):
            r['data'] = getattr(u, mname)()
        else:
            r['data'] = u.getbytes(r['rdlength'])
        return r 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:19,代碼來源:Lib.py

示例2: storeRR

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def storeRR(self,u):
        r={}
        r['name'],r['type'],r['class'],r['ttl'],r['rdlength'] = u.getRRheader()
        r['typename'] = Type.typestr(r['type'])
        r['classstr'] = Class.classstr(r['class'])
        #print 'name=%s, type=%d(%s), class=%d(%s), ttl=%d' \
        #      % (name,
        #        type, typename,
        #        klass, Class.classstr(class),
        #        ttl)
        mname = 'get%sdata' % r['typename']
        if hasattr(u, mname):
            r['data']=getattr(u, mname)()
        else:
            r['data']=u.getbytes(r['rdlength'])
        return r 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:18,代碼來源:Lib.py

示例3: storeQ

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def storeQ(self, u):
        q = {}
        q['qname'], q['qtype'], q['qclass'] = u.getQuestion()
        q['qtypestr'] = Type.typestr(q['qtype'])
        q['qclassstr'] = Class.classstr(q['qclass'])
        return q 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:8,代碼來源:Lib.py

示例4: dumpQ

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def dumpQ(u):
    qname, qtype, qclass = u.getQuestion()
    print 'qname=%s, qtype=%d(%s), qclass=%d(%s)' \
        % (qname,
           qtype, Type.typestr(qtype),
           qclass, Class.classstr(qclass)) 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:8,代碼來源:Lib.py

示例5: dumpRR

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def dumpRR(u):
    name, type, klass, ttl, rdlength = u.getRRheader()
    typename = Type.typestr(type)
    print 'name=%s, type=%d(%s), class=%d(%s), ttl=%d' \
        % (name,
           type, typename,
           klass, Class.classstr(klass),
           ttl)
    mname = 'get%sdata' % typename
    if hasattr(u, mname):
        print '  formatted rdata:', getattr(u, mname)()
    else:
        print '  binary rdata:', u.getbytes(rdlength) 
開發者ID:Yukinoshita47,項目名稱:Yuki-Chan-The-Auto-Pentest,代碼行數:15,代碼來源:Lib.py

示例6: req

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def req(self,*name,**args):
        " needs a refactoring "
        self.argparse(name,args)
        #if not self.args:
        #    raise ArgumentError, 'reinitialize request before reuse'
        protocol = self.args['protocol']
        self.port = self.args['port']
        self.tid = random.randint(0,65535)
        self.timeout = self.args['timeout'];
        opcode = self.args['opcode']
        rd = self.args['rd']
        server=self.args['server']
        if type(self.args['qtype']) == types.StringType:
            try:
                qtype = getattr(Type, string.upper(self.args['qtype']))
            except AttributeError:
                raise ArgumentError, 'unknown query type'
        else:
            qtype=self.args['qtype']
        if not self.args.has_key('name'):
            print self.args
            raise ArgumentError, 'nothing to lookup'
        qname = self.args['name']
        if qtype == Type.AXFR and protocol != 'tcp':
            print 'Query type AXFR, protocol forced to TCP'
            protocol = 'tcp'
        #print 'QTYPE %d(%s)' % (qtype, Type.typestr(qtype))
        m = Lib.Mpacker()
        # jesus. keywords and default args would be good. TODO.
        m.addHeader(self.tid,
              0, opcode, 0, 0, rd, 0, 0, 0,
              1, 0, 0, 0)
        m.addQuestion(qname, qtype, Class.IN)
        self.request = m.getbuf()
        try:
            if protocol == 'udp':
                self.sendUDPRequest(server)
            else:
                self.sendTCPRequest(server)
        except socket.error, reason:
            raise SocketError, reason 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:43,代碼來源:Base.py

示例7: storeQ

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def storeQ(self,u):
        q={}
        q['qname'], q['qtype'], q['qclass'] = u.getQuestion()
        q['qtypestr']=Type.typestr(q['qtype'])
        q['qclassstr']=Class.classstr(q['qclass'])
        return q 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:8,代碼來源:Lib.py

示例8: dumpQ

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def dumpQ(u):
    qname, qtype, qclass = u.getQuestion()
    print 'qname=%s, qtype=%d(%s), qclass=%d(%s)' \
              % (qname,
                 qtype, Type.typestr(qtype),
                 qclass, Class.classstr(qclass)) 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:8,代碼來源:Lib.py

示例9: dumpRR

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def dumpRR(u):
    name, type, klass, ttl, rdlength = u.getRRheader()
    typename = Type.typestr(type)
    print 'name=%s, type=%d(%s), class=%d(%s), ttl=%d' \
              % (name,
                 type, typename,
                 klass, Class.classstr(klass),
                 ttl)
    mname = 'get%sdata' % typename
    if hasattr(u, mname):
        print '  formatted rdata:', getattr(u, mname)()
    else:
        print '  binary rdata:', u.getbytes(rdlength) 
開發者ID:Flolagale,項目名稱:mailin,代碼行數:15,代碼來源:Lib.py

示例10: req

# 需要導入模塊: import Type [as 別名]
# 或者: from Type import typestr [as 別名]
def req(self, *name, **args):
        " needs a refactoring "
        import time, Lib
        self.argparse(name, args)
        #if not self.args:
        #    raise DNSError,'reinitialize request before reuse'
        protocol = self.args['protocol']
        self.port = self.args['port']
        opcode = self.args['opcode']
        rd = self.args['rd']
        server = self.args['server']
        if type(self.args['qtype']) == types.StringType:
            try:
                qtype = getattr(Type, string.upper(self.args['qtype']))
            except AttributeError:
                raise DNSError, 'unknown query type'
        else:
            qtype = self.args['qtype']
        if not self.args.has_key('name'):
            print self.args
            raise DNSError, 'nothing to lookup'
        qname = self.args['name']
        if qtype == Type.AXFR:
            print 'Query type AXFR, protocol forced to TCP'
            protocol = 'tcp'
        #print 'QTYPE %d(%s)' % (qtype, Type.typestr(qtype))
        m = Lib.Mpacker()
        # jesus. keywords and default args would be good. TODO.
        m.addHeader(0,
              0, opcode, 0, 0, rd, 0, 0, 0,
              1, 0, 0, 0)
        m.addQuestion(qname, qtype, Class.IN)
        self.request = m.getbuf()
        try:
            if protocol == 'udp':
                self.sendUDPRequest(server)
            else:
                self.sendTCPRequest(server)
        except socket.error, reason:
            raise DNSError, reason 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:42,代碼來源:Base.py


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