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

Security Card API 1.0 [BETA] With card writing program to start you off!

Started by samdeman22, 12 April 2013 - 06:33 AM
samdeman22 #1
Posted 12 April 2013 - 08:33 AM
The Security Card API - Use a two-level security card system to grant (or deny) access to whatever you want!

With two levels you can create slightly more personalised security cards, for instance, you could have access to a certain floor, but not to every room in it.


Features:

– setDiskLevel(side, lvl1, lvl2) This will write a file in your disk called "level" which contains two levels. NOTE you can use WORDS as your levels, not just numbers.

– getDiskLevel(side) This simply returns lvl1, lvl2 (from the level file in the disk on side) and true. (not sure if true should be returned first?)

Card Writer 1.0_B:

– This is a simple program I made so you can at least write your security cards

-- Note I haven't made a reader program because of the shear variety of things a reader can apply to: opening a door, sending a message, getting special access to a file on a PC, etc. But if you request an example reader I'll make one :)/>

Pastebins:

– Security Card API 1.0_B - simply type "pastebin get HxjGtmFK card" (I recommend calling it card as it's a nice short name for an API) then add the line "os.loadAPI("card")" to startup.

– Security Card Writer1.0_B simply type "pastebin get Q3GVp9VL cardWriter" you can replace cardWriter with whatever, it doesn't matter. As long as you have downloaded and installed the above API this should work straight away.

Pictures of the Card Writer:

– Get them as soon as im on my normal PC :)/>
H4X0RZ #2
Posted 12 April 2013 - 11:03 AM
I didn't looked on your code but I have a tip for you: you can use the String Utils API to encrypt/decrypt your files (on the disk) ^^ It's very safe! I know it because I use It for my programs.

If you need help,ask me. I can help (more and less)


Please do not be so strict with me. English is not my native language.

#EDIT
Here's the link of the api: http://www.computercraft.info/forums2/index.php?/topic/42-cc13string-utils-api/
samdeman22 #3
Posted 12 April 2013 - 12:06 PM
I didn't looked on your code but I have a tip for you: you can use the String Utils API to encrypt/decrypt your files (on the disk) ^^ It's very safe! I know it because I use It for my programs.

If you need help,ask me. I can help (more and less)


Please do not be so strict with me. English is not my native language.

#EDIT
Here's the link of the api: http://www.computerc...ring-utils-api/

Yeha, I hought about security, I'll fix that for the next update, don't worry, I think I can handle the encrypting thing. (think :)/>)
samdeman22 #4
Posted 13 April 2013 - 08:36 AM
when returning on getDiskLevel(side) should I return true first or last? ATM it is at "return lvl1, lvl2, true"
cogilv25 #5
Posted 13 April 2013 - 12:32 PM
don't return true would be my solution as if lvl1 ~= false then the function was successful :)/> hope I helped

p.s. I'm from Scotland too :D/>

p.s.s I just wrote an encryption api which you are welcome to use and edit and whatever else (I don't care what you do with it) but I don't know how secure it is… in my opinion it's secure but it's the first I have ever wrote so dunno http://pastebin.com/Kbgej3DS

EDIT: I forgot to mention that unless you are fairly good at maths encryption can be a pain I tried it with modulus first time…failed :(/> that's why I posted the link in case you get stuck and need help or decide you can't be bothered :)/>

EDIT2: you might want to look at line 27 print(… as the statement doesn't make sense

EDIT3: Added my API to your API edited your program to save password in the level file and made a reader that turns all rs outputs on for 5 seconds hope this helps anyone who wants to use this. also anyone is allowed to do anything with this…well the bits I wrote anyway xD

API: http://pastebin.com/j6M7HPjS
Reader: http://pastebin.com/hB3NeEuW
Writer: http://pastebin.com/ikTa8DyC
samdeman22 #6
Posted 14 April 2013 - 06:30 AM
don't return true would be my solution as if lvl1 ~= false then the function was successful :)/> hope I helped

p.s. I'm from Scotland too :D/>

p.s.s I just wrote an encryption api which you are welcome to use and edit and whatever else (I don't care what you do with it) but I don't know how secure it is… in my opinion it's secure but it's the first I have ever wrote so dunno http://pastebin.com/Kbgej3DS

EDIT: I forgot to mention that unless you are fairly good at maths encryption can be a pain I tried it with modulus first time…failed :(/> that's why I posted the link in case you get stuck and need help or decide you can't be bothered :)/>

EDIT2: you might want to look at line 27 print(… as the statement doesn't make sense

EDIT3: Added my API to your API edited your program to save password in the level file and made a reader that turns all rs outputs on for 5 seconds hope this helps anyone who wants to use this. also anyone is allowed to do anything with this…well the bits I wrote anyway xD

API: http://pastebin.com/j6M7HPjS
Reader: http://pastebin.com/hB3NeEuW
Writer: http://pastebin.com/ikTa8DyC

Yeah, where from? I'm form Orkney :P/>

Thanks for your help! version 1.1 is coming thanks to you:

Planeed Fixes:

– returns lvl1, lvl2 instead of lvl1, lvl2, true

– data is now encrypted (using cogilv25's encryption API)
to the password of whoever has access to the card writer (i.e an admin)

– as the data is encrypted I will remove the feature that names the disk "level "..lvl1.."-"..lvl2.." Card"

(I dont know why I made this a BETA to begin with, pointless, It'll just be normal versions from now :)/>)
samdeman22 #7
Posted 14 April 2013 - 08:15 AM
encountering problem cogilv25, when I use the current API pastebin: eZqzaVDe with the current cardWriter pastebin: 5Wf4sJ0r I write the card, check the file to make sure it wrote correctly (obviously did because it was full of gibberish) but when I try to decrypt it, no matter what password I encrypted it with it always returns "l" and "l" (L and L). Do you know why?

BTW I like the API checking feature of your example, might include that in the next version of this AND the log API :P/>
cogilv25 #8
Posted 15 April 2013 - 01:26 PM
Yes I also had that problem but I got it to work here is the link to the version I am updating when problems occur : http://pastebin.com/Kbgej3DS I'm sure you can implement it yourself ;)/> if this doesn't work then tell me the message being encrypted and I'll play with it till it works :)/> it is a bizarre error if it is the same as the one I experienced: both algorithms appeared to work flawlessly until I saved it and tried to reload it and only one letter would be wrong which didn't make sense as the same operation is done to each letter… if the update doesn't fix it I will haha :D/>

I'm from Shetland :P/> haha internet as crap there as it is here?(50-100kB/s)

I would quite enjoy working on this with you if you want and possibly other projects in the future as up to now I have never had much chance to work with others doing programming :D/>

EDIT: I will play with the card API see if I can find your error and post a fix if I do
cogilv25 #9
Posted 15 April 2013 - 01:38 PM
I tried it with these passwords using the reader I posted and it worked fine but maybe that's just luck xD


lvl1 = "ladida"
lvl2 = "proxy"
pass = "metros"

EDIT: I've been thinking and the only problem with removing the labels is if you have a lot of cards how do you know which ones which haha unless you have a way for more than one card to get through the same door/whatever like a manager would have a top level card but he would only need one card to get him through many doors if you see what I mean…
samdeman22 #10
Posted 16 April 2013 - 08:30 AM
I tried it with these passwords using the reader I posted and it worked fine but maybe that's just luck xD


lvl1 = "ladida"
lvl2 = "proxy"
pass = "metros"

EDIT: I've been thinking and the only problem with removing the labels is if you have a lot of cards how do you know which ones which haha unless you have a way for more than one card to get through the same door/whatever like a manager would have a top level card but he would only need one card to get him through many doors if you see what I mean…

ok, how about a card that openly displays it's level but also has an encrypted password? Then only those who own the card and know the password can get by whatever.

Yes we should work together on other stuff, so far Ive made a log api and this, but im sure we can think of more things.
EDIT - awsumben13 sometimes helps me out on stuff, so you might see him in the process.
(Internet… in Kirkwall between 5 and 15Mb/s (and 80 Mb fibre coming soon!) but everywhere else it is about 50-100kb/s)

I'll test your new api whenever I can :)/>
cogilv25 #11
Posted 20 April 2013 - 11:58 AM
I am going to work on a new version that allows multiple users to access the same terminal but it may take some time haha I will Pm you with the results when I'm done :)/>

p.s. I am working on a few things:

a Peripheral API which auto-magically wraps and manages your peripherals but it is early days and I hit some problems and what with exams coming up decided to leave it haha

an OS called Gold Os which is basically a login screen atm but I want to be innovative and feature rich I am more going for functionality over looks with that one :)/>

fixing any bugs in my encryption API (which I or anyone else finds) xP

and a networking API which I want to use a semi-realistic setup with ISP's, a DNS, emails, remote control of turtles etc

if you want links to any of the mentioned projects ask me and you are welcome to them but don't expect them to work for a while yet :)/>

EDIT: The main Idea with my OS is to put everything I have made or helped make into it and maybe a choice few 3rd party programs xD
Spongy141 #12
Posted 20 April 2013 - 02:35 PM
Nice…………….
samdeman22 #13
Posted 22 April 2013 - 07:51 AM
I am going to work on a new version that allows multiple users to access the same terminal but it may take some time haha I will Pm you with the results when I'm done :)/>/>

p.s. I am working on a few things:

a Peripheral API which auto-magically wraps and manages your peripherals but it is early days and I hit some problems and what with exams coming up decided to leave it haha

an OS called Gold Os which is basically a login screen atm but I want to be innovative and feature rich I am more going for functionality over looks with that one :)/>/>

fixing any bugs in my encryption API (which I or anyone else finds) xP

and a networking API which I want to use a semi-realistic setup with ISP's, a DNS, emails, remote control of turtles etc

if you want links to any of the mentioned projects ask me and you are welcome to them but don't expect them to work for a while yet :)/>/>

EDIT: The main Idea with my OS is to put everything I have made or helped make into it and maybe a choice few 3rd party programs xD

I might do a touuchscreen qwerty keyboard for passwords and such, with either a 1x2 monitor or 2 1x2 monitorS. Can also be used in terminals, can you touch terminals now? (IN-GUI)
cogilv25 #14
Posted 23 April 2013 - 12:08 AM
they have mouse support if that is what you mean? and remember that only advanced computers/monitors support this so maybe have it check that then either do touchscreen etc or something else for standard computers? just to keep it compatible with standard computers :)/>
cogilv25 #15
Posted 02 May 2013 - 06:42 PM
I haven't had much time to work on this due to exams and revising etc.. I will try get some done over the weekend but no promises :P/>
samdeman22 #16
Posted 27 May 2013 - 02:50 PM
I haven't had much time to work on this due to exams and revising etc.. I will try get some done over the weekend but no promises :P/>/>
yeah, mine finish on the 5th of June (after exam leave), so maybe ill finish the keyboard after that