如何從 Ubuntu 12.04 使用 nmap 掃描 Heartbleed 漏洞?

如何從 Ubuntu 12.04 使用 nmap 掃描 Heartbleed 漏洞?
[root@notebook ~] lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise
[root@notebook ~] dpkg -l nmap | grep ^ii
ii  nmap                                          5.21-1.1ubuntu1                            The Network Mapper
[root@notebook ~] wget -q https://svn.nmap.org/nmap/scripts/ssl-heartbleed.nse -O /usr/share/nmap/nselib/ssl-heartbleed.nse
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/tls.lua -O /usr/share/nmap/nselib/tls.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/sslcert.lua -O /usr/share/nmap/nselib/sslcert.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/asn1.lua -O /usr/share/nmap/nselib/asn1.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/stdnse.lua -O /usr/share/nmap/nselib/stdnse.lua
[root@notebook ~] nmap -p 443 --script ssl-heartbleed www.ssllabs.com

Starting Nmap 5.21 ( http://nmap.org ) at 2014-06-25 07:49 CEST
NSE: failed to initialize the script engine:
/usr/share/nmap/nselib/stdnse.lua:59: attempt to index field 'socket' (a nil value)
stack traceback:
    /usr/share/nmap/nselib/stdnse.lua:59: in main chunk
    [C]: in function 'require'
    /usr/share/nmap/nse_main.lua:95: in main chunk
    [C]: ?

QUITTING!
[root@notebook ~] cat /usr/share/nmap/nselib/stdnse.lua
...
  50 --- Sleeps for a given amount of time.
  51 --
  52 -- This causes the program to yield control and not regain it until the time
  53 -- period has elapsed. The time may have a fractional part. Internally, the
  54 -- timer provides millisecond resolution.
  55 -- @name sleep
  56 -- @class function
  57 -- @param t Time to sleep, in seconds.
  58 -- @usage stdnse.sleep(1.5)
  59 _ENV.sleep = nmap.socket.sleep;
...

我的問題: 問題是什麼?

nmap 前面的許多“wget”是因為 nmap 之前說它缺少模組。

答案1

在版本6.25中,Nmap將Nmap腳本引擎(NSE)的語言從Lua 5.1切換到Lua 5.2。這意味著您必須至少使用 6.25 版本才能使用 nmap.org 上的腳本。

Ubuntu 12.04 的儲存庫中僅提供 Nmap 5.21,但是13.10 之後的任何版本將有一個相容版本(特別是 6.40)。升級作業系統可能無法滿足您的需求,因此您可能需要從來源安裝反而。

我已經整理好了使用 Nmap 掃描 Heartbleed 的指南許多人發現這很有幫助。

相關內容