Book Image

Mastering the Nmap Scripting Engine

By : Paulino Calderon
Book Image

Mastering the Nmap Scripting Engine

By: Paulino Calderon

Overview of this book

Table of Contents (23 chapters)
Mastering the Nmap Scripting Engine
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Scan Phases
Script Categories
Nmap Options Mind Map
References
Index

Writing an NSE script to launch password-auditing attacks against the MikroTik RouterOS API


Let's tie everything together by writing a complete NSE script that uses all the libraries seen in this chapter. On this occasion, we will target devices running MikroTik RouterOS 3.x and higher versions with API access enabled.

The API service usually runs on TCP port 8728, and it allows administrative access to the devices running this operating system. Often, administrators will lock down HTTP and SSH but not the API. Let's write a script that helps us perform brute-force password-auditing against this service:

  1. First, let's start with the information tags and required libraries:

    description = [[
    Performs brute force password auditing against Mikrotik RouterOS devices with the API RouterOS interface enabled.
    
    Additional information:
    * http://wiki.mikrotik.com/wiki/API
    * http://wiki.mikrotik.com/wiki/API_in_C
    * https://github.com/mkbrutusproject/MKBRUTUS
    ]]
    author = "Paulino Calderon <calderon()websec...