2 posts
Location
Florida
Posted 13 February 2013 - 03:13 AM
Question - Programs changing other programs (and then some)
So I just started learning Lua about a day ago, and I'm already getting the hang of it. I was wondering if it is possible to have one program write into another program (for inputting variables that would be different for each user, such as setting a password)
Also, is it possible to generate a random code and making a disk not work unless the code on it and on the console match? I want the disk to only work on one console.
Finally, if both the console and the disk have a "startup" file, which will run first? I'd like to disable the console from using any disk except the one with the matching code on it.
436 posts
Posted 13 February 2013 - 04:57 AM
1) You can, but generally speaking it's easier to use the
fs api to create a single file that other programs can read certain variables off of, instead of changing the code of other programs.
2) You can make a random number generator. It's math.random() and I forget the params. Go
here and crtl-f to find math.random(). However, you cannot specifically restrict disks from working on certain machines without making a rather complex OS designed to do so. It's much easier to just tell the disk it can only run on certain machines. And, as I sense you are trying to protect your computers from malicious disks, then I would suggest making a disk drive with a blank startup program on the top of the computer, and then hiding the fact that there is a disk drive n top of the computer. And that should also answer your third question.
2005 posts
Posted 13 February 2013 - 01:18 PM
To clarify, there is nothing you can do to make it so that a disk only runs on a given machine, but there are things you can do to make a computer only run a given disk.
497 posts
Location
The Big Apple, NY
Posted 14 February 2013 - 01:25 AM
To clarify, there is nothing you can do to make it so that a disk only runs on a given machine, but there are things you can do to make a computer only run a given disk.
Well you could modify the bios…so if the disk is x it will only run on computer xx by finding computer Id and checking it against "accepted" I'd for that disk….might work
997 posts
Location
Wellington, New Zealand
Posted 14 February 2013 - 01:31 AM
To clarify, there is nothing you can do to make it so that a disk only runs on a given machine, but there are things you can do to make a computer only run a given disk.
Well you could modify the bios…so if the disk is x it will only run on computer xx by finding computer Id and checking it against "accepted" I'd for that disk….might work
Only if you don't mind not playing legit - that's equivalent to protecting your home in bedrock.
2 posts
Location
Florida
Posted 14 February 2013 - 11:03 AM
I was able to find that disk startups override computer startups, so I'll just have to hope that users using my software are smart enough not to keep a disk drive attached to the computer, or keep them away from outsiders (assuming grief protections plugins are in place to stop another user from placing a disk drive in an unowned area)
5 posts
Posted 14 February 2013 - 12:08 PM
What I usually do to counter this is just add a function called something like hackerdetected or such and add in the disk.eject(side) where side = top front back left right and bottom. Here is an example of my most recently used one.
function checkhacker() -- Ejects any disks
disk.eject("top")
disk.eject("right")
disk.eject("left")
disk.eject("bottom")
disk.eject("front")
disk.eject("back")
end
1511 posts
Location
Pennsylvania
Posted 14 February 2013 - 12:42 PM
To clarify, there is nothing you can do to make it so that a disk only runs on a given machine, but there are things you can do to make a computer only run a given disk.
Well you could modify the bios…so if the disk is x it will only run on computer xx by finding computer Id and checking it against "accepted" I'd for that disk….might work
Only if you don't mind not playing legit - that's equivalent to protecting your home in bedrock.
If you were to use a block breaker (From Redpower) and had the computer on a loop looking for a disk drive on any side, then when it detects one have the computer emit a redstone pulse to the block breaker taking it to a "Vault" through tubes :)/> Or bedrock works too…
1190 posts
Location
RHIT
Posted 14 February 2013 - 02:20 PM
What I usually do to counter this is just add a function called something like hackerdetected or such and add in the disk.eject(side) where side = top front back left right and bottom. Here is an example of my most recently used one.
function checkhacker() -- Ejects any disks
disk.eject("top")
disk.eject("right")
disk.eject("left")
disk.eject("bottom")
disk.eject("front")
disk.eject("back")
end
The issue with this method is that the user can manually shut down the computer with ctrl+s, and then add a disk drive and restart the computer, thereby circumventing that code. I honestly think the best method would be to do something like this:
Have two computers, one which executes code that would be hidden somewhere and another which handles user input that would be public, and use timers to have the public computer send verification messages every so many seconds. If a verification message is sent too late, then you could have the execution computer "blacklist" the public computer and not allow any more code to be run until the programmer resets it.
Edit: Alternatively, you could have a turtle monitor the block above it and if the block changes in some way (e.g. somebody digs out the stone adjacent to the computer) then the turtle will just do turtle.digUp() turtle.placeUp() (assuming that the turtle has a full inventory of replacement blocks).
2005 posts
Posted 14 February 2013 - 11:33 PM
Rather than timed confirmation messages, you could have the publicly accessible computer catch and send a message every time it gets a suspicious event (like a Ctrl key or a peripheral, for example).
Use a redstone circuit around the computer to check that nobody is breaking in physically. Maybe even have that go to another "screamer" computer that just monitors if the output from the access computer is interrupted (gotta love how cheap computers are).