Advertisement
DOGGYWOOF

Setup

Sep 11th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. -- Function to generate a hash from the computer ID
  2. local function generateHash(id)
  3. -- A simple reversible hash function
  4. return (id * 12345 + 67890) % 1000000
  5. end
  6.  
  7. -- Retrieve the current computer ID
  8. local computerID = os.getComputerID()
  9.  
  10. -- Generate a hash from the computer ID
  11. local hashedID = generateHash(computerID)
  12.  
  13. -- Create a table for the configuration data
  14. local config = {
  15. Hardware = {
  16. HashedID = hashedID
  17. }
  18. }
  19.  
  20. -- Function to create and write the config file in a JSON-like format
  21. local function createConfigFile(config)
  22. local file = fs.open("HardwareID.cfg", "w")
  23.  
  24. -- Convert table to JSON-like format
  25. local jsonContent = "{\n"
  26. jsonContent = jsonContent .. ' "Hardware": {\n'
  27. jsonContent = jsonContent .. ' "HashedID": ' .. config.Hardware.HashedID .. '\n'
  28. jsonContent = jsonContent .. ' }\n'
  29. jsonContent = jsonContent .. '}\n'
  30.  
  31. file.write(jsonContent)
  32. file.close()
  33. print("Configuration file 'HardwareID.cfg' created successfully.")
  34. end
  35.  
  36. -- Create the config file with the hashed ID
  37. createConfigFile(config)
  38. print("Setup completed. Your computer is now registered.")
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement