Home page logo

metasploit logo Metasploit mailing list archives

Re: Store MAC into database
From: egypt () metasploit com
Date: Tue, 22 Jun 2010 12:30:46 -0600

Those ASCII characters are the raw bytes of the address.  Here's a
one-liner to convert them to the standard notation:
  mac_str = client.net.config.interfaces.last.mac_addr.unpack("C*").map{|b|
sprintf("%02X", b) }.join(":")

For storing them in the database, take a look at any of the import_*
methods in lib/msf/core/db.rb for an example.  The mac address is just
an attribute of the host, so you can do something like:
  report_host(:address=>..., :mac=>mac_str)

Hope this helped,

On Tue, Jun 22, 2010 at 10:43 AM, eski mo <eskimo.ganges () gmail com> wrote:

How to store Mac address into database. Im writing plugin in which output of
session.net.config.interfaces.last.mac_addr is some ASCII characters ,
how can i store it in a string format intodatabase.

btw sry for sending the last mail wrongly.



  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]