This commit is contained in:
Julian Brammer 2024-06-09 18:11:42 +02:00
parent e7f5217614
commit 213ba4ab55
3 changed files with 8 additions and 7 deletions

View File

@ -10,10 +10,10 @@ function createKeyfile()
print("This will be used to communicate with other Devices and should be the same on different Turtles and Computers that you want to be connected.") print("This will be used to communicate with other Devices and should be the same on different Turtles and Computers that you want to be connected.")
write("Input: ") write("Input: ")
local pwHash = hash.digestStr(read("*") .. "salty salt") local pwHash = hash.digestStr(read("*") .. "salty salt")
basic.writeToFile("brulijam/files/networking-key.txt", pwHash) basic.writeToFile("brulijam/config/networking-key.txt", pwHash)
basic.clearDisplay() basic.clearDisplay()
end end
if not fs.exists "brulijam/files/networking-key.txt" then if not fs.exists "brulijam/config/networking-key.txt" then
createKeyfile() createKeyfile()
end end

View File

@ -9,19 +9,19 @@ function createKeyfile()
print("[NETWORKING]") print("[NETWORKING]")
write("Please enter shared secret for networking: ") write("Please enter shared secret for networking: ")
local pwHash = hash.digestStr(read("*") .. "salty salt") local pwHash = hash.digestStr(read("*") .. "salty salt")
basic.writeToFile("brulijam/files/networking-key.txt", pwHash) basic.writeToFile("brulijam/config/networking-key.txt", pwHash)
basic.clearDisplay() basic.clearDisplay()
end end
local function getKeyfile() local function getKeyfile()
local pwHash = basic.readFileOneline("brulijam/files/networking-key.txt") local pwHash = basic.readFileOneline("brulijam/config/networking-key.txt")
return pwHash return pwHash
end end
local function setup() local function setup()
ownLabel = os.computerLabel() ownLabel = os.computerLabel()
peripheral.find("modem", rednet.open) peripheral.find("modem", rednet.open)
if not fs.exists "brulijam/files/networking-key.txt" then if not fs.exists "brulijam/config/networking-key.txt" then
--createKeyfile() --createKeyfile()
shell.run("/brulijam/lib/createNetworkingKey.lua") shell.run("/brulijam/lib/createNetworkingKey.lua")
end end

View File

@ -61,10 +61,11 @@ shell.run("/brulijam/setLabel.lua")
--create networking key --create networking key
shell.run("/brulijam/lib/createNetworkingKey.lua") shell.run("/brulijam/lib/createNetworkingKey.lua")
--shell.run("/brulijam/systemlock.lua") shell.run("/brulijam/systemlock.lua")
--you shall not pass systemlock --you shall not pass systemlock
--os.reboot() os.reboot()