rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.12k stars 13.97k forks source link

Run "elm327_relay.rb -s /dev/ttyS0“ then Get Error ”uninitialized constant ELM327HWBridgeRelay::ELM327Relay::MSF_LICENSE (NameError)“ #14839

Closed zhlu32 closed 3 years ago

zhlu32 commented 3 years ago

Steps to reproduce

How'd you do it?

  1. cd /usr/share/metasploit-framework/tools/hardware
  2. ruby elm327_relay.rb -s /dev/ttyS0

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

I study a course with url "https://www.hackers-arise.com/post/2017/09/06/metasploit-basics-car-hacking-with-metasploit"

Expected behavior

Start a 127.0.0.1 Server Success

Current behavior

image

Metasploit version

Framework Version: 6.0.31-dev

Additional Information

bcoles commented 3 years ago

Edit: Nevermind, that's not the problem. We'll probably need more info.

You probably don't have the required Ruby gems installed.

https://github.com/rapid7/metasploit-framework/blob/053853a86c986705f12a8c0ad54f1b9947c1ce71/tools/hardware/elm327_relay.rb#L12-L18

$ gem install serialport

More info:

https://blog.rapid7.com/2017/02/08/car-hacking-on-the-cheap/

label-actions[bot] commented 3 years ago

When creating an issue, please ensure that the default issue template has been updated with the required details: https://github.com/rapid7/metasploit-framework/issues/new/choose

Closing this issue. If you believe this issue has been closed in error, please provide any relevant output and logs which may be useful in diagnosing the issue.

bcoles commented 3 years ago

Confirmed.

This issue doesn't exist when launching the executable from a clone of the git repository, but does exist on my Kali install using the metasploit-framework package.

[2021-03-02 01:59:19] root@kali:~/Desktop/metasploit-framework/tools/hardware# ruby elm327_relay.rb 
/var/lib/gems/2.7.0/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_safe_level_2_warning will be removed in Ruby 3.0
/var/lib/gems/2.7.0/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_secure will be removed in Ruby 3.0
Unable to connect to serial port.  See -h for help
[2021-03-02 01:59:22] root@kali:~/Desktop/metasploit-framework/tools/hardware# cd /usr/share/metasploit-framework/tools/hardware
[2021-03-02 01:59:28] root@kali:/usr/share/metasploit-framework/tools/hardware# ruby elm327_relay.rb 
Traceback (most recent call last):
    2: from elm327_relay.rb:420:in `<main>'
    1: from elm327_relay.rb:420:in `new'
elm327_relay.rb:109:in `initialize': uninitialized constant ELM327HWBridgeRelay::ELM327Relay::MSF_LICENSE (NameError)
[2021-03-02 01:59:32] root@kali:/usr/share/metasploit-framework/tools/hardware# 

At a guess, this is due to a path issue failing to pull in the required dependencies, here somewhere:

https://github.com/rapid7/metasploit-framework/blob/053853a86c986705f12a8c0ad54f1b9947c1ce71/tools/hardware/elm327_relay.rb#L33-L40

zhlu32 commented 3 years ago

Confirmed.

This issue doesn't exist when launching the executable from a clone of the git repository, but does exist on my Kali install using the metasploit-framework package.

[2021-03-02 01:59:19] root@kali:~/Desktop/metasploit-framework/tools/hardware# ruby elm327_relay.rb 
/var/lib/gems/2.7.0/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_safe_level_2_warning will be removed in Ruby 3.0
/var/lib/gems/2.7.0/gems/serialport-1.3.1/lib/serialport.rb:25: warning: rb_secure will be removed in Ruby 3.0
Unable to connect to serial port.  See -h for help
[2021-03-02 01:59:22] root@kali:~/Desktop/metasploit-framework/tools/hardware# cd /usr/share/metasploit-framework/tools/hardware
[2021-03-02 01:59:28] root@kali:/usr/share/metasploit-framework/tools/hardware# ruby elm327_relay.rb 
Traceback (most recent call last):
  2: from elm327_relay.rb:420:in `<main>'
  1: from elm327_relay.rb:420:in `new'
elm327_relay.rb:109:in `initialize': uninitialized constant ELM327HWBridgeRelay::ELM327Relay::MSF_LICENSE (NameError)
[2021-03-02 01:59:32] root@kali:/usr/share/metasploit-framework/tools/hardware# 

At a guess, this is due to a path issue failing to pull in the required dependencies, here somewhere:

https://github.com/rapid7/metasploit-framework/blob/053853a86c986705f12a8c0ad54f1b9947c1ce71/tools/hardware/elm327_relay.rb#L33-L40

I add some output test line,which show all right. Help!!! image image

adfoster-r7 commented 3 years ago

Confirmed on Kali:

kali@kali:/usr/share/metasploit-framework/tools/hardware$ ruby elm327_relay.rb 
Traceback (most recent call last):
        2: from elm327_relay.rb:420:in `<main>'
        1: from elm327_relay.rb:420:in `new'
elm327_relay.rb:109:in `initialize': uninitialized constant ELM327HWBridgeRelay::ELM327Relay::MSF_LICENSE (NameError)

Not sure if this particular issue is related to upgrade issues or not - similar to: https://github.com/rapid7/metasploit-framework/issues/14796

dwelch-r7 commented 3 years ago

This issue has already been resolved as of version 6.0.32, the version of framework shipping with kali is an older one so once that gets updated the problem should go away on kali too

You can use the version command to check what version of framework you're currently running