same as the last one except luash has better sandboxing now

This commit is contained in:
Izaya 2017-09-13 13:37:26 +10:00
parent 9bbaf67696
commit 781ac82904
2 changed files with 21 additions and 10 deletions

View File

@ -6,7 +6,7 @@
-- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua -- Found Here: https://bitbucket.org/Boolsheet/bslf/src/1ee664885805/bit.lua
-- --
-- Data card support added by https://github.com/SuPeRMiNoR2 -- Data card support added by https://github.com/SuPeRMiNoR2
_G.sha = {} sha = {}
if component then if component then
if component.data and not component.ocemu then if component.data and not component.ocemu then
shamode = "hardware" shamode = "hardware"
@ -216,3 +216,4 @@ local function datac256(data)
return toHex(datac.sha256(data)) return toHex(datac.sha256(data))
end end
end end
return sha

View File

@ -1,17 +1,18 @@
cd=fs.cd local shutil = {}
rm=fs.rm shutil.cd=fs.cd
mkdir=fs.mkdir shutil.rm=fs.rm
cp=fs.cp shutil.mkdir=fs.mkdir
mv=fs.mv shutil.cp=fs.cp
function ls(p) shutil.mv=fs.mv
function shutil.ls(p)
for k,v in ipairs(fs.list(p)) do print(v) end for k,v in ipairs(fs.list(p)) do print(v) end
end end
function cat(p) function shutil.cat(p)
local f=io.open(p) local f=io.open(p)
print(f:read("*a")) print(f:read("*a"))
f:close() f:close()
end end
function ps(f) function shutil.ps(f)
local f=f or "" local f=f or ""
print("PID\tName") print("PID\tName")
for k,v in pairs(os.tasks()) do for k,v in pairs(os.tasks()) do
@ -20,13 +21,22 @@ function ps(f)
end end
end end
end end
function mem() function shutil.mem()
print(" \tTotal\tFree\tUsed") print(" \tTotal\tFree\tUsed")
io.write("Mem\t") io.write("Mem\t")
io.write(tostring(math.floor(computer.totalMemory()/1024)).."K\t") io.write(tostring(math.floor(computer.totalMemory()/1024)).."K\t")
io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t") io.write(tostring(math.floor(computer.freeMemory()/1024)).."K\t")
print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t") print(tostring(math.floor((computer.totalMemory()-computer.freeMemory())/1024)).."K\t")
end end
function shutil.genenv()
local et = os.genenv()
for k,v in pairs(shutil) do
if k ~= "genenv" then
et[k] = v
end
end
return et
end
function loadfile(fn) function loadfile(fn)
local f=io.open(fn,"rb") local f=io.open(fn,"rb")
local S=f:read("*a") local S=f:read("*a")