"NoMethodError undefined method '[]' for nil" when using scanner/discovery/arp_sweep

Author: mwesterhofCreated Jul 28, 2026Updated Sep 14, 2026
LabelsbugStale

Steps to reproduce

How'd you do it?

  1. use the arp_sweep module
bash
use scanner/discovery/arp_sweep
  1. set appropriate options (assuming my IP is 192.168.1.1 (netmask 255.255.255.0) and my network interface is eth0)
bash
set RHOSTS 192.168.1.0/24
set INTERFACE eth1
  1. run the module
bash
run
  1. observe the following output:
bash
msf auxiliary(scanner/discovery/arp_sweep) > run
[-] Auxiliary failed: NoMethodError undefined method '[]' for nil
[-] Call stack:
[-]   /opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/structfu.rb:20:in 'StructFu#typecast'
[-]   /opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/eth/header.rb:168:in 'PacketFu::EthHeader#eth_proto='
[-]   /opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/arp.rb:50:in 'PacketFu::ARPPacket#initialize'
[-]   /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
[-]   /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
[-]   /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
[-]   /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
[-]   /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
[-]   /opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
[-]   /opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in Msf::ThreadManager#spawn'
[*] Auxiliary module execution completed
msf auxiliary(scanner/discovery/arp_sweep) > 

Were you following a specific guide/tutorial or reading documentation?

Not specifically, i was just looking through available modules and wanted to ARP sweep my home network

Expected behavior

Useful ARP sweep output, or an informative error message if I did something wrong

Current behavior

An error message is shown, see above.

Metasploit version

Framework: 6.4.147-dev- Console : 6.4.147-dev-

Additional Information

If your version is less than 5.0.96, please update to the latest version and ensure your issue is still present.

Module/Datastore

The following global/module datastore, and database setup was configured before the issue occurred:

Collapse
[framework/core]
LogLevel=3
ConsoleLogging=false
MinimumRank=manual
SessionLogging=false
TimestampOutput=false
VERBOSE=false
Prompt=
PromptChar=
PromptTimeFormat=
MeterpreterPrompt=
SessionTlvLogging=

[framework/ui/console]
ActiveModule=auxiliary/scanner/discovery/arp_sweep

[scanner/discovery/arp_sweep]
INTERFACE=eth1
RHOSTS=192.168.1.0/24
WORKSPACE=
VERBOSE=false
TIMEOUT=5
THREADS=1
ShowProgress=true
ShowProgressPercent=10
SHOST=
SMAC=

Database Configuration

The database contains the following information:

Collapse
Session Type: postgresql selected, no connection

Framework Configuration

The features are configured as follows:

Collapse
name enabled
wrapped_tables true
fully_interactive_shells false
manager_commands false
metasploit_payload_warnings true
defer_module_loads true
skip_checksum_validation false
smb_session_type true
postgresql_session_type true
mysql_session_type true
mssql_session_type true
ldap_session_type true
show_successful_logins false
dns true
hierarchical_search_table true
display_module_action true

History

The following commands were ran during the session and before this issue occurred:

Collapse
126    set loglevel 3
127    use scanner/discovery/arp_sweep
128    set INTERFACE eth1
129    set RHOSTS 192.168.1.0/24
130    run
131    debug

Framework Errors

The following framework errors occurred before the issue occurred:

Collapse
[07/28/2026 13:18:23] [e(0)] core: Auxiliary failed - NoMethodError undefined method '[]' for nil
[07/28/2026 13:28:34] [e(0)] core: Failed to connect to the database: No database YAML file
[07/28/2026 13:29:03] [e(0)] core: Thread Exception: ScannerBatch(scanner/discovery/arp_sweep)  critical=false    source:
    /opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:215:in 'Msf::Auxiliary::Scanner#run'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:187:in 'Msf::Simple::Auxiliary.job_run_proc'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:90:in 'Msf::Simple::Auxiliary.run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:101:in 'Msf::Simple::Auxiliary#run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:68:in 'Msf::Ui::Console::CommandDispatcher::Auxiliary#cmd_run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:582:in 'Rex::Ui::Text::DispatcherShell#run_command'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:531:in 'block in Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Array#each'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:162:in 'block in Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:306:in 'block in Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell/history_manager.rb:35:in 'Rex::Ui::Text::Shell::HistoryManager#with_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:303:in 'Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:130:in 'Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:54:in 'Metasploit::Framework::Command::Console#start'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in 'Metasploit::Framework::Command::Base.start'
    /opt/metasploit-framework/bin/../embedded/framework/msfconsole:23:in '<main>' - RuntimeError eth0: No such device exists (SIOCGIFHWADDR: No such device)
[07/28/2026 13:29:03] [e(0)] core: Auxiliary failed - RuntimeError eth0: No such device exists (SIOCGIFHWADDR: No such device)
[07/28/2026 13:34:19] [e(0)] core: Failed to connect to the database: No database YAML file
[07/28/2026 13:34:52] [e(0)] core: Thread Exception: ScannerBatch(scanner/discovery/arp_sweep)  critical=false    source:
    /opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:215:in 'Msf::Auxiliary::Scanner#run'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:187:in 'Msf::Simple::Auxiliary.job_run_proc'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:90:in 'Msf::Simple::Auxiliary.run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:101:in 'Msf::Simple::Auxiliary#run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:68:in 'Msf::Ui::Console::CommandDispatcher::Auxiliary#cmd_run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:582:in 'Rex::Ui::Text::DispatcherShell#run_command'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:531:in 'block in Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Array#each'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:162:in 'block in Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:306:in 'block in Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell/history_manager.rb:35:in 'Rex::Ui::Text::Shell::HistoryManager#with_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:303:in 'Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:130:in 'Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:54:in 'Metasploit::Framework::Command::Console#start'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in 'Metasploit::Framework::Command::Base.start'
    /opt/metasploit-framework/bin/../embedded/framework/msfconsole:23:in '<main>' - NoMethodError undefined method '[]' for nil
Call stack:
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/structfu.rb:20:in 'StructFu#typecast'
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/eth/header.rb:168:in 'PacketFu::EthHeader#eth_proto='
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/arp.rb:50:in 'PacketFu::ARPPacket#initialize'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
/opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in Msf::ThreadManager#spawn'
[07/28/2026 13:34:52] [e(0)] core: Auxiliary failed - NoMethodError undefined method '[]' for nil
Call stack:
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/structfu.rb:20:in 'StructFu#typecast'
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/eth/header.rb:168:in 'PacketFu::EthHeader#eth_proto='
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/arp.rb:50:in 'PacketFu::ARPPacket#initialize'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
/opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in Msf::ThreadManager#spawn'
[07/28/2026 13:36:52] [e(0)] core: Failed to connect to the database: No database YAML file
[07/28/2026 13:37:18] [e(0)] core: Thread Exception: ScannerBatch(scanner/discovery/arp_sweep)  critical=false    source:
    /opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:215:in 'Msf::Auxiliary::Scanner#run'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:187:in 'Msf::Simple::Auxiliary.job_run_proc'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:90:in 'Msf::Simple::Auxiliary.run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/auxiliary.rb:101:in 'Msf::Simple::Auxiliary#run_simple'
    /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:68:in 'Msf::Ui::Console::CommandDispatcher::Auxiliary#cmd_run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:582:in 'Rex::Ui::Text::DispatcherShell#run_command'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:531:in 'block in Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Array#each'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:525:in 'Rex::Ui::Text::DispatcherShell#run_single'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:162:in 'block in Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:306:in 'block in Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell/history_manager.rb:35:in 'Rex::Ui::Text::Shell::HistoryManager#with_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:303:in 'Rex::Ui::Text::Shell#with_history_manager_context'
    /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:130:in 'Rex::Ui::Text::Shell#run'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:54:in 'Metasploit::Framework::Command::Console#start'
    /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in 'Metasploit::Framework::Command::Base.start'
    /opt/metasploit-framework/bin/../embedded/framework/msfconsole:23:in '<main>' - NoMethodError undefined method '[]' for nil
Call stack:
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/structfu.rb:20:in 'StructFu#typecast'
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/eth/header.rb:168:in 'PacketFu::EthHeader#eth_proto='
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/arp.rb:50:in 'PacketFu::ARPPacket#initialize'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
/opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in Msf::ThreadManager#spawn'
[07/28/2026 13:37:18] [e(0)] core: Auxiliary failed - NoMethodError undefined method '[]' for nil
Call stack:
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/structfu.rb:20:in 'StructFu#typecast'
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/eth/header.rb:168:in 'PacketFu::EthHeader#eth_proto='
/opt/metasploit-framework/embedded/lib/ruby/gems/3.4.0/gems/packetfu-2.0.0/lib/packetfu/protos/arp.rb:50:in 'PacketFu::ARPPacket#initialize'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
/opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in Msf::ThreadManager#spawn'

Web Service Errors

The following web service errors occurred before the issue occurred:

Collapse
msf-ws.log does not exist.

Framework Logs

The following framework logs were recorded before the issue occurred:

Collapse
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Class#new'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:95:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#buildprobe'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:64:in 'block in Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Array#each'
/opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/discovery/arp_sweep.rb:61:in 'Msf::Modules::Auxiliary__Scanner__Discovery__Arp_sweep::MetasploitModule#run_batch'
/opt/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/scanner.rb:219:in 'block in Msf::Auxiliary::Scanner#run'
/opt/metasploit-framework/embedded/framework/lib/msf/core/thread_manager.rb:105:in 'block in

Source: rapid7/metasploit-framework