Python string.atol() Examples
The following are 16
code examples of string.atol().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
string
, or try the search function
.
Example #1
Source File: opcodes.py From darkc0de-old-stuff with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: test_string.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #3
Source File: test_string.py From BinderFilter with MIT License | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #4
Source File: test_string.py From oss-ftp with MIT License | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #5
Source File: test_string.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #6
Source File: test_string.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #7
Source File: syscalls.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
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"
Example #8
Source File: networks.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
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
Example #9
Source File: memory.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def _getBase(self) : base = ulibzeppoo.idtr() return string.atol(base, 16)
Example #10
Source File: netblock.py From pentestly with GNU General Public License v3.0 | 5 votes |
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)
Example #11
Source File: test_string.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #12
Source File: netblock.py From recon-ng with GNU General Public License v3.0 | 5 votes |
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)
Example #13
Source File: netblock.py From EasY_HaCk with Apache License 2.0 | 5 votes |
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)
Example #14
Source File: magic.py From lpts with GNU General Public License v2.0 | 5 votes |
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
Example #15
Source File: test_string.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_atol(self): self.assertEqual(string.atol(" 1 "), 1L) self.assertRaises(ValueError, string.atol, " 1x ") self.assertRaises(ValueError, string.atol, " x1 ")
Example #16
Source File: zeppoo.py From darkc0de-old-stuff with GNU General Public License v3.0 | 4 votes |
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()