本文整理汇总了Python中pwn.die函数的典型用法代码示例。如果您正苦于以下问题:Python die函数的具体用法?Python die怎么用?Python die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了die函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _resolve
def _resolve(self, x):
if x is None or isinstance(x, int):
return x
for y in [self.plt, self.symbols, self.sections]:
if x in y:
return y[x]
die('Could not resolve `%s\'' % x)
开发者ID:X-N2O,项目名称:pwntools,代码行数:7,代码来源:rop.py
示例2: __coerce__
def __coerce__ (self, other):
if pwn.isint(other) and self._load_addr:
return (self._load_addr, other)
elif isinstance(other, str):
return (self.flush(), other)
else:
pwn.die('Could not coerce ROP. Other value was: %r' % other)
开发者ID:WizardsOfDos,项目名称:pwntools,代码行数:7,代码来源:rop.py
示例3: _parse_host
def _parse_host(self, host):
# Split off the optional authentication
host_ = host.split('@', 1)
if len(host_) == 1:
auth, host_ = None, host_[0]
else:
auth, host_ = host_
# Parse the authentication
if auth:
auth_ = auth.split(':', 1)
if len(auth_) == 1:
self._user = auth_[0]
else:
self._user, self._password = auth_
# Parse the optional port
host_ = host_.split(':', 1)
if len(host_) == 1:
self.host = host_[0]
else:
self.host, port = host_
if not (port and port.isdigit()):
pwn.die('Port "%s" is not a number' % port)
self._port = int(port)
开发者ID:7h3rAm,项目名称:pwntools,代码行数:28,代码来源:ssh.py
示例4: p
def p(x, arch = None):
"""Packs an integer into a string based on the current context"""
if arch == 'amd64':
return p64(x)
elif arch == 'i386':
return p32(x)
pwn.die('Architecture not set in the context while calling p(%d)' % x)
开发者ID:djacobs,项目名称:pwntools,代码行数:7,代码来源:binutils.py
示例5: u
def u(x, arch = None):
"""Unpacks a string into an integer based on the current context"""
if arch == 'amd64':
return u64(x)
elif arch == 'i386':
return u32(x)
pwn.die('Architecture not set in the context while calling u(%s)' % repr(x))
开发者ID:djacobs,项目名称:pwntools,代码行数:7,代码来源:binutils.py
示例6: gadget
def gadget(self, what, avoid = ''):
if what in self._gadget_cache:
return self._gadget_cache[(what, avoid)]
gs = []
err = 'Unknown gadget type: "%s"' % what
if what == 'ret':
gs = self._gadgets.get('popret', {}).get(0, [])
elif what == 'leave':
gs = self._gadgets.get('leave', [])
elif what == 'popebp':
gs = self._gadgets.get('popebp', [])
elif what.startswith('pop'):
if what.startswith('popret'):
offset = what[6:]
else:
if what[-3:] == 'ret':
what = what[:-3]
offset = what[3:]
if offset.isdigit():
offset = int(offset)
elif offset == '':
offset = 1
else:
pwn.die(err)
gs = self._gadgets.get('popret', {}).get(offset, [])
else:
pwn.die(err)
for g in gs:
gstr = pwn.pint(g)
if all(c not in gstr for c in avoid):
self._gadget_cache[(avoid, what)] = g
return g
开发者ID:WizardsOfDos,项目名称:pwntools,代码行数:32,代码来源:rop.py
示例7: __init__
def __init__(self, file):
waitfor('Loading ELF file `%s\'' % os.path.basename(file))
self.sections = {}
self.symbols = {}
self.plt = {}
self.got = {}
self.elfclass = None
self._file_data = None
if not (os.access(file, os.R_OK) and os.path.isfile(file)):
die('File %s is not readable or does not exist' % file)
self._file = file
def check(f):
if not (os.access(f, os.X_OK) and os.path.isfile(f)):
die('Executable %s needed for readelf.py, please install binutils' % f)
check(_READELF)
check(_OBJDUMP)
self._load_elfclass()
self._load_sections()
self._load_symbols()
self._load_plt_got()
succeeded()
开发者ID:X-N2O,项目名称:pwntools,代码行数:26,代码来源:elf.py
示例8: flush
def flush(self, loaded_at = None):
if loaded_at is not None:
self._load_addr = loaded_at
if self.elf.elfclass == 'ELF32':
return self._generate32()
else:
pwn.die('Only 32bit ELF supported')
开发者ID:hellok,项目名称:pwntools-2013-5-2,代码行数:7,代码来源:rop.py
示例9: _download_to_cache
def _download_to_cache(self, remote):
self._initialize_sftp()
fingerprint = self._get_fingerprint(remote)
if fingerprint == None:
import time
local = os.path.normpath(remote)
local = os.path.basename(local)
local += time.strftime('-%Y-%m-d-%H:%M:%S')
local = os.path.join(self._cachedir, local)
self._download_raw(remote, local)
return local
local = self._get_cachefile(fingerprint)
if self._verify_local_fingerprint(fingerprint):
if not self.silent:
pwn.log.success('Found %s in ssh cache' % remote)
else:
self._download_raw(remote, local)
if not self._verify_local_fingerprint(fingerprint):
pwn.die('Could not download file "%s"' % remote)
return local
开发者ID:7h3rAm,项目名称:pwntools,代码行数:25,代码来源:ssh.py
示例10: __init__
def __init__(self, blob, **kwargs):
self.arch = kwargs.get('arch')
self.os = kwargs.get('os')
self.blob = blob
if not isinstance(blob, str):
pwn.die('Trying to create an AssemblerBlob class, but the blob does not have type str.\nThe type is ' + str(type(blob)) + ' with the value:\n' + repr(blob)[:100])
开发者ID:X-N2O,项目名称:pwntools,代码行数:7,代码来源:shellcode_helper.py
示例11: unbits
def unbits(s, endian = 'big'):
out = []
state = {'cur': ''}
count = 0
def flush():
cur = state['cur'].ljust(8, '0')
state['cur'] = ''
if endian == 'little':
out.append(chr(int(cur[::-1], 2)))
elif endian == 'big':
out.append(chr(int(cur, 2)))
else:
pwn.die('Wat (endian style)')
for c in s:
if c not in ['0', '1', 0, 1, True, False]:
pwn.die('Unbits called with a funky argument')
state['cur'] += '1' if c in ['1', 1, True] else '0'
count += 1
if count == 8:
count = 0
flush()
if count:
flush()
return ''.join(out)
开发者ID:djacobs,项目名称:pwntools,代码行数:30,代码来源:binutils.py
示例12: call
def call(self, target, args = (), pivot = None):
'''Irrelevant arguments should be marked by a None'''
target_addr = self._resolve(target)
if not target_addr:
pwn.die('symbol {} not found'.format(target))
self._chain.append(('call', (target_addr, pivot, pwn.tuplify(args))))
return self
开发者ID:stephenR,项目名称:pwntools,代码行数:7,代码来源:rop.py
示例13: flush
def flush():
cur = state['cur'].ljust(8, '0')
state['cur'] = ''
if endian == 'little':
out.append(chr(int(cur[::-1], 2)))
elif endian == 'big':
out.append(chr(int(cur, 2)))
else:
pwn.die('Wat (endian style)')
开发者ID:djacobs,项目名称:pwntools,代码行数:9,代码来源:binutils.py
示例14: section
def section(self, name):
if name in self.sections:
self._load_data()
sec = self.sections[name]
offset = sec['offset']
size = sec['size']
return ''.join(self._data[offset:offset + size])
else:
pwn.die('No section named %s' % name)
开发者ID:7h3rAm,项目名称:pwntools,代码行数:9,代码来源:elf.py
示例15: section
def section(self, name):
if name in self.sections:
self._load_data()
sec = self.sections[name]
offset = sec['offset']
size = sec['size']
return self._file_data[offset:offset + size]
else:
die('No section named %s' % name)
开发者ID:X-N2O,项目名称:pwntools,代码行数:9,代码来源:elf.py
示例16: set_name
def set_name(self, name):
if name == self.name:
return
if self.name in Block._roots:
if name in Block._roots:
pwn.die('A root block with the name "%s" already exicsts' % self.name)
del Block._roots[self.name]
Block._roots[name] = self
self.name = name
开发者ID:Haabb,项目名称:pwntools,代码行数:10,代码来源:blocks.py
示例17: read
def read(self, addr, numb):
out = []
while numb > 0:
data = self._read(addr, numb)
if data is None:
die('Offset %x does not live in any section' % addr)
out.append(data)
size = len(data)
numb -= size
addr += size
return ''.join(out)
开发者ID:X-N2O,项目名称:pwntools,代码行数:11,代码来源:elf.py
示例18: _run
def _run(cmd):
import subprocess, errno
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
exitcode = p.wait()
except OSError, e:
if e.errno == errno.ENOENT:
pwn.die('%s is not installed' % cmd[0])
else:
raise
开发者ID:WizardsOfDos,项目名称:pwntools,代码行数:11,代码来源:asm.py
示例19: fix
def fix(s):
s_list = set([s])
for n in range(100):
s = s.subs(Block.symbols)
if s.is_integer:
break
if s in s_list:
break
if repr(s) > 200:
pwn.die('The expression "%s" is misbehaving' % repr(s))
s_list.add(s)
return s
开发者ID:Haabb,项目名称:pwntools,代码行数:12,代码来源:blocks.py
示例20: read_symbol
def read_symbol(self, name):
if name in self.symbols:
sym = self.symbols[name]
addr = sym['addr']
size = sym['size']
data = self.read(addr, size)
if data is None:
pwn.die('Symbol %s does not live in any section' % name)
else:
return data
else:
pwn.die('No symbol named %s' % name)
开发者ID:7h3rAm,项目名称:pwntools,代码行数:12,代码来源:elf.py
注:本文中的pwn.die函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论