Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ecc = require "./ecc"
- local t = ecc "ecc"
- local thing = ...
- local function fread(thing)
- local f = fs.open(thing, "r")
- local text = f.readAll()
- f.close()
- return text
- end
- local function hexize(key)
- local out = ""
- for _, v in pairs(key) do
- out = out .. string.format("%.2x", v)
- end
- return out
- end
- local function fwrite(fname, text)
- local f = fs.open(fname, "w")
- f.write(text)
- f.close()
- end
- local pkey = textutils.unserialise(fread ".potato_rds_priv")
- while true do
- local _, side = os.pullEvent "disk"
- local mp = disk.getMountPath(side)
- local path = fs.combine(mp, "startup")
- local sig_path = fs.combine(mp, "signature")
- local UUID_path = fs.combine(mp, "UUID")
- local UUID = math.random(0, 1000000)
- print(UUID)
- disk.setLabel(side, thing)
- local text = fread(thing):gsub("@UUID@", tostring(UUID))
- --print(text, path)
- fwrite(path, text)
- print "Written data."
- fwrite(sig_path, hexize(t.sign(
- pkey,
- text
- )))
- fwrite(UUID_path, tostring(UUID))
- print "Written signature."
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement