当前位置: 首页>>代码示例>>Python>>正文


Python jarray.array方法代码示例

本文整理汇总了Python中jarray.array方法的典型用法代码示例。如果您正苦于以下问题:Python jarray.array方法的具体用法?Python jarray.array怎么用?Python jarray.array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jarray的用法示例。


在下文中一共展示了jarray.array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paint

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def paint(self, g):
        if self.function is None:
            return self.error(g)

        sz = self.size
        xs = range(0, sz.width, 2)

        xscale = 4*pi/sz.width
        xoffset = -2*pi

        yscale = -sz.height/2.
        yoffset = sz.height/2.

        ys = []
        for x in xs:
            x = xscale*x + xoffset
            y = int(yscale*self.function(x)+yoffset)
            ys.append(y)
        g.drawPolyline(array(xs, 'i'), array(ys, 'i'), len(xs)) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:21,代码来源:Graph.py

示例2: connectToJMX

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def connectToJMX(args):
    # Basic JMX connection, always required
    trust_managers = array([TrustAllX509TrustManager()], TrustManager)

    sc = SSLContext.getInstance("SSL")
    sc.init(None, trust_managers, None)
    SSLContext.setDefault(sc)
    jmx_url = JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + args.targetHost + ":" + args.targetPort + "/jmxrmi")
    print "[+] Connecting to: " + str(jmx_url)
    try:
        jmx_connector = JMXConnectorFactory.connect(jmx_url)
        print "[+] Connected: " + str(jmx_connector.getConnectionId())
        bean_server = jmx_connector.getMBeanServerConnection()
        return bean_server
    except IOException:
        print "[-] Error: Can't connect to remote service"
        sys.exit(-1)
##########

### INSTALL MODE ### 
开发者ID:siberas,项目名称:sjet,代码行数:22,代码来源:sjet.py

示例3: _attack

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def _attack(self, basePair, insertionPoint, payloads, taint):
        proto = self._helpers.analyzeRequest(basePair).getUrl().getProtocol() + '://'
        if ('abshost' in payloads):
            payloads['abshost'] = proto + payloads['abshost']
        payloads['referer'] = proto + taint + '/' + self._referer
        print "Host attack: " + str(payloads)
        attack = callbacks.makeHttpRequest(basePair.getHttpService(),
                                           insertionPoint.buildRequest('hosthacker' + pickle.dumps(payloads)))
        response = self._helpers.bytesToString(attack.getResponse())
        requestHighlights = [jarray.array([m.start(), m.end()], 'i') for m in
                             re.finditer('(' + '|'.join(payloads.values()) + ')',
                                         self._helpers.bytesToString(attack.getRequest()))]
        responseHighlights = [jarray.array([m.start(), m.end()], 'i') for m in re.finditer(taint, response)]
        attack = callbacks.applyMarkers(attack, requestHighlights, responseHighlights)
        return (attack, response)


# Take input from HostAttack.doActiveScan() and use it to construct a HTTP request 
开发者ID:silentsignal,项目名称:ActiveScan3Plus,代码行数:20,代码来源:ActiveScan3Plus.py

示例4: prepareScanInsertionOffset

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def prepareScanInsertionOffset(self, request, paramName):
        param = self._helpers.getRequestParameter(request, paramName)
        startOffset = param.getValueStart()
        endOffset = param.getValueEnd()
        return array([startOffset, endOffset], 'i') 
开发者ID:destine21,项目名称:ZIPFileRaider,代码行数:7,代码来源:ZIPFileRaider.py

示例5: _attack

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def _attack(self, basePair, payloads, taint, request_template, referer):
        proto = helpers.analyzeRequest(basePair).getUrl().getProtocol() + '://'
        if 'abshost' in payloads:
            payloads['abshost'] = proto + payloads['abshost']
        payloads['referer'] = proto + taint + '/' + referer

        # Load the supplied payloads into the request
        if 'xfh' in payloads:
            payloads['xfh'] = "\r\nX-Forwarded-Host: " + payloads['xfh']

        for key in ('xfh', 'abshost', 'host', 'referer'):
            if key not in payloads:
                payloads[key] = ''

        # Ensure that the response to our request isn't cached - that could be harmful
        payloads['cachebust'] = str(time.time())

        request = request_template.substitute(payloads)

        attack = callbacks.makeHttpRequest(basePair.getHttpService(), request)

        response = safe_bytes_to_string(attack.getResponse())

        requestHighlights = [jarray.array([m.start(), m.end()], 'i') for m in
                             re.finditer('(' + '|'.join(payloads.values()) + ')',
                                         safe_bytes_to_string(attack.getRequest()))]
        responseHighlights = [jarray.array([m.start(), m.end()], 'i') for m in re.finditer(taint, response)]
        attack = callbacks.applyMarkers(attack, requestHighlights, responseHighlights)
        return attack, response


# Ensure that error pages get passively scanned
# Stacks nicely with the 'Error Message Checks' extension 
开发者ID:albinowax,项目名称:ActiveScanPlusPlus,代码行数:35,代码来源:activeScan++.py

示例6: addURL

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def addURL(self, u):
        """Purpose: Call this with u= URL for
        the new Class/jar to be loaded"""
        sysloader = self.java.lang.ClassLoader.getSystemClassLoader()
        sysclass = self.java.net.URLClassLoader
        method = sysclass.getDeclaredMethod("addURL", [self.java.net.URL])
        a = method.setAccessible(1)
        jar_a = jarray.array([u], self.java.lang.Object)
        b = method.invoke(sysloader, [u])
        return u 
开发者ID:lightbulb-framework,项目名称:lightbulb-framework,代码行数:12,代码来源:MySQLdb.py

示例7: createByteArraySequence

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def createByteArraySequence(seq):
        return array.array('B', seq) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:4,代码来源:compat.py

示例8: createByteArrayZeros

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def createByteArrayZeros(howMany):
        return array.array('B', [0] * howMany) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:4,代码来源:compat.py

示例9: numBits

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def numBits(n):
        if n==0:
            return 0
        n= 1 * n; #convert to long, if it isn't already
        return n.__tojava__(java.math.BigInteger).bitLength()

    #Adjust the string to an array of bytes 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:9,代码来源:compat.py

示例10: getSHA1

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def getSHA1(s):
        #return JCE_SHA1(s)
        return sha.sha(s)


    #Adjust the string to an array of bytes 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:8,代码来源:jython_compat.py

示例11: numBits

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def numBits(n):
        if n==0:
            return 0
        n= 1L * n; #convert to long, if it isn't already
        return n.__tojava__(java.math.BigInteger).bitLength()

    #Adjust the string to an array of bytes 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:9,代码来源:compat.py

示例12: Parse

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def Parse(self, data, isfinal=False):
        # The 'data' argument should be an encoded text: a str instance that
        # represents an array of bytes. If instead it is a unicode string,
        # only the us-ascii range is considered safe enough to be silently
        # converted.
        if isinstance(data, unicode):
            data = data.encode(sys.getdefaultencoding())

        self._data.append(data)

        if isfinal:
            bytes = StringUtil.toBytes(self._data.toString())
            byte_stream = ByteArrayInputStream(bytes)
            source = InputSource(byte_stream)
            if self.encoding is not None:
                source.setEncoding(self.encoding)
            try:
                self._reader.parse(source)
            except SAXParseException, sax_error:
                # Experiments tend to show that the '_Next*' parser locations
                # match more closely expat behavior than the 'Current*' or sax
                # error locations.
                self.ErrorLineNumber = self._NextLineNumber
                self.ErrorColumnNumber = self._NextColumnNumber
                self.ErrorCode = None
                raise self._expat_error(sax_error)
            return 1 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:29,代码来源:expat.py

示例13: inet_ntop

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def inet_ntop(family, packed_ip):
    try:
        jByteArray = jarray.array(packed_ip, 'b')
        if family == AF_INET:
            if len(jByteArray) != 4:
                raise ValueError("invalid length of packed IP address string")
        elif family == AF_INET6:
            if len(jByteArray) != 16:
                raise ValueError("invalid length of packed IP address string")
        else:
            raise ValueError("unknown address family %s" % family)
        ia = java.net.InetAddress.getByAddress(jByteArray)
        return ia.getHostAddress()
    except java.lang.Exception, jlx:
        raise _map_exception(jlx) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:17,代码来源:socket.py

示例14: test_jarray

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def test_jarray(self): # until it is fully formally removed
        # While jarray is still being phased out, just flex the initializers.
        # The rest of the test for array will catch all the big problems.
        import jarray
        from java.lang import String
        jarray.array(range(5), 'i')
        jarray.array([String("a"), String("b"), String("c")], String)
        jarray.zeros(5, 'i')
        jarray.zeros(5, String) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:11,代码来源:test_array_jy.py

示例15: test_java_object_arrays

# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def test_java_object_arrays(self):
        from array import zeros
        from java.lang import String
        from java.lang.reflect import Array
        from java.util import Arrays
        jStringArr = array(String, [String("a"), String("b"), String("c")])
        self.assert_(
            Arrays.equals(jStringArr.typecode, 'java.lang.String'),
               "String array typecode of wrong type, expected %s, found %s" %
               (jStringArr.typecode, str(String)))
        self.assertEqual(zeros(String, 5), Array.newInstance(String, 5))

        import java.lang.String # require for eval to work
        self.assertEqual(jStringArr, eval(str(jStringArr))) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:16,代码来源:test_array_jy.py


注:本文中的jarray.array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。