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


Python string.atol方法代码示例

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


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

示例1: addr

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def addr (self, mytab):
	        l = []
		for i in mytab :
	                l.append(str(hex(ord(i))))

		if(len(l) > 0) :
			l.reverse()
			var = l.pop(0)
			for i in l : 
				if(len(i) == 3) :
					if(i == "0x0") :
						i = i + "0"
		 			else :
						i = i[:2] + "0" + i[2]

				var = var + i[2:]
        
			#print "VAR %s" % var
   			addresse = string.atol(var, 16)
      		else :
			addresse = 0 

      		return (addresse) 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:25,代码来源:opcodes.py

示例2: test_atol

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def test_atol(self):
        self.assertEqual(string.atol("  1  "), 1L)
        self.assertRaises(ValueError, string.atol, "  1x ")
        self.assertRaises(ValueError, string.atol, "  x1 ") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_string.py

示例3: checkFingerprints

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def checkFingerprints(self, fd) :
		syscalls_hijack = []
		end = 0
		self.getSyscalls()
		self.getOpcodes()
			
		i = fd.readline()
		liste = i.split()
		while(liste != [] and end == 0):
			if(liste[0] != '#') :
				self.syscalls_fingerprints.map_syscalls[int(liste[0])] = [string.atol(liste[1], 16), liste[3] + " " + liste[4]]
			else :
				if(len(liste) > 1) :
					if(liste[1] == "END"):
						end = -1

			i = fd.readline()
			liste = i.split()

		print "++ Checking Syscalls Fingerprints !!!"
		for i in self.lists_syscalls:
			if((self.syscalls_fingerprints.map_syscalls[i[0]][0] != self.syscalls_mem.map_syscalls[i[0]][0]) or (self.syscalls_fingerprints.map_syscalls[i[0]][1] != self.syscalls_mem.map_syscalls[i[0]][1])):
				syscalls_hijack.append([i[0], i[1]])
	
		if(syscalls_hijack != []):
			print "\t** LISTS OF SYSCALLS HIJACK !!"
			for i in syscalls_hijack:
				print "\t\t** %d\t %-15s" %(i[0], i[1])

			print "\n\t** PLEASE REINSTALL YOUR SYSTEM NOW !!!"

		else:
			print "\t** NO SYSCALLS HIJACK" 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:35,代码来源:syscalls.py

示例4: _iphexatodec

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def _iphexatodec(self, iphexa) :
		ipdec=""

		for i in range(0, 8, 2) :
			ipdec = "%d" % string.atol(iphexa[i:i+2], 16) + "." + ipdec
		
		if(iphexa[9:] == "0000") :
			ipdec = ipdec[:-1] + ":" + "*"
		else :
			ipdec = ipdec[:-1] + ":" + "%d" % string.atol(iphexa[9:], 16)
		
		
		return ipdec 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:15,代码来源:networks.py

示例5: _getBase

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def _getBase(self) :
		base = ulibzeppoo.idtr()
		return string.atol(base, 16) 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:5,代码来源:memory.py

示例6: strtocidr

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def strtocidr(ips):
	"""returns CIDR start + length from string"""
	rng = 32
	pos = string.find(ips, '/')
	if not pos == -1:
		rng = string.atoi(ips[pos+1:])
		ips = ips[:pos]
	if string.find(ips, '.') == -1:
		ip = string.atol(ips)
	else:
		ip = strtoip(ips)
	if rng < 0 or rng > 32:
		raise ValueError, "CIDR length out of range"
	return (ip, rng) 
开发者ID:praetorian-code,项目名称:pentestly,代码行数:16,代码来源:netblock.py

示例7: _str_to_num

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def _str_to_num(n):
    """
    Convert a hex or octal string to a decimal number.

    :param n: Hex or octal string to be converted.
    :return: Resulting decimal number.
    """
    val = 0
    col = long(1)
    if n[:1] == 'x':
        n = '0' + n
    if n[:2] == '0x':
        # hex
        n = string.lower(n[2:])
        while len(n) > 0:
            l = n[len(n) - 1]
            val = val + string.hexdigits.index(l) * col
            col = col * 16
            n = n[:len(n) - 1]
    elif n[0] == '\\':
        # octal
        n = n[1:]
        while len(n) > 0:
            l = n[len(n) - 1]
            if ord(l) < 48 or ord(l) > 57:
                break
            val = val + int(l) * col
            col = col * 8
            n = n[:len(n) - 1]
    else:
        val = string.atol(n)
    return val 
开发者ID:Scemoon,项目名称:lpts,代码行数:34,代码来源:magic.py

示例8: main

# 需要导入模块: import string [as 别名]
# 或者: from string import atol [as 别名]
def main(options, arguments):
	#print 'options %s' % options
	#print 'arguments %s' % arguments
	if(options.device != None) :
		if(options.device == '/dev/mem') :
			mmemory = Mem()
		elif(options.device == '/dev/kmem') :
			mmemory = Kmem()
		else:
			usage()
	else :
		mmemory = Kmem()

	if(options.usemmap == None):
		options.usemmap = 0

	if(options.view != None):
		if(options.view == 'tasks'):
			ttasks = GVTasks(mmemory, options.usemmap)
			ttasks.viewTasks()
		elif(options.view == 'syscalls'):
			mysyscalls = GVSyscalls(mmemory, options.usemmap)
			mysyscalls.viewSyscalls()
		elif(options.view == 'networks'):
			nnetworks = GVNetworks(mmemory, options.usemmap)
			nnetworks.viewNetworks()
			
	elif(options.check != None):
		if(options.check == 'tasks'):
			ttasks = GVTasks(mmemory, options.usemmap)
			ttasks.checkViewTasks()
		elif(options.check == 'networks'):
			nnetworks = GVNetworks(mmemory, options.usemmap)
			nnetworks.checkViewNetworks()
			
	elif(options.fingerprints != None):
		ffingerprints = Fingerprints(mmemory)
		if(options.fingerprints[1] == 'create'):
			ffingerprints.doFingerprints(options.fingerprints[0])
		elif(options.fingerprints[1] == 'check'):
			ffingerprints.checkFingerprints(options.fingerprints[0])
			
	elif(options.bump != None):
		mmemory.open("r", options.usemmap)
		mmemory.dump(string.atol(options.bump[0], 16), int(options.bump[1]), options.bump[2])
		mmemory.close()
	
	else:
		usage() 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:51,代码来源:zeppoo.py


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