Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Raspberry Pi / Getting a serial number

Author
Message
sammm
1
Years of Service
User Offline
Joined: 4th Aug 2021
Location:
Posted: 6th Dec 2021 13:52
Hey,

I am trying to find a way to add simple security to my raspberry pi program (simple is the key word). One of the ideas that I am playing around with is to lock my program to just one raspberry pi by using the raspberry pi's unique serial number. Is there a simple way to write an app game kit function to read the raspberry pi's serial number into a variable? Thank you for any suggestions
Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 6th Dec 2021 14:02 Edited at: 6th Dec 2021 14:06
hopefully GetDeviceID() works on Pi.

this will copy the device ID to you clipboard so you can paste it in code/do something with it:

but, if you use that string as-is, it will probably still be visible to anyone who opens the apps .byc file. see here: https://forum.thegamecreators.com/thread/226279

so, that's the simple part but how secure is up to you.
PartTimeCoder
AGK Tool Maker
7
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 6th Dec 2021 16:15 Edited at: 6th Dec 2021 16:16
Quote: "but, if you use that string as-is"


Yup, run it through a simple ROT system, make a small app to encrypt the device id, save it and add it to the main project, so only the encrypted key will be visible in the .byc file.

Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
sammm
1
Years of Service
User Offline
Joined: 4th Aug 2021
Location:
Posted: 7th Dec 2021 13:32
Perfect! Thank you! This is exactly what I was looking for
sammm
1
Years of Service
User Offline
Joined: 4th Aug 2021
Location:
Posted: 9th Dec 2021 15:46 Edited at: 9th Dec 2021 15:46
Bad news - it appears that the getdeviceid() doesn't work on the raspberry pi. Running the command returns nothing. Any other suggestions for locking a program to just one raspberry pi?
Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Dec 2021 01:53 Edited at: 10th Dec 2021 01:55
Quote: "Any other suggestions"

transfer a file to somewhere on your pi named anything, say "my.key" and have the app look for it via GetFileExist()?

you may not want to name it something so obvious or place in anywhere too obvious

meanwhile, consider reporting an issue @ github advising GetDeviceID() returns "" on Pi (include version(s) of Pi & AGK/S tested).
PartTimeCoder
AGK Tool Maker
7
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 10th Dec 2021 15:32 Edited at: 10th Dec 2021 15:41
You can get the device serial number from"/sys/firmware/devicetree/base/serial-number" or "/proc/cpuinfo"

this function is from Node.js but you should be able to transcode it into AppGameKit using "raw:" file paths



https://raspberrypi.stackexchange.com/questions/2086/how-do-i-get-the-serial-number

Edit:, yeah its not implemented on Pi, report it and get that todo changed into a done!

Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee

Attachments

Login to view attachments
Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Dec 2021 15:38 Edited at: 12th Dec 2021 15:39
Request for implementation added: https://github.com/TheGameCreators/AGK-Studio/issues/925

i know there are a number of users who would benefit from increased Pi support so please give the issue a thumbs up.
tboy
9
Years of Service
User Offline
Joined: 1st Jan 2013
Location: UK
Posted: 12th Dec 2021 16:49 Edited at: 12th Dec 2021 16:52
If you use Tier 2, you can get the machine id on the Raspberry Pi like this:

Login to post a reply

Server time is: 2022-10-02 05:02:05
Your offset time is: 2022-10-02 05:02:05