摘要:此掃描具有服務檢測命令,通過使用nmap掃描前1000個TCP端口。該命令使用兩個引用:{scandir}是目標的掃描目錄的位置,{address}是目標的地址。

AutoRecon是一個多線程的網絡偵察工具,可自動化的執行服務枚舉任務。其旨在減少任務的執行時間,非常適用於CTF和某些滲透環境(例如OSCP)。在實際參與中它可能對你也很有幫助。

該工具首先會執行端口/服務檢測掃描,並根據獲取的從初始結果,使用許多其他不同的工具對這些服務進行進一步的枚舉掃描。例如,如果找到HTTP,則將啓動nikto等等。

該工具中的所有內容都是高度可配置的。默認配置執行非自動化利用,以確保工具符合OSCP考試規則。如果你希望在配置中添加自動利用工具,則需要你自行承擔風險。作者對於因誤用此工具而導致的一系列後果,不承擔任何責任!

靈感來源

AutoRecon的靈感來自於作者在OSCP labs中使用的三款工具: ReconnoitreReconScanbscan 。雖然這三款工具都很有用,但它們的缺點也顯而易見就是各自爲伍,沒有一款工具能同時滿足我所有的需求。而AutoRecon則結合了上述工具各自的優勢,同時還實現了許多其他新的功能,可以幫助測試人員枚舉多個目標。

特性

支持以IP地址,IP範圍(CIDR表示法)和可解析主機名形式的多個目標。

可以同時掃描目標,如果有多個處理器可用的話。

可定製的端口掃描配置文件,可實現初始掃描的靈活性

可自定義的服務枚舉命令和建議的手動後續命令。

用於結果收集的直觀目錄結構。

完整記錄已運行的命令以及失敗時的錯誤。

全局和每次掃描模式匹配,因此你可以高亮顯示/從干擾中提取重要信息。

依賴項

 Python 3
 colorama
 toml

安裝Python 3後,pip3可用於安裝其他依賴項:

$ pip3 install -r requirements.txt

有人曾向我表示,在OSCP Kali版本上通過apt安裝pip3會使主機出現不穩定的情況。這種情況,可以通過運行以下命令來安裝pip3:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py

現在“pip3”命令應該可以使用了。

AutoRecon中使用的幾個命令引用了SecLists項目,位於/usr/share/seclists/目錄。你可以手動將SecLists項目下載到該目錄( https://github.com/danielmiessler/SecLists ),或者如果你使用的是Kali Linux(強烈推薦),則可以運行以下命令:

$ sudo apt install seclists

如果不安裝SecLists,AutoRecon仍將運行,但有些命令可能會失敗,並且某些手動命令也可能無法運行。

此外,你可能還需要安裝以下命令,這具體取決於你的操作系統:

curl
enum4linux
gobuster
nbtscan
nikto
nmap
onesixtyone
oscanner
smbclient
smbmap
smtp-user-enum
snmpwalk
sslscan
svwar
tnscmd10g
whatweb
wkhtmltoimage

使用

AutoRecon使用Python 3特定功能,不支持Python 2。

usage: autorecon.py [-h] [-ct <number>] [-cs <number>] [--profile PROFILE]
                    [-o OUTPUT] [--nmap NMAP | --nmap-append NMAP_APPEND] [-v]
                    [--disable-sanity-checks]
                    targets [targets ...]
Network reconnaissance tool to port scan and automatically enumerate services
found on multiple targets.
positional arguments:
  targets               IP addresses (e.g. 10.0.0.1), CIDR notation (e.g.
                        10.0.0.1/24), or resolvable hostnames (e.g. foo.bar)
                        to scan.
optional arguments:
  -h, --help            show this help message and exit
  -ct <number>, --concurrent-targets <number>
                        The maximum number of target hosts to scan
                        concurrently. Default: 5
  -cs <number>, --concurrent-scans <number>
                        The maximum number of scans to perform per target
                        host. Default: 10
  --profile PROFILE     The port scanning profile to use (defined in port-
                        scan-profiles.toml). Default: default
  -o OUTPUT, --output OUTPUT
                        The output directory for results. Default: results
  --nmap NMAP           Override the {nmap_extra} variable in scans. Default:
                        -vv --reason -Pn
  --nmap-append NMAP_APPEND
                        Append to the default {nmap_extra} variable in scans.
  -v, --verbose         Enable verbose output. Repeat for more verbosity.
  --disable-sanity-checks
                        Disable sanity checks that would otherwise prevent the
                        scans from running.

示例:

掃描單個目標

python3 autorecon.py 127.0.0.1
[*] Scanning target 127.0.0.1
[*] Running service detection nmap-full-tcp on 127.0.0.1
[*] Running service detection nmap-top-20-udp on 127.0.0.1
[*] Running service detection nmap-quick on 127.0.0.1
[*] Service detection nmap-quick on 127.0.0.1 finished successfully
[*] [127.0.0.1] ssh found on tcp/22
[*] [127.0.0.1] http found on tcp/80
[*] [127.0.0.1] rpcbind found on tcp/111
[*] [127.0.0.1] postgresql found on tcp/5432
[*] Running task tcp/22/nmap-ssh on 127.0.0.1
[*] Running task tcp/80/nmap-http on 127.0.0.1
[*] Running task tcp/80/curl-index on 127.0.0.1
[*] Running task tcp/80/curl-robots on 127.0.0.1
[*] Running task tcp/80/whatweb on 127.0.0.1
[*] Running task tcp/80/nikto on 127.0.0.1
[*] Running task tcp/111/nmap-nfs on 127.0.0.1
[*] Task tcp/80/curl-index on 127.0.0.1 finished successfully
[*] Task tcp/80/curl-robots on 127.0.0.1 finished successfully
[*] Task tcp/22/nmap-ssh on 127.0.0.1 finished successfully
[*] Task tcp/80/whatweb on 127.0.0.1 finished successfully
[*] Task tcp/111/nmap-nfs on 127.0.0.1 finished successfully
[*] Task tcp/80/nmap-http on 127.0.0.1 finished successfully
[*] Task tcp/80/nikto on 127.0.0.1 finished successfully
[*] Service detection nmap-top-20-udp on 127.0.0.1 finished successfully
[*] Service detection nmap-full-tcp on 127.0.0.1 finished successfully
[*] [127.0.0.1] http found on tcp/5984
[*] [127.0.0.1] rtsp found on tcp/5985
[*] Running task tcp/5984/nmap-http on 127.0.0.1
[*] Running task tcp/5984/curl-index on 127.0.0.1
[*] Running task tcp/5984/curl-robots on 127.0.0.1
[*] Running task tcp/5984/whatweb on 127.0.0.1
[*] Running task tcp/5984/nikto on 127.0.0.1
[*] Task tcp/5984/curl-index on 127.0.0.1 finished successfully
[*] Task tcp/5984/curl-robots on 127.0.0.1 finished successfully
[*] Task tcp/5984/whatweb on 127.0.0.1 finished successfully
[*] Task tcp/5984/nikto on 127.0.0.1 finished successfully
[*] Task tcp/5984/nmap-http on 127.0.0.1 finished successfully
[*] Finished scanning target 127.0.0.1

默認端口掃描配置文件首先會執行完整的TCP端口掃描,前20個UDP端口掃描以及前1000個TCP端口掃描。你可能會問爲什麼AutoRecon會在進行完整的TCP端口掃描(也會掃描這些端口)的同時掃描前1000個TCP端口。原因很簡單:大多數開放端口通常都位於前1000個端口範圍內,而我們希望的是快速開始枚舉服務,而不是等待Nmap逐一的掃描每個端口。如你所見,所有服務枚舉掃描實際上在完成TCP端口掃描之前已經完成。雖然工作有一點重複,但實際的枚舉結果將更快地返回給測試人員。

注意,如果你的終端支持,實際的命令行輸出將被着色。

掃描多個目標

python3 autorecon.py 192.168.1.100 192.168.1.1/30 localhost
[*] Scanning target 192.168.1.100
[*] Scanning target 192.168.1.1
[*] Scanning target 192.168.1.2
[*] Scanning target localhost
[*] Running service detection nmap-quick on 192.168.1.100
[*] Running service detection nmap-quick on localhost
[*] Running service detection nmap-top-20-udp on 192.168.1.100
[*] Running service detection nmap-quick on 192.168.1.1
[*] Running service detection nmap-quick on 192.168.1.2
[*] Running service detection nmap-top-20-udp on 192.168.1.1
[*] Running service detection nmap-full-tcp on 192.168.1.100
[*] Running service detection nmap-top-20-udp on localhost
[*] Running service detection nmap-top-20-udp on 192.168.1.2
[*] Running service detection nmap-full-tcp on localhost
[*] Running service detection nmap-full-tcp on 192.168.1.1
[*] Running service detection nmap-full-tcp on 192.168.1.2
...

AutoRecon支持一次掃描多個目標,並將擴展CIDR表示法中提供的IP範圍。默認情況下,一次只掃描5個目標,每個目標掃描10次。

使用高級選項掃描多個目標

python3 autorecon.py -ct 2 -cs 2 -vv -o outputdir 192.168.1.100 192.168.1.1/30 localhost
[*] Scanning target 192.168.1.100
[*] Scanning target 192.168.1.1
[*] Running service detection nmap-quick on 192.168.1.100 with nmap -vv --reason -Pn -sV -sC --version-all -oN "/root/outputdir/192.168.1.100/scans/_quick_tcp_nmap.txt" -oX "/root/outputdir/192.168.1.100/scans/_quick_tcp_nmap.xml" 192.168.1.100
[*] Running service detection nmap-quick on 192.168.1.1 with nmap -vv --reason -Pn -sV -sC --version-all -oN "/root/outputdir/192.168.1.1/scans/_quick_tcp_nmap.txt" -oX "/root/outputdir/192.168.1.1/scans/_quick_tcp_nmap.xml" 192.168.1.1
[*] Running service detection nmap-top-20-udp on 192.168.1.100 with nmap -vv --reason -Pn -sU -A --top-ports=20 --version-all -oN "/root/outputdir/192.168.1.100/scans/_top_20_udp_nmap.txt" -oX "/root/outputdir/192.168.1.100/scans/_top_20_udp_nmap.xml" 192.168.1.100
[*] Running service detection nmap-top-20-udp on 192.168.1.1 with nmap -vv --reason -Pn -sU -A --top-ports=20 --version-all -oN "/root/outputdir/192.168.1.1/scans/_top_20_udp_nmap.txt" -oX "/root/outputdir/192.168.1.1/scans/_top_20_udp_nmap.xml" 192.168.1.1
[-] [192.168.1.1 nmap-quick] Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-01 17:25 EST
[-] [192.168.1.100 nmap-quick] Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-01 17:25 EST
[-] [192.168.1.100 nmap-top-20-udp] Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-01 17:25 EST
[-] [192.168.1.1 nmap-top-20-udp] Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-01 17:25 EST
[-] [192.168.1.1 nmap-quick] NSE: Loaded 148 scripts for scanning.
[-] [192.168.1.1 nmap-quick] NSE: Script Pre-scanning.
[-] [192.168.1.1 nmap-quick] NSE: Starting runlevel 1 (of 2) scan.
[-] [192.168.1.1 nmap-quick] Initiating NSE at 17:25
[-] [192.168.1.1 nmap-quick] Completed NSE at 17:25, 0.00s elapsed
[-] [192.168.1.1 nmap-quick] NSE: Starting runlevel 2 (of 2) scan.
[-] [192.168.1.1 nmap-quick] Initiating NSE at 17:25
[-] [192.168.1.1 nmap-quick] Completed NSE at 17:25, 0.00s elapsed
[-] [192.168.1.1 nmap-quick] Initiating ARP Ping Scan at 17:25
[-] [192.168.1.100 nmap-quick] NSE: Loaded 148 scripts for scanning.
[-] [192.168.1.100 nmap-quick] NSE: Script Pre-scanning.
[-] [192.168.1.100 nmap-quick] NSE: Starting runlevel 1 (of 2) scan.
[-] [192.168.1.100 nmap-quick] Initiating NSE at 17:25
[-] [192.168.1.100 nmap-quick] Completed NSE at 17:25, 0.00s elapsed
[-] [192.168.1.100 nmap-quick] NSE: Starting runlevel 2 (of 2) scan.
[-] [192.168.1.100 nmap-quick] Initiating NSE at 17:25
[-] [192.168.1.100 nmap-quick] Completed NSE at 17:25, 0.00s elapsed
[-] [192.168.1.100 nmap-quick] Initiating ARP Ping Scan at 17:25
...

在本示例中,-ct選項將併發目標數限制爲2,-cs選項將每個目標的併發掃描數限制爲2。-vv選項表示詳細輸出,顯示正在運行的每個掃描的輸出。-o選項爲要保存的掃描結果設置自定義輸出目錄。

Verbosity

AutoRecon支持三個級別的詳細程度:

(none)最小輸出。AutoRecon將宣佈目標掃描何時開始和結束,以及哪些服務被標識。

(-v)詳細輸出。AutoRecon還將指定正在運行的命令,並高亮顯示在命令輸出中匹配的任何模式。

(-vv)更爲詳細的輸出。AutoRecon將輸出所有內容。當同時掃描多個目標時,這可能導致巨大的輸出量。除非你需要查看命令的實時輸出,否則我不建議你使用-vv。

結果

默認情況下,結果將存儲在./results目錄中。爲各個目標創建一個新的子目錄。該子目錄的結構如下:

.
├── exploit/
├── loot/
├── report/
│   ├── local.txt
│   ├── notes.txt
│   ├── proof.txt
│   └── screenshots/
└── scans/
    ├── _commands.log
    ├── _manual_commands.txt
    └── xml/
 exploit目錄包含你爲目標下載/寫入的exploit代碼。
 loot目錄包含你在目標上找到的loot(例如哈希等)。
 report目錄包含一些自動生成的文件和目錄,這些文件和目錄對報告很有用:
 local.txt可用於存儲目標上找到的local.txt flag。
 notes.txt應該包含一個基本模板,你可以在其中爲每個發現的服務編寫註釋。
 proof.txt可用於存儲在目標上找到的proof.txt flag。
 screenshots目錄包含用於記錄目標攻擊的屏幕截圖。

scans目錄中包含了AutoRecon執行掃描的所有結果,包括端口/服務檢測掃描以及任何其他的服務枚舉掃描。它還包含另外兩個文件:

 _commands.log包含AutoRecon針對目標運行的各個命令的列表。如果其中一個命令失敗並且你希望通過修改再次運行它,這將非常有用。
 _manual_commands.txt包含任何被認爲“危險”而無法自動運行的命令,原因可能是這些命令過於有侵入性,需要根據人工分析進行修改,或者是有人盯着時會更好的工作。

如果掃描導致錯誤,則名爲_errors.log的文件也將出現在scans目錄中,其中包含一些提示信息。

如果輸出與定義的模式匹配,則名爲_patterns.log的文件也將出現在scans目錄中,其中包含有關匹配輸出的詳細信息。

scans/xml目錄將任何XML輸出(例如來自Nmap掃描)與主掃描輸出分開存儲,因此scans目錄本身不會太雜亂。

端口掃描配置文件

你可以在port-scan-profiles.toml文件中定義初始端口掃描/服務檢測命令。配置文件使用TOML格式,這裏已經解釋過了: https://github.com/toml-lang/toml

這是一個名爲“quick”的示例配置文件:

[quick]
    [quick.nmap-quick]
        [quick.nmap-quick.service-detection]
        command = 'nmap {nmap_extra} -sV --version-all -oN "{scandir}/_quick_tcp_nmap.txt" -oX "{scandir}/xml/_quick_tcp_nmap.xml" {address}'
        pattern = '^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'
    [quick.nmap-top-20-udp]
        [quick.nmap-top-20-udp.service-detection]
        command = 'nmap {nmap_extra} -sU -A --top-ports=20 --version-all -oN "{scandir}/_top_20_udp_nmap.txt" -oX "{scandir}/xml/_top_20_udp_nmap.xml" {address}'
        pattern = '^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'

注意,縮進是可選的,在這裏使用它純粹是爲了美觀。“quick”配置文件定義了一個名爲“nmap-quick”的掃描。此掃描具有服務檢測命令,通過使用nmap掃描前1000個TCP端口。該命令使用兩個引用:{scandir}是目標的掃描目錄的位置,{address}是目標的地址。

定義了一個正則表達式模式,它匹配輸出中的三個命名組(端口,協議和服務)。每個服務檢測命令必須具有與這三個組匹配的相應模式。AutoRecon將嘗試進行一些檢查,如果缺少這些組中的任何一個,則拒絕掃描。

此外,還定義了一個幾乎相同的掃描,稱爲“nmap-top-20-udp”。這將掃描前20個udp端口。

下面是一個更爲複雜的例子:

[udp]
    [udp.udp-top-20]
        [udp.udp-top-20.port-scan]
        command = 'unicornscan -mU -p 631,161,137,123,138,1434,445,135,67,53,139,500,68,520,1900,4500,514,49152,162,69 {address} 2>&1 | tee "{scandir}/_top_20_udp_unicornscan.txt"'
        pattern = '^UDP open\s*[\w-]+\[\s*(?P<port>\d+)\].*$'
        [udp.udp-top-20.service-detection]
        command = 'nmap {nmap_extra} -sU -A -p {ports} --version-all -oN "{scandir}/_top_20_udp_nmap.txt" -oX "{scandir}/xml/_top_20_udp_nmap.xml" {address}'
        pattern = '^(?P<port>\d+)\/(?P<protocol>(udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'

在本例中,名爲“udp”的配置文件定義了名爲“udp-top-20”的掃描。此掃描有兩個命令,一個是端口掃描,另一個是服務檢測。定義端口掃描命令時,它將始終首先運行。相應的模式必須與從輸出中提取端口號的命名組“port”匹配。

服務檢測將在端口掃描命令完成並使用新引用{ports}後運行。此引用是由port-scan命令提取的所有端口的逗號分隔字符串。注意,在服務檢測模式中定義了相同的三個命名組(端口、協議和服務)。

端口掃描和服務檢測命令都使用{scandir}和{address}引用。

注意,如果定義端口掃描命令時沒有相應的服務檢測命令,AutoRecon將拒絕掃描。

這個複雜的示例只有在你想要將unicornscan的速度與nmap的服務檢測能力結合使用時才真正有用。如果你對使用Nmap進行端口掃描和服務檢測感到滿意,則無需使用此設置。

服務掃描

你可以在service-scans.toml文件中定義服務枚舉掃描和與某些服務關聯的其他手動命令。

以下是一個簡單配置的示例:

[ftp]
service-names = [
    '^ftp',
    '^ftp\-data'
]
    [[ftp.scan]]
    name = 'nmap-ftp'
    command = 'nmap {nmap_extra} -sV -p {port} --script="(ftp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_ftp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ftp_nmap.xml" {address}'
        [[ftp.scan.pattern]]
        description = 'Anonymous FTP Enabled!'
        pattern = 'Anonymous FTP login allowed'
    [[ftp.manual]]
    description = 'Bruteforce logins:'
    commands = [
        'hydra -L "{username_wordlist}" -P "{password_wordlist}" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_ftp_hydra.txt" ftp://{address}',
        'medusa -U "{username_wordlist}" -P "{password_wordlist}" -e ns -n {port} -O "{scandir}/{protocol}_{port}_ftp_medusa.txt" -M ftp -h {address}'
    ]

注意,縮進是可選的,這裏使用它純粹是爲了美觀。這裏定義了服務“ftp”。 service-names數組包含正則表達式字符串,它應與服務檢測掃描中的服務名稱匹配。service-names數組以白名單爲基礎;只要其中一個正則表達式字符串匹配,服務就會被掃描。

如果要從匹配中將某些正則表達式字符串列入黑名單,也可以定義可選的ignore-service-names數組。

ftp.scan部分定義了一個名爲nmap-ftp的掃描。此掃描定義了一個命令,該命令使用幾個與ftp相關的腳本運行nmap。這裏引用了:

默認情況下,{nmap_extra}設置爲“-vv –reason -Pn”,但可以分別使用–nmap或–nmap-append命令行選項覆蓋或追加此選項。如果協議是UDP,則還將附加“-sU”。

{port}是運行該服務的端口。

{scandir}是目標scans目錄的位置。

{protocol}是正在使用的協議(tcp或udp)。

{address}是目標的地址。

爲nmap-ftp掃描定義了一個模式,該模式與簡單模式“允許匿名FTP登錄”相匹配。如果此模式與nmap-ftp命令的輸出匹配,則模式描述(“Anonymous FTP Enabled!”)將保存到scans目錄中的_patterns.log文件中。可以在描述中使用特殊引用{match}來引用整個匹配或第一組捕獲。

ftp.manual部分定義了一組手動命令。該組包含用戶的描述,以及用戶可以運行命令的數組。這裏定義了兩個新引用:{username_wordlist}和{password_wordlist},它們在service-scans.toml文件的頂部配置,默認爲SecLists提供的用戶名和密碼wordlist。

這是一個更爲複雜的配置:

[smb]
service-names = [
    '^smb',
    '^microsoft\-ds',
    '^netbios'
]
    [[smb.scan]]
    name = 'nmap-smb'
    command = 'nmap {nmap_extra} -sV -p {port} --script="(nbstat or smb* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_nmap.xml" {address}'
    [[smb.scan]]
    name = 'enum4linux'
    command = 'enum4linux -a -M -l -d {address} 2>&1 | tee "{scandir}/enum4linux.txt"'
    run_once = true
    ports.tcp = [139, 389, 445]
    ports.udp = [137]
    [[smb.scan]]
    name = 'nbtscan'
    command = 'nbtscan -rvh {address} 2>&1 | tee "{scandir}/nbtscan.txt"'
    run_once = true
    ports.udp = [137]
    [[smb.scan]]
    name = 'smbclient'
    command = 'smbclient -L\\ -N -I {address} 2>&1 | tee "{scandir}/smbclient.txt"'
    run_once = true
    ports.tcp = [139, 445]
    [[smb.scan]]
    name = 'smbmap-share-permissions'
    command = 'smbmap -H {address} -P {port} 2>&1 | tee -a "{scandir}/smbmap-share-permissions.txt"; smbmap -u null -p "" -H {address} -P {port} 2>&1 | tee -a "{scandir}/smbmap-share-permissions.txt"'
    [[smb.scan]]
    name = 'smbmap-list-contents'
    command = 'smbmap -H {address} -P {port} -R 2>&1 | tee -a "{scandir}/smbmap-list-contents.txt"; smbmap -u null -p "" -H {address} -P {port} -R 2>&1 | tee -a "{scandir}/smbmap-list-contents.txt"'
    [[smb.scan]]
    name = 'smbmap-execute-command'
    command = 'smbmap -H {address} -P {port} -x "ipconfig /all" 2>&1 | tee -a "{scandir}/smbmap-execute-command.txt"; smbmap -u null -p "" -H {address} -P {port} -x "ipconfig /all" 2>&1 | tee -a "{scandir}/smbmap-execute-command.txt"'
    [[smb.manual]]
    description = 'Nmap scans for SMB vulnerabilities that could potentially cause a DoS if scanned (according to Nmap). Be careful:'
    commands = [
        'nmap {nmap_extra} -sV -p {port} --script="smb-vuln-ms06-025" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_ms06-025.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_ms06-025.xml" {address}',
        'nmap {nmap_extra} -sV -p {port} --script="smb-vuln-ms07-029" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_ms07-029.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_ms07-029.xml" {address}',
        'nmap {nmap_extra} -sV -p {port} --script="smb-vuln-ms08-067" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_ms08-067.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_ms08-067.xml" {address}'
    ]

這裏的主要區別是幾次掃描有一些新的設置:

 ports.tcp數組定義了可以對其運行命令的TCP端口的白名單。如果在非白名單中的端口上檢測到該服務,則不會對其運行該命令。
 ports.udp數組定義了可以對其運行命令的UDP端口的白名單。它的操作方式與ports.tcp數組相同。

爲什麼要進行這些設置?有些命令只會對特定端口運行,並且不能被告知要對任何其他端口運行。例如,enum4linux將僅針對TCP端口139,389和445以及UDP端口137運行。

事實上,enum4linux在運行時總是會嘗試這些端口。因此,如果在TCP端口139和445上找到SMB服務,AutoRecon可能會無故嘗試運行Enum4Linux兩次。這就存在第三個設置的原因:

如果run_once設置爲true,則該命令將僅針對該目標運行一次,即使在多個端口上找到SMB服務也是如此。

*參考來源: GitHub ,FB小編secist編譯,轉載請註明來自FreeBuf.COM

相關文章