Node.JS MachineID? [SOLVED]

Discussion in 'Learning Javascript' started by Jonforum, Jul 11, 2017.

  1. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    hey guy is possible to get the machine id in nodeJS
    especialy with this command

    PHP:
    os = require('os');
    The closest to the single machine id would be either the mac or router address.
    But i would like the id machine in Windows(the OS)
    PHP:
    info os.networkInterfaces().Ethernet();
    info[0].address;  //give "fe10::24a1:65b1:8ada:d3b"
    info[0].mac//give "6d:f0:31:e0:47:6c"

    Tell me if this is not possible!!?
    I would actually like to check a key based on the machine id.
     
    #1
  2. Kino

    Kino EIS Game Dev Veteran

    Messages:
    515
    Likes Received:
    674
    Location:
    United States
    First Language:
    English
    Primarily Uses:
    RMMV
    That's about as deep as you can get I think; also, what is this ID?
     
    #2
  3. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    [​IMG]
    you will find it in the Windows proprety or sometime with sofware.
    Is usfull to make a custom key work only with the machine
     
    #3
  4. Kino

    Kino EIS Game Dev Veteran

    Messages:
    515
    Likes Received:
    674
    Location:
    United States
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh okay; well this is just an idea but it may be possible using a child process in NodeJS to accesd the command line and look up the machine id.
     
    #4
  5. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    In fact without command line, the information is in all the windows pc at the same directory.
    is in the file machine.inf
    in C:\Windows\INF

    PHP:
    ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318}

    I did some research, but I found nothing in JS or Node JS to get this information easily.:(
     
    #5
  6. Kino

    Kino EIS Game Dev Veteran

    Messages:
    515
    Likes Received:
    674
    Location:
    United States
    First Language:
    English
    Primarily Uses:
    RMMV
    You'd have to either use nodejs and change directories. To do that. You'd have to use the Path module. That module lets you join directories and move around.

    Or you can do childprocess and use the command line, but it's not as flexible.

    If you know Unix:
    https://www.npmjs.com/package/shelljs

    Can be used on any platform
     
    #6
  7. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    HEHE youpi i find i way

    PHP:
    var fs = require('fs');
    var 
    path process.cwd();
    var 
    buffer fs.readFileSync('C:\\Windows\\INF\\machine.inf');
    console.log(buffer.toString());
    SFSFGG.png
    symply need use regex after to catch(match) the line i need
     
    #7
    Kino likes this.

Share This Page