Lua,nmap,sqlite3和ubuntu - 找不到模块'luasql.sqlite3'

时间:2016-03-13 13:39:17

标签: ubuntu sqlite lua installation nmap

我需要使用nmap和sqlite3,我在ubuntu机器上安装了lua 5.1和lua-sql-sqlite3:

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

现在,当我这样做时:

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

一切都还可以,但是当我尝试使用此行运行nmap nse scrint时:

require "luasql.sqlite3"

我正在使用这个nse脚本sqlite-output.nse来处理nmap和sqlite3。

我有错误:

$ 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 个答案:

答案 0 :(得分:3)

当你搜索&#34; luasql&#34;在你的文件系统中,它安装在哪里?在我的机器上它看起来像这样:

micha@squeak:~$ sudo find / -name luasql
/usr/lib/x86_64-linux-gnu/lua/5.2/luasql
/usr/lib/x86_64-linux-gnu/lua/5.1/luasql

是从Ubuntu仓库安装nmap还是自编译?

编辑:如果您的lua libs不在nmap的搜索路径中,您可以创建如下的软链接:

sudo ln -s /usr/lib/x86_64-linux-gnu/lua /usr/local/lib/lua