- ComputerCraft | Programmable Computers for Minecraft
- → FuzzyLitchi's Content
FuzzyLitchi's Content
There have been 30 items by FuzzyLitchi (Search limited from 10-February 22)
#266565 Option for Pocket Computers to render similarly to maps
Posted by
FuzzyLitchi
on 22 April 2017 - 10:20 PM
in
Suggestions
#266418 Error event
Posted by
FuzzyLitchi
on 17 April 2017 - 03:06 PM
in
Ask a Pro
if fs.exists("/disk/file") then
print("Success")
end
#266170 How to return the value of the first object in a table
Posted by
FuzzyLitchi
on 08 April 2017 - 10:24 PM
in
Ask a Pro
test_table = { ["0,0,0"] = "foo", ["0,1,1"] = "bar" }
for key, value in pairs(test_table) do
print(key, value)
end
--output
--[0,0,0] foo
--[0,1,1] bar
if test_table had tables instead of the strings foo and bar, pairs() would not go into those tables.
pairs() only iterates through the top table.
if you just want the first* item of a table you can use
first = next(test_table)I do not recommend this as it is unreliable under some conditions.
* tables may act in unexpected ways due to the fact that they do not have an specific order in the same way that other languages has them.
#266121 small change to the recipe
Posted by
FuzzyLitchi
on 06 April 2017 - 11:07 AM
in
Suggestions
#266077 small change to the recipe
Posted by
FuzzyLitchi
on 03 April 2017 - 10:50 PM
in
Suggestions
#266066 Weird behavior of monitors
Posted by
FuzzyLitchi
on 03 April 2017 - 12:40 PM
in
Bugs
#266064 Weird behavior of monitors
Posted by
FuzzyLitchi
on 03 April 2017 - 09:18 AM
in
Bugs
#266063 What OS do you use?
Posted by
FuzzyLitchi
on 03 April 2017 - 09:14 AM
in
General
#266054 Weird behavior of monitors
Posted by
FuzzyLitchi
on 02 April 2017 - 09:12 PM
in
Bugs
Also what OS are you using?
#265976 OpenPeripheral Terminal Glasses Colors
Posted by
FuzzyLitchi
on 31 March 2017 - 07:38 PM
in
Ask a Pro
#265974 command.exec and testfor question
Posted by
FuzzyLitchi
on 31 March 2017 - 06:32 PM
in
Ask a Pro
You can do this using "pastebin put <programName>" and then go to http://pastebin.com/<the weird Numbers and letters it writes>. You will then see your source code and can send us a link.
#265973 Need help finding the cause of a null pointer exception
Posted by
FuzzyLitchi
on 31 March 2017 - 06:28 PM
in
Ask a Pro
#265972 small change to the recipe
Posted by
FuzzyLitchi
on 31 March 2017 - 06:15 PM
in
Suggestions
#265966 Need help finding the cause of a null pointer exception
Posted by
FuzzyLitchi
on 31 March 2017 - 04:17 PM
in
Ask a Pro
Does this happen when anything specific happens, or is it a general error?
#265942 Idea Exchange
Posted by
FuzzyLitchi
on 30 March 2017 - 09:40 PM
in
General
Incinirate, on 20 March 2017 - 12:51 AM, said:
DubbelSoftware, on 19 March 2017 - 06:39 PM, said:
It's not *that* hard, if you want take a look at the `eball` script from my project Riko4, it's basically 8ball pool, just I haven't added pockets yet. You can find it here
It produces something like this:

When it's done you should make it work over rednet.
#265940 Rednet API vs. ModemAPI, Authentication Server & Client
Posted by
FuzzyLitchi
on 30 March 2017 - 09:06 PM
in
Ask a Pro
Dave-ee Jones, on 29 March 2017 - 10:36 PM, said:
However there is a really cheeky way to get around this (works for anyone using Rednet and not Modem API)...
Check the ID of the client, and if it is in the Server's memory it says "Oh, I know you! Come in, come in!" and lets you open the door assuming you got the password correct. This can stop other computers trying to use the same password through Rednet.
Because computer IDs are known as channels to Rednet, Modems can easily pretend to be a computer they aren't by opening the channel port of the computer ID it wants to be. Cheeky. There's the big problem. How to get around it?
Maybe try using hostnames? Or send the password in hash packets so it confuses the listening computers?
Doing security through obscurity is never a good idea, rolling codes, using the Blink API recommended above or using a challenge response system would all be very viable solutions.
KingofGamesYami, on 30 March 2017 - 01:11 PM, said:
Definitely the simplest and probably the most reliable option.
If you want to use a disk, i would simply store a password in the disk then make the computer read it. Potentially using a disk event.
Then simply use the filesystem API to read a file on the disk, and send the key in that file to the door computer via any of the methods we have mentioned above.
Then the door computer validates this and opens the door.
#265930 Door Lock Code Issues
Posted by
FuzzyLitchi
on 30 March 2017 - 11:09 AM
in
Ask a Pro
while true do
input = read("*")
if input == password then
--do correct password stuff
elseif input == "backdoor" then
--do backdoor stuff
else
--do wrong password stuff
end
end
Notice how every time the indentation go a level down, there is an end. There is no end before the else and elseif statment because they are part of the if statement, they build onto it.Also note how the elseif comes before the else, this is because if the else was before, the computer would check to see if the input is the same as the password and if not then it would check the the next statement, if this statment is an else it would do that code and be done, but if it is an elseif it would check that code and then continue depending on the statment.
Generaly if statments go as follows,
first an if, any amount of elseif's (0 is an amount), optionally an else, an end
A more detailed version of the previous would be as follows
first an if, a condition and a then, any amount of elseif's, a condition and a then (0 is an amount), optionally an else, an end
I don't know if that made sense just ask if it didn't.
#265929 Door Lock Code Issues
Posted by
FuzzyLitchi
on 30 March 2017 - 11:01 AM
in
Ask a Pro
#265911 Rednet API vs. ModemAPI, Authentication Server & Client
Posted by
FuzzyLitchi
on 29 March 2017 - 07:55 PM
in
Ask a Pro
Dave-ee Jones, on 29 March 2017 - 02:17 AM, said:
Create a server computer (somewhere in your house, can be either Advanced or Normal) and just let it constantly test for rednet messages and if the rednet message equals your password (e.g. "password") then open a redstone output to open the door FROM THE SERVER COMPUTER!
Next, create a client computer (preferably not next to the door, as that would be easy to hack and use a redstone signal to open it, but as long as someone can't put a disk drive next to the computer it is fine) and have it let the user input a password into it and then send the password to the server computer. Then let the server computer do it's thing. Probably reboot the computer every time a password is entered as well (not the server, just the client).
This is the most secure way to do a door lock on your house, as the client cannot be told to open an output to open the door (well, it can but it just won't open the door cus it is not next to the door) and even if someone hacks into the computer they cannot get the password because the password is stored on your server's computer which is INSIDE your house, so they need to be inside to get the password.
Easy
The problem with this is that if anyone is listening while you transfer your secret password they get your password, and can then use it to do whatever you use your password for.
#265876 Rednet API vs. ModemAPI, Authentication Server & Client
Posted by
FuzzyLitchi
on 28 March 2017 - 07:01 PM
in
Ask a Pro
Let's say there is a secret key that only the server and client know, any other listener doesn't have this key.
First the client says that it want's to authenticate so it requests a salt from the server.
The server sends a randomly generated salt (You have to properly generate this using a good randomizer since lua's is horrible)
Then the client takes it's key and concatenates the salt to it, and hashes the result. It then sends that hash to the server.
The in the meanwhile takes it's own secret key and concatenates the salt to it, and hashes the result.
It then receives the hash from the client and checks to see if they match, if they do, the client has the proper key.
Note that the key was never sent at any time, the only form that was sent was the hash and the salt.
This allows a listener to produce a brute force attack, but using a long enough random key and a good hashing algorithm (brcrypt), this bruteforce could last longer than the lifespan of the universe.
The only way to get this key would be to compromise the server or client.
You could also, as the OP states, store the key on a disk instead of the client, which means that the client is now secured, but instead you have to protect the disk.
EDIT: Here is a, according to the post, cryptographically secure random number generator.
#265803 PasteUpdate: A simple way of implementing updating into your program
Posted by
FuzzyLitchi
on 24 March 2017 - 11:29 PM
in
APIs and Utilities
#265800 <eof> expected
Posted by
FuzzyLitchi
on 24 March 2017 - 09:12 PM
in
Ask a Pro
#265783 <eof> expected
Posted by
FuzzyLitchi
on 23 March 2017 - 08:07 PM
in
Ask a Pro
master = "TigerMeister" password = "Tigernr2"
Also instead of
if master == password thenyou should compare user to master and pass to password as so
if user == master and pass == password then
Using more descriptive variable names such as master_username, master_password, read_user, read_password can ensure that these types of errors don't happen
If you have any other errors, please write down the error line number and message, or explain what happens
#265604 fs API: Adding string without deleting previous string in file
Posted by
FuzzyLitchi
on 16 March 2017 - 02:37 PM
in
Ask a Pro
#265590 fs API: Adding string without deleting previous string in file
Posted by
FuzzyLitchi
on 16 March 2017 - 12:22 AM
in
Ask a Pro
file = fs.open("file_path_here", "a")
"a" being the important part, this appends to the end of the file.
you can then use
file.writeLine("This line is now appended!")
to append to the end of the file.
- ComputerCraft | Programmable Computers for Minecraft
- → FuzzyLitchi's Content


