solution.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:ctf-write-ups 作者: mvisat 项目源码 文件源码
def brute(i):
  global flag
  global last_breakpoint
  for c in charset:
    flag[i] = c
    output = gdb.execute('r < <(echo {})'.format(shlex.quote(''.join(flag))), True, True)
    # skip floating point exception
    while "SIGFPE" in output:
      output = gdb.execute('c', True, True)

    output = gdb.execute('x $pc', True, True)
    pc = output.split(":")[0]
    pc = int(pc, 16)
    if pc > last_breakpoint:
      last_breakpoint = pc
      break
  print(''.join(flag))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号