From 5094c9e36d1471c8f2c2fea6f9dad7c61089bfa8 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Tue, 9 Feb 2016 17:30:30 -0800 Subject: [PATCH] productkey try --- Tupfile | 1 - src/productkey.nim | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/productkey.nim diff --git a/Tupfile b/Tupfile index bfc4fc2..e69de29 100644 --- a/Tupfile +++ b/Tupfile @@ -1 +0,0 @@ -: |> license -out hackmii |> LICENSE diff --git a/src/productkey.nim b/src/productkey.nim new file mode 100644 index 0000000..82da359 --- /dev/null +++ b/src/productkey.nim @@ -0,0 +1,18 @@ +import os, posix, streams, strutils + +const fileName = "/sys/firmware/acpi/tables/MSDM" + +if getuid() != 0: + quit "run me as root" + +if not fileName.existsFile: + quit "System has no product key" + +var + fin = fileName.newFileStream fmRead + +discard fin.readAll + +let keyData = fin.readAll + +echo keyData