Rules for Writing Meterpreter Scripts

When creating Meterpreter scripts, you need to understand the following rules before you begin your first script and if you want them to be committed to the Framework:

  • Use only instance, local, and constant variables; never use global or class variables because they might interfere with the Framework variables.

  • Use hard tabs for indenting; do not use spaces.

  • For code blocks, do not use {}. Instead, use do and end.

  • When declaring functions, always write a comment before the declaration and provide a brief description of its purpose.

  • Do not use sleep; use "select(nil, nil, nil, <time>)".

  • Do not use puts or any other standard output calls; instead use print, print_line, print_status, print_error, and print_good.

  • Always ...

Get Metasploit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.