1

I need to work with nmap and sqlite3 and I installed lua 5.1 and lua-sql-sqlite3 on an ubuntu machine:

sudo apt-get install lua5.1; sudo apt-get install lua-sql-sqlite3

Now, when I'm doing this:

$ lua
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> drv = require "luasql.sqlite3"
> print(drv._VERSION)
LuaSQL 2.3.0

Everything is okay, but when I'm trying to run nmap nse scrint with this line:

require "luasql.sqlite3"

I'm using this nse script sqlite-output.nse for working with nmap and sqlite3.

I have the error:

$ sudo nmap --script=sqlite-output.nse localhost
[sudo] password for alex: 

Starting Nmap 7.01 ( https://nmap.org ) at 2016-03-13 04:16 EET
NSE: Failed to load sqlite-output.nse:
sqlite-output.nse:7: module 'luasql.sqlite3' not found:
    NSE failed to find nselib/luasql/sqlite3.lua in search paths.
    no field package.preload['luasql.sqlite3']
    no file '/usr/local/share/lua/5.2/luasql/sqlite3.lua'
    no file '/usr/local/share/lua/5.2/luasql/sqlite3/init.lua'
    no file '/usr/local/lib/lua/5.2/luasql/sqlite3.lua'
    no file '/usr/local/lib/lua/5.2/luasql/sqlite3/init.lua'
    no file './luasql/sqlite3.lua'
    no file '/usr/local/lib/lua/5.2/luasql/sqlite3.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './luasql/sqlite3.so'
    no file '/usr/local/lib/lua/5.2/luasql.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './luasql.so'
stack traceback:
    [C]: in function 'require'
    sqlite-output.nse:7: in function <sqlite-output.nse:1>
NSE: failed to initialize the script engine:
/usr/local/bin/../share/nmap/nse_main.lua:600: could not load script
stack traceback:
    [C]: in function 'error'
    /usr/local/bin/../share/nmap/nse_main.lua:600: in function 'new'
    /usr/local/bin/../share/nmap/nse_main.lua:805: in function 'get_chosen_scripts'
    /usr/local/bin/../share/nmap/nse_main.lua:1249: in main chunk
    [C]: in ?

1 Answer 1

1

Nmap uses Lua 5.2, not 5.1. The versions are not compatible.


EDIT: Just saw that you are indeed using lua-sql-sqlite3 for Lua 5.2. But Nmap is looking for it in the locations printed in your question, in the /usr/local prefix. Ubuntu packages install in the /usr prefix. You could probably make it work by doing sudo ln -s /usr/lib/lua/5.2/luasql /usr/local/lib/lua/5.2/luasql

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .