767 posts
Posted 04 December 2012 - 11:48 PM
Hello.
i have 1 question:
is it possible to make a lock to a folder so:
> ls main
then when i hit the enter, it asks for a password????
do i need a program for that? or do i need to edit the Bios setup?
thanks in advance
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 12:40 AM
well you have edit BIOS functions but to do so but you do not necessarily have to edit the BIOS file to do so, you can edit functions in programs (like your startup file)
the function you need to edit is the fs.list function, just alter it so it uses the original fs.list to get a full list, uses your code to modify the list and remove any hidden folders and then return the list
767 posts
Posted 05 December 2012 - 02:22 AM
Thanks for that, but can you give a quick example on how to hide em? I dont know if there exists fs.removeList()
but thanks. I think then:
shell.setAlias("test")
input = read()
If input == "ls" then
fs.removeList(hList)
Shell.run("ls")
end
i know there Are some big start letters, but im typin on my phone.
is that right? Or am i fully wrong in my code?
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 02:36 AM
here we go
if not fs.hide then
local ls=fs.list
local tHidden={}
fs.list=function(...)
local results=ls(...)
for k,v in pairs(results) do
if tHidden[shell.resolve(v)]==true then
table.remove(results,k)
end
end
return results
end
rawset(fs,'hide',function(dir)
if fs.exists(dir) then
tHidden[shell.resolve(dir)]=true
return true
else
return false
end
end)
end
after executing that code use fs.hide(filename) to hide something and fs.list will not find it
767 posts
Posted 05 December 2012 - 03:06 AM
i did this:
EDIT: Never mind… i figured it out… i just had to set "for k,v in pairs(results) do" to "for k,v in ipairs(results) do"
THANKS!
if not fs.hide then
local ls=fs.list
local tHidden={}
fs.list=function(...)
local results=ls(...)
for k,v in pairs(results) do
if tHidden[shell.resolve(v)]==true then
table.remove(results,k)
end
end
return results
end
rawset(fs, 'hide', function(dir)
if fs.exists(dir) then
tHidden[shell.resolve(dir)]=true
return true
else
return false
end
end)
end
fs.hide("rom")
Edit2:
But… can i, with this, also make a password lock for the "Rom" folder… so when you type "cd rom" or "list rom" or "ls rom" then it will aske for this:
######################################
#THIS FOLDER IS PASSWORD PROTECTED!#
######################################
############
Enter Password
>
############
is that possible?
thanks :D/>
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 03:18 AM
well at least it works :)/> enjoy
you should build an entire attrib library for hidden, system, read only etc
767 posts
Posted 05 December 2012 - 03:26 AM
oh EDIT
i found a error? i want to hide 2 files… but when i then type in "test" (the program your example was in) then it shows the fs.hide("startup") which was the first, list i want to hide… what should i edit, for that?
but thanks..
current code
if not fs.hide then
local ls=fs.list
local tHidden={}
fs.list=function(...)
local results=ls(...)
for k,v in ipairs(results) do
if tHidden[shell.resolve(v)]==true then
table.remove(results,k)
end
end
return results
end
rawset(fs, 'hide', function(dir)
if fs.exists(dir) then
tHidden[shell.resolve(dir)]=true
return true
else
return false
end
end)
end
fs.hide(
"rom"
)
fs.hide(
"startup"
)
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 06:38 AM
you do not need to run my program twice to hide multiple files, it adds an interface you can use to hide whatever you want so start by running test, then use the lua prompt to hide startup fs.hide('startup'), then do the same for rom fs.hide('rom'), you do not need to run test again, that will hide both folders
767 posts
Posted 05 December 2012 - 06:49 AM
Edit: now it works out…. thanks…
i will try to make that password thingy magic but i dont think i can….
because i dont know if i should edit the bios, or the "test"
but thanks anyway.
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 10:07 AM
what do you mean password? if you need help feel free to ask
767 posts
Posted 05 December 2012 - 06:41 PM
Okay.. As i think you saw in the head description ,i said that if i type in
"cd main" "ls main" "list main"
then it will ask like this:
#########
enter password, to go to this config.cfg:
#########
####
> [password]
but i think then, i need to edit bios. Am i right to that?
1548 posts
Location
That dark shadow under your bed...
Posted 05 December 2012 - 07:05 PM
well it is pretty much the same as before, you need to edit bios functions which can be done in the test program