This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Heracles421's profile picture

[CC 1.4] Disk boot up inhibitor V 1.0

Started by Heracles421, 03 January 2013 - 06:28 AM
Heracles421 #1
Posted 03 January 2013 - 07:28 AM
The title explains everything, this program stops people from booting up any startup file located in a floppy disk unless they have a magic word in the first line of the file. This is done by monitoring all the disk drives attached to the computer and checking if someone plugged in a disk, if someone did it'll search for a startup file inside the disk. If the disk has a startup file the computer will read the first line of it to see if the magic word is pressent. If it is, the computer will unlock, allowing you to type anything and/or edit files in the computer. If the computer doesn't find the magic word it will erase the startup file, preventing you from using it

Code:
Spoiler


function startup()
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("Checking for hackers..")
local bOpen, sFreeSide = false, nil
for n,sSide in pairs(rs.getSides()) do
if peripheral.getType( sSide ) == "drive" then
sFreeSide = sSide
end
end
if sFreeSide then
while true do
local sEvent, param = os.pullEvent("disk")
if sEvent == "disk" then
if fs.exists("/disk/startup") then
file = assert(fs.open("/disk/startup", "r"))
key = file.readLine()
file.close()
if key ~= password then
fs.delete("/disk/startup")
print("Hacker discovered! Erasing startup file..")
else
print("Access granted")
break
end
end
end
end
else
print("No drive attached")
print("Press any key to continue")
local sEvent, param = os.pullEvent("key")
if(sEvent == "key") then
startup()
end
end
end

password = "Anything can go in here"
startup()




Installation:
SpoilerOnline:
Spoiler1. Right click any computer in-game
2. Type the following:
  • pastebin get u1X5pTri startup
4. Reboot and enjoy

Offline:
SpoilerMac:
1. Go to Library/Application Support/.minecraft/saves/<your world>/computer/0 and paste both programs there
2. Reboot and enjoy

Windows:
1. Go to %appdata%/.minecraft/saves/<your world>/computer/0 and paste both programs there
2. Reboot and enjoy


Changelog:
SpoilerJanuary 2: First release, V 1.0

Suggestions and/or feedback are greatly appreciated
FUCKCOMPUTERCRAFT!"£ #2
Posted 03 January 2013 - 07:36 AM
Watch in full screen and HD, as that makes it readable.

[media]http://www.youtube.com/watch?v=Re9LasFtmSs[/media]
Heracles421 #3
Posted 03 January 2013 - 07:40 AM
Watch in full screen and HD, as that makes it readable.

Spoiler[media]http://www.youtube.com/watch?v=Re9LasFtmSs[/media]
Ok

Edit: Actually that's easy to fix, just have to check if the variable key == nil or if it is not alphanumeric

Edit2: What exactly do you have into the disk file? Just want to know
FUCKCOMPUTERCRAFT!"£ #4
Posted 03 January 2013 - 07:52 AM
I'm not really wanting to release it, but I will test any new version you produce…
Heracles421 #5
Posted 03 January 2013 - 07:56 AM
I'm not really wanting to release it, but I will test any new version you produce…
I'm trying to find that pesky error, idk what you typed into that disk….
FUCKCOMPUTERCRAFT!"£ #6
Posted 03 January 2013 - 08:21 AM
I'm not really wanting to release it, but I will test any new version you produce…
I'm trying to find that pesky error, idk what you typed into that disk….

So you have no idea?
Heracles421 #7
Posted 03 January 2013 - 08:25 AM
I'm not really wanting to release it, but I will test any new version you produce…
I'm trying to find that pesky error, idk what you typed into that disk….

So you have no idea?
Nope, maybe it's a char that the computer can't read….
FUCKCOMPUTERCRAFT!"£ #8
Posted 03 January 2013 - 08:28 AM
I'm not really wanting to release it, but I will test any new version you produce…
I'm trying to find that pesky error, idk what you typed into that disk….

So you have no idea?
Nope, maybe it's a char that the computer can't read….

Nope not like a letter from a different language etc…
Heracles421 #9
Posted 03 January 2013 - 08:30 AM
Ok, changed a bit the read function, try it
Also uploaded to pastebin
FUCKCOMPUTERCRAFT!"£ #10
Posted 03 January 2013 - 08:33 AM
Just used you're pastebin upload. My method still works but has a different error…

"assertion failed!"
Heracles421 #11
Posted 03 January 2013 - 08:38 AM
Agh, almost get it, I only need to change the assert error and it's done

Try it now
Edited on 03 January 2013 - 07:48 AM
FUCKCOMPUTERCRAFT!"£ #12
Posted 03 January 2013 - 08:51 AM
Did you upload it to pastebin? As I get the same error..
Lyqyd #13
Posted 03 January 2013 - 08:54 AM
Is this a ROM modification? If it's not, all they have to do is shut the computer down first.
FUCKCOMPUTERCRAFT!"£ #14
Posted 03 January 2013 - 08:57 AM
Is this a ROM modification? If it's not, all they have to do is shut the computer down first.

Correct also, didn't think of that (embarrassed face)….
Heracles421 #15
Posted 03 January 2013 - 09:07 AM
Nope, it doesn't modify the ROM, and I know that if you shut down the computer it can be bypassed. There is no other way of stopping the disk boot up other than modifying the ROM itself, but at least this helps in some way

Maybe I can try to stop you from shutting down the computer….
FUCKCOMPUTERCRAFT!"£ #16
Posted 03 January 2013 - 09:18 AM
Nope, it doesn't modify the ROM, and I know that if you shut down the computer it can be bypassed. There is no other way of stopping the disk boot up other than modifying the ROM itself, but at least this helps in some way

Maybe I can try to stop you from shutting down the computer….

How and then yet again there is still my method