Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //command: chmod
- if params.len < 2 or (params.len == 3 and params[0] != "-R") then exit("Usage: secure [-R(recurse)] [+/-] [path]")
- user = active_user
- permissions = params[0]
- pathFile = params[1]
- isRecursive = 0
- if params.len == 3 then
- permissions = params[1]
- pathFile = params[2]
- isRecursive = 1
- end if
- file = get_shell.host_computer.File(pathFile)
- if file == null then exit("secure: can't find " + pathFile)
- outputMod = ""
- if permissions == "+" then
- outputMod = file.chmod("o+wrx", isRecursive)
- outputMod = file.chmod("g+wrx", isRecursive)
- outputMod = file.chmod("u+wrx", isRecursive)
- else if permissions == "-" then
- outputMod = file.chmod("o-wrx", isRecursive)
- outputMod = file.chmod("g-wrx", isRecursive)
- outputMod = file.chmod("u-wrx", isRecursive)
- end if
- outputOwner = file.set_owner(user, isRecursive)
- outputGroup = file.set_group(user, isRecursive)
- output = "Mod: " + outputMod + "Own: " + outputOwner + "Grp: " + outputGroup
- if outputMod and outputOwner and outputGroup then print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement