Home AMX User Forum NetLinx Studio

Attention all Brainiacs ? Need MAC

Hi,

Has anyone figured out how to get the MAC address of an NI Master via code? I can telnet in at runtime and do a ?get ip? which will return the MAC, however, if the Master is secured I can?t log in and I?m SOL. I know the information is in the Master somewhere since the MAC does show up in the web interface but I haven?t been able to find a reliable way to extract it.

Any help would be appreciated.

Thanks,
«1

Comments

  • Hi Joe
    I'm not sure but The MAC address is written on the botton of the NI-3000 I have sitting beside me.
  • Joe HebertJoe Hebert Posts: 2,159
    Thanks for the reply Thomas but I?m looking for a way for my program to extract the MAC at runtime.
  • You are the Persistent one!
    Joe Hebert wrote:
    Hi,

    Has anyone figured out how to get the MAC address of an NI Master via code? I can telnet in at runtime and do a ?get ip? which will return the MAC, however, if the Master is secured I can?t log in and I?m SOL. I know the information is in the Master somewhere since the MAC does show up in the web interface but I haven?t been able to find a reliable way to extract it.

    Any help would be appreciated.

    Thanks,

    Just won't take no for an answer. :)

    Patience and courage.
  • Sorry Joe, I mis-read your post. I was thinking you just wanted to get the MAC address from a locked box.
  • VLCNCRZRVLCNCRZR Posts: 216
    Interesting thread!

    Is there any MAC information listed in the NI master's embedded DEVICE_INFO ?

    This could be a valuable piece of data to have on demand from all devices.
  • Mac Adress

    Interesting thought.
    In the past i used the get_unique_id. It also returns a 6 bytes word but it isn't the mac adress. I tryed something else. In our company network i used angry ip scanner to scan the ip adresses. As a bonus you can see the mac adresses of the ip's you scanned. Gues what. Only the mac adresses of windows computers showed up but not the mac adress of the MVP-8400 the WAP or the NI-3000 controller on my desk. Maybe a OS quistion.
    Let's hope AMX give some responce to this question.
    P.S If you only want to use the macadress for a unique number you can also use get_unique_id as a mentioned before.
    Good luck
  • dchristodchristo Posts: 177
    What about opening an IP port in your program and pointing it at the master's web server to get the page that has the MAC info, then parsing it out?

    --D
  • Joe HebertJoe Hebert Posts: 2,159
    If you only want to use the macadress for a unique number you can also use get_unique_id as a mentioned before.
    That?s exactly what I was looking for, a guaranteed unique way to identify a master, which is why I inquired about the MAC. I didn?t see GET_UNIQUE_ID staring me in the face in the help file. Thank you very much.

    Now for a twist: I have an older NI-700 running the latest DUET firmware and the return value of GET_UNIQUE_ID = the MAC address. A 1 in 274 trillion coincidence?

    I wonder why GET_UNIQUE_ID returns the MAC for my NI master but it doesn?t for anyone else? Is there anyone with an NI-700 running the latest DUET firmware (v3.11.323) that wants to try GET_UNIQUE_ID and see if it returns the MAC?
    Only the mac adresses of windows computers showed up but not the mac adress of the MVP-8400 the WAP or the NI-3000 controller on my desk.
    If you do a ping and then an ?arp ?a? from a command prompt, you can get the MAC. Assuming the IP of you Master is a.b.c.d, the following two steps will get your MAC:

    1) C:\> ping a.b.c.d
    The ping replies are printed to the screen

    2) C:\> arp ?a
    The ARP table is printed to the screen cross referencing the IP (logical) address and the MAC (physical) address. Look for the IP of the master and just to the right you?ll find its MAC address.

    You need to do the ?arp ?a? within 15 minutes or so from when you pinged the device for the device to show up in your arp table.
    VLCNCRZR wrote:
    Is there any MAC information listed in the NI master's embedded DEVICE_INFO ?
    Nope, that?s where I thought it would be too.
    Brian wrote:
    Just won't take no for an answer. :)
    Nope, not until I exhaust every possible avenue. You gotta keep asking the question until you get the answer you wanna hear. :)

    Thanks to everyone for your replies. Is there a better forum on the planet? :)
  • Joe HebertJoe Hebert Posts: 2,159
    dchristo wrote:
    What about opening an IP port in your program and pointing it at the master's web server to get the page that has the MAC info, then parsing it out?
    Good thought but if the Master is secured (and you don't know the password) then you can't telnet in via your program to get the MAC or get to the web page to scrape the info out.
  • What planet are you on?
    Joe Hebert wrote:
    Thanks to everyone for your replies. Is there a better forum on the planet? :)

    Anyone still have your "Planet AMX" tee?

    I do and still one of my favorites. :)

    BTW, I verified that a unique ID is not available for the Modero. :(
  • Joe Hebert wrote:
    Now for a twist: I have an older NI-700 running the latest DUET firmware and the return value of GET_UNIQUE_ID = the MAC address. A 1 in 274 trillion coincidence?

    I wonder why GET_UNIQUE_ID returns the MAC for my NI master but it doesn?t for anyone else? Is there anyone with an NI-700 running the latest DUET firmware (v3.11.323) that wants to try GET_UNIQUE_ID and see if it returns the MAC?
    I don't have an NI-700, but... I used GET_UNIQUE_ID on both an NXC-ME260 and an NI-2000 - on the 2000 I tried both Duet and non-Duet firmware. In all cases, I got a number back that was NOT the Mac address. (And yes, the NI-2000 gave me the same number regardless of firmware version)

    Here's my edumacated guesstimate as to why you got the MAC address on an NI-700. I believe that GET_UNIQUE_ID on anything BUT an NI-700 gets the address/serial number of the ICSNet controller chip. This allowed for getting a unique ID on all masters prior to the NI-700, which weren't guaranteed to have Ethernet chips. (That's right - remember the NXC-M?!) The NI-700 (&900) came and threw a wrench into that plan, as it was guaranteed to have Ethernet, but DIDN'T have an ICSNet chip!

    Of course, if the idea is to have/find a unique number for all of your hardware...
    B_Clements wrote:
    BTW, I verified that a unique ID is not available for the Modero.
    Did everyone overlook GET_SERIAL_NUMBER? :)


    - Chip
  • Joe HebertJoe Hebert Posts: 2,159
    Everything that Chip just said:

    Insightful post, you?ve got me sold.
    Chip wrote:
    Did everyone overlook GET_SERIAL_NUMBER? :)

    Not overlooked, just not guaranteed to be there. :( If you downgrade DUET firmware the serial number gets wiped. If you?re looking for a slam dunk no doubt about it UNIQUE_ ID then I think MAC is where it?s at.

    One other interesting side note is the serial number itself:
    GET_SERIAL_NUMBER
    Returns the 16-character serial number of the specified device. The serial number of every device is established when it is manufactured.

    The 16 character serial number of my NI-700 was 14 readable characters followed by 2 NULLs ($00,$00) and was loaded with an older version of DUET. I decided to flash the newest DUET firmware to check out the web interface (which is very cool BTW) and then I did another GET_SERIAL_NUMBER. I got the same 14 readable characters back but the next two characters were a NULL and then a $01. I made an inquiry and came to find out that the serial number is really only 14 characters, not 16.

    So anyhow, the serial number was considered but didn?t make the cut.
  • chillchill Posts: 186
    You could just open a TCP connection to the local master, send it the string "'get ip',$0d" and parse out the MAC address from the reply. Just a thought.
  • viningvining Posts: 4,368
    When I use GET_UNIQUE_ID() the number returned is 0,5,57,95,7,1. If I go to the master web server in the show devices tab the number matches the Physical Address=NeuronID line. This isn't the MAC. If I telnet into the master and do a "get ip" it returns this: MAC Address 00:60:9f:91:17:c2. Why a NeuronID? What's a NeuronID? Why not the MAC?
    Device (ID)Model                 (ID)Mfg                    FWID  Version   
    ----------------------------------------------------------------------------
    00000  (00285)NI Master          (00001)AMX Corp.           00296 v2.32.148
           (PID=0:OID=0) Serial='2105x5040209',0,0,0,0  
           Physical Address=NeuronID 000557950701
           (00285)vxWorks Image      (00001)                    00297 v2.32.145
           (PID=0:OID=1) Serial=N/A                     
           (00285)BootROM            (00001)                    00298 v2.30.142
           (PID=0:OID=2) Serial=N/A                     
           (00256)AXLink I/F uControl(00001)                    00270 v2.00.118
           (PID=0:OID=3) Serial=0000000000000000        
    

    I haven't tried GET_SERIAL_NUMBER but that should also work for what I need which is the ability to get some sort of unique ID that can be installed in a module so that it can't be transferred to other systems with out proper licensing. If you intend to sell modules potential buyers would have to supply some sort of ID which means they need to locate the ID so it could then be hard coded inside the module. On standard installation it just be be installed in each module so that if you get replace for what ever reason your modules can't be re-used.

    The way I look at it if you have your code written in modules they are basically easier to be steel, granted they can't modify it and they can't see how the code was written but as long as it works they probably don't care just lijke with the AMX module.
  • vining wrote:
    When I use GET_UNIQUE_ID() the number returned is 0,5,57,95,7,1. If I go to the master web server in the show devices tab the number matches the Physical Address=NeuronID line. This isn't the MAC. If I telnet into the master and do a "get ip" it returns this: MAC Address 00:60:9f:91:17:c2. Why a NeuronID? What's a NeuronID? Why not the MAC?
    Device (ID)Model                 (ID)Mfg                    FWID  Version   
    ----------------------------------------------------------------------------
    00000  (00285)NI Master          (00001)AMX Corp.           00296 v2.32.148
           (PID=0:OID=0) Serial='2105x5040209',0,0,0,0  
           Physical Address=NeuronID 000557950701
           (00285)vxWorks Image      (00001)                    00297 v2.32.145
           (PID=0:OID=1) Serial=N/A                     
           (00285)BootROM            (00001)                    00298 v2.30.142
           (PID=0:OID=2) Serial=N/A                     
           (00256)AXLink I/F uControl(00001)                    00270 v2.00.118
           (PID=0:OID=3) Serial=0000000000000000        
    

    I haven't tried GET_SERIAL_NUMBER but that should also work for what I need which is the ability to get some sort of unique ID that can be installed in a module so that it can't be transferred to other systems with out proper licensing. If you intend to sell modules potential buyers would have to supply some sort of ID which means they need to locate the ID so it could then be hard coded inside the module. On standard installation it just be be installed in each module so that if you get replace for what ever reason your modules can't be re-used.

    The way I look at it if you have your code written in modules they are basically easier to be steel, granted they can't modify it and they can't see how the code was written but as long as it works they probably don't care just lijke with the AMX module.

    ICSNet / ICSHub is based on Echelon chipsset. These chips have a unique ID named NeuronID.

    I suppose the following:
    In the very first days of NetLinx, the good old NXC mastercard was also sold without Ethernet board, but the NXC-M always had ICSNet/Hub. So this NeuronID was a very unique ID for a master.
    This works pretty well until the NI-700/900 and the NI-x100 series came. The NI-700/900 don't have a Echelon chip and so no NeuronID, and the NI-x100 only have NeuronIDs if the ICSNet/Hub board is installed. We found that the unique ID for those units is the MAC address of the network interface.

    If we need to work with some kind of licences, we use the serial number.
  • viningvining Posts: 4,368
    One would think AMX would change this and be more consistent. Having masters w/o ICSNET return mac addresses while master w/ ICSNET return the NeuronID pretty much forces you to use serial numbers instead of the unique ID.

    The problem with the serial numbers at least w/ the NI-x100s is that the serial number in usually listed on a sticker that is placed on the bottom of the unit making it unreadadle while racked thus requirng you to retrieve the number from the P.O. invoice or via the web server Show Devices tab.
    Originally Posted by Marc Scheibein:
    I suppose the following:
    In the very first days of NetLinx, the good old NXC mastercard was also sold without Ethernet board, but the NXC-M always had ICSNet/Hub. So this NeuronID was a very unique ID for a master.
    This works pretty well until the NI-700/900 and the NI-x100 series came. The NI-700/900 don't have a Echelon chip and so no NeuronID, and the NI-x100 only have NeuronIDs if the ICSNet/Hub board is installed. We found that the unique ID for those units is the MAC address of the network interface.

    If we need to work with some kind of licences, we use the serial number.
  • DarksideDarkside Posts: 345
    vining wrote:
    The problem with the serial numbers at least w/ the NI-x100s is that the serial number in usually listed on a sticker that is placed on the bottom of the unit making it unreadadle while racked thus requirng you to retrieve the number from the P.O. invoice or via the web server Show Devices tab.

    The other obvious flaw in this is that if another NQR company gets a hold of your module and happens to notate the S/N of the clients unit - then replication is too easy for evermore..

    What you could do in this situation is a get_unique_id() at regular intervals and logically fire an allow/disallow flag based on the result. The module ultimately has in input and an output stage and it is here that these flags could be employed.

    If the 'allow' flag is discovered somehow and the programmer just tries to force it high using debug, fundamentally the mainline loop could reset it and then ask the netlinx box for its unique id again. It simply can't be hacked if you are constantly asking for this id.

    Should the get_unique_id() return a value that is not within the module, then a string is sent to 0 advising them that it is not a legit copy.

    Oh, and yes, you would have to know this get_unique_id() value at installation...but, it's you who is installing it and you can code it in. Your test routine could easily report the connected box's id to you which would make it even simpler..

    My two bobs worth
  • jbeamjbeam Posts: 14
    Mac Address on NI-700

    Joe,

    I have used the following on NI-700s with Duet firmware 3.21.343 to display the Mac address on a touch panel with variable text. It works fine. I haven't tried it on any other masters. Hope this helps.

    DEFINE_VARIABLE
    VOLATILE CHAR cMAC_ADDRESS[6]

    DEFINE_START
    cMAC_ADDRESS = GET_UNIQUE_ID()


    SEND_COMMAND vdvTPDevices, "'@TXT',4,FORMAT('%02X',cMAC_ADDRESS[1]),'-',FORMAT('%02X',cMAC_ADDRESS[2]),'-',FORMAT('%02X',cMAC_ADDRESS[3])
  • TurnipTruckTurnipTruck Posts: 1,485
    The other obvious flaw in this is that if another NQR company gets a hold of your module and happens to notate the S/N of the clients unit - then replication is too easy for evermore

    How could one replicate the serial number? Are you saying that the serial number could be cloned? I would assume it's hard-coded into the chipset.

    And what is an NQR company? Not quite right?
  • And what is an NQR company? Not quite right?
    Good one :)



    --John
  • ericmedleyericmedley Posts: 4,177
    I think the DEV_INFO_STRUCT is the internal structure that holds a variety of information such as firmware version, master serial number, etc...

    So, here's some code that might get it done.
    DEFINE_VARIABLE
    
    DEV_INFO_STRUCT sDEVICE_INFO
    
    PERSISTENT CHAR MASTER_SERIAL_NUM[30]
    
    DEFINE_START
    (* I'm not even sure you'd need to do the waitS.  I like to give the master time to breath when it gets going myself... *)
    WAIT 40
      {
      DEVICE_INFO(0:0:0,sDEVICE_INFO)
      }
    WAIT 50
      {
      MASTER_SERIAL_NUM=sDEVICE_INFO.SERIAL_NUMBER
      }
    

    I think that'll give you the serial number of the master. If the Master doesn't match what you think it should, shut off the program and send your nasty-gram.

    I think GET_SERAIL_NUMBER(0:0:0,MASTER_SERIAL_NUM) gets it done even more quickly too.

    I will typically harvest all the stuff in DEV_INFO_STRUCT because it has the firmware versions. I email all this to myself so I can have a good record of master/touch panel/battery base/etc.. firmware versions and quick reference to serial numbers.
  • TurnipTruckTurnipTruck Posts: 1,485
    So does anyone know of a way to clone the serial number or is it good security for a module?
  • yuriyuri Posts: 861
    So does anyone know of a way to clone the serial number or is it good security for a module?

    it can't be cloned without doing some hightech adjustments, so it should be good enough for most of the people :)
  • DarksideDarkside Posts: 345
    So does anyone know of a way to clone the serial number or is it good security for a module?
    NQR is Not Quite Right, indeed!

    Affectionate term for any of 'those' companies out there....

    :-)

    I don't see how you can clone the unique ID either.

    What I was getting at is that if the code was handed to the client and they had to plug the serial number into the code to make it run (as was suggested earlier I believe) and this code was passed on to an NQR down the track so they could mod and upgrade the sys, then this whole program could be re-deployed anywhere.

    What I suggested, and seems to be the general consensus, was embedding the 'get and compare' code into a module and the compare value is hard coded by you to make it run only on system x. This compare is done regularly so that it is always correct and won't work if installed on another processor.
  • viningvining Posts: 4,368
    The intent is to have buyer provide you with the serial number and then hard code inside the compiled module.

    Of course a better way is to sell the module with a random generated code key and have the module connect a server on start up and write the serial number to the server with it's associated key code. Then have then module check the server on every subsequent start up to check to see if the key code has been logged and if so check the serial number. If it matches, allow it to continue if not shut down the module.
  • GSLogicGSLogic Posts: 562
    vining wrote:
    The intent is to have buyer provide you with the serial number and then hard code inside the compiled module.

    Of course a better way is to sell the module with a random generated code key and have the module connect a server on start up and write the serial number to the server with it's associated key code. Then have then module check the server on every subsequent start up to check to see if the key code has been logged and if so check the serial number. If it matches, allow it to continue if not shut down the module.
    This is kind of what I do for all of our game modules. You can download and install them, but after a given time/plays the modules shut down. Once you purchase an unlock code they will start running again. You can download them at our website - under AMX programming. (what a plug)
  • AMXJeffAMXJeff Posts: 450
    Mac Address

    FYI,

    Duet has a static class called SystemConfig. Method inside that class returns a byte array of the MacAddress.

    byte[] macaddress = SystemConfig.getMacAddress()
  • DarksideDarkside Posts: 345
    vining wrote:
    The intent is to have buyer provide you with the serial number and then hard code inside the compiled module.
    Correct. Simple and bullet proof. You are very often supplying hardware and it can be done then.
    vining wrote:
    Of course a better way is to sell the module with a random generated code key and have the module connect a server on start up and write the serial number to the server with it's associated key code. Then have then module check the server on every subsequent start up to check to see if the key code has been logged and if so check the serial number. If it matches, allow it to continue if not shut down the module.
    Ideal but not always possible. Many of our commercial installs will not allow network access and to dedicate a web connection is costly and to some extent unnecessary.
  • viningvining Posts: 4,368
    Stephen Bolton wrote:
    Ideal but not always possible. Many of our commercial installs will not allow network access and to dedicate a web connection is costly and to some extent unnecessary.
    Yeah, you're right! Since I primarliy do resi installs I forget some of the security and logistical restrictions commerical installs have. The only thing you can do to cover all bases then is to get the serial number prior to handing over the module and have it hard coded inside the compiled product. That also makes things a lot simpler.
  • ColzieColzie Posts: 470
    get_unique_id returns zeros?

    I use get_unique_id quite often to identify processors. Works great. Yesterday I installed some code and get_unique_id is returning all zeros. I rebooted several times while working on the system, and eventually I did get a proper "unique id", but after a subsequent reboot I'm back to getting zeros.

    Unfortunately I didn't get the firmware version, it is possible that the master is running a slightly out of date version.

    Any ideas why this would be happening?
Sign In or Register to comment.