Re: Nmap Script Engine on OpenWrt

Daniel Miller <[email protected]> Thu, 5 Apr 2018 22:02:14 -0500
Newsgroups gmane.comp.security.nmap.devel
Message-ID <CABmvJnMa4T+wvjpW5s=gtowiQhxO1tQ4Oy_T=qOqqMTNer+i7w@mail.gmail.com>
It looks like Lua puts the commands to 'ar' into the AR variable. Your
build environment or configuration sets the AR variable to the appropriate
binary for your system, overwriting these commands. Then when building, ar
complains that it's missing a valid command.

As a workaround, here's a patch that ought to solve it:

diff --git a/liblua/Makefile b/liblua/Makefile
index d71c75c..ee52283 100644
--- a/liblua/Makefile
+++ b/liblua/Makefile
@@ -11,7 +11,7 @@ CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS)
$(MYCFLAGS)
 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
 LIBS= -lm $(SYSLIBS) $(MYLIBS)

-AR= ar rcu
+AR= ar
 RANLIB= ranlib
 RM= rm -f

@@ -56,7 +56,7 @@ o:    $(ALL_O)
 a:     $(ALL_A)

 $(LUA_A): $(BASE_O)
-       $(AR) $@ $(BASE_O)
+       $(AR) rcu $@ $(BASE_O)
        $(RANLIB) $@

 $(LUA_T): $(LUA_O) $(LUA_A)

I'll see what I can do to get this fixed in upstream Lua.

Dan


On Thu, Apr 5, 2018 at 3:32 PM, Bruno <[email protected]> wrote:

> The lua version on the OpenWRT device that is being used is Lua 5.1.5.
>
> Trying with the "--with-liblua=included" option, it tried to compile
> liblua, however it still failed with the attached error log.
> But it seems some progress were made. Do you have any other suggestions I
> could try?
>
> Thanks Daniel
>
>
> On 04/05/2018 10:30 AM, Daniel Miller wrote:
>
> Bruno,
>
> Thanks for following up. It appears that you might have a version of Lua
> installed that is incompatible with Nmap. You can force Nmap to build and
> statically link the Lua 5.3.3 source that's included with Nmap by passing
> --with-liblua=included to configure. Let us know if this fixes the issue
> for you.
>
> Dan
>
> On Mon, Apr 2, 2018 at 1:24 PM, Bruno <[email protected]> wrote:
>
>> Thanks Daniel Miller for your prompt answer,
>>
>> I'm attaching the error log. (Not sure if it works for the dev list. If
>> it doesn't I will reply with the error on clear text).
>>
>> Compiling with the "--without-liblua" works flawlessly.
>> On 04/02/2018 02:42 PM, Daniel Miller wrote:
>>
>> Bruno,
>>
>> NSE doesn't make sense outside the context of Nmap, and many of the
>> libraries it uses are compiled in to nmap itself. However, there shouldn't
>> be any reason that it wouldn't compile on OpenWrt. Can you change the
>> package's makefile so that it doesn't use --without-liblua in configure and
>> then report what actually happens? What are the specific errors that happen?
>>
>> Dan
>>
>> On Mon, Apr 2, 2018 at 11:28 AM, Bruno <[email protected]> wrote:
>>
>>> Is it possible to run NSE scritps, but without the nmap scripting?
>>>
>>> I'm trying to run nmap scripting on OpenWRT, so the router let me know
>>> if there are vulnerabilities on my network to be patched. However, the nmap
>>> version for OpenWRT is missing scripting support (
>>> https://github.com/openwrt/packages/issues/4472)
>>>
>>> The scripts are written in lua. So, what I'm planning to do is run all
>>> the scripts available from lua itself. Do I have to rewrite part of NSE or
>>> is there an easy way to do it? Or is there a way to enable scripting on
>>> OpenWRT with liblua?
>>>
>>> Thanks
>>>
>>> _______________________________________________
>>> Sent through the dev mailing list
>>> https://nmap.org/mailman/listinfo/dev
>>> Archived at http://seclists.org/nmap-dev/
>>>
>>
>>
>>
>
>

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/