Skip to content

Code review - script python #3

Description

@Dooc-Nuken

évite à tout prix from x import *
fais toujours soit from x import y
soit import x
puis call x.y
sinon on peut pas suivre quelle fonction vient d'où
et c'est un bordel
et les hanging continuation, indente

bad indentation:

io.sendlineafter(b'Enter command: ', b'prints ' + (b'A' * 540)

  • p32(1) # i
  • flat(-1, word_size=64) # rbp
  • p64(elf.symbols['pwn_func1'])
  • b'\n'
    )

io.sendlineafter(b'Enter command: ', b'prints ' + (b'A' * 540)

  • p32(1) # i
  • flat(-1, word_size=64) # rbp
  • p64(elf.symbols['pwn_func1'])
  • b'\n'
    )

aussi, évite le code directement dans le body de ton .py)
(fais plutôt ça)
import pwn

def main():
pwn.context.terminal = ['xfce4-terminal', '-x']
elf = pwn.ELF('../ref/bin/my_vm1')

...

io.sendlineafter(b'Enter command: ', b'exec\n')

io.interactive()
io.close()

if name == "main":
main()
en gros, si tu fais un import exploit1, ça va pas lancer ton code tant que tu lances pas main()
aussi, ça rend tes variables locales à la fonction main
comparé à faire ça dans le if name == "main"
mais en gros c'est une bonne pratique, prends l'habitude ;)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions