May 2017
Intermediate to advanced
416 pages
21h 33m
English
The LUA NSE libraries are stored inside the directory /nselib/ in your configured data directory. To create our own libraries, we just need to create the .lua file and place it in that directory:
--hello.lua local stdnse = require "stdnse" _ENV = stdnse.module("mylibrary", stdnse.seeall) function foo(msg, name) return stdnse.format("%s %s", msg, name) end return _ENV
NSE scripts can now import your NSE library and call the available functions:
local hello = require "hello" ... hello.foo("Hello", "Martha")
It is important to document your library well before submitting it to http://insecure.org/ to help other developers quickly understand the purpose and functionality of your new library.
Read now
Unlock full access