本文整理汇总了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))
示例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 ###
示例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
示例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')
示例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
示例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
示例7: createByteArraySequence
# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def createByteArraySequence(seq):
return array.array('B', seq)
示例8: createByteArrayZeros
# 需要导入模块: import jarray [as 别名]
# 或者: from jarray import array [as 别名]
def createByteArrayZeros(howMany):
return array.array('B', [0] * howMany)
示例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
示例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
示例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
示例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
示例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)
示例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)
示例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)))