-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemViewer-WIP.src
More file actions
99 lines (93 loc) · 2.51 KB
/
Copy pathsystemViewer-WIP.src
File metadata and controls
99 lines (93 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
string.color = function(code)
return "<color=#" + code + ">" + self + "</color>"
end function //--"Hello World".color("red")
pc = get_shell.host_computer
returnLine = function(p)
r = p.path
c1 = "FFFF00"
if p.path == "/" then return p.permissions.color(c1) + " " + r.color(c1) + " o:[" + p.owner + "] g:[" + p.group + "]" + " - " + p.size.color("aaaaaa")
if r.split("/").len > 3 then r = "../" + r.split("/")[r.split("/").len - 2] + "/" + r.split("/")[r.split("/").len - 1]
if not p.is_folder then
r = p.name
c1 = "44B1FF"
end if
c2 = "FF0000"
if p.has_permission("r") then c2 = "FFFF00"
if p.has_permission("w") then c2 = "44B1FF"
if p.has_permission("x") then c2 = "FFFFFF"
return p.permissions.color(c2) + " " + r.color(c1) + " o:[" + p.owner + "] g:[" + p.group + "]" + " - " + p.size.color("aaaaaa")
end function
find = function(start)
output = []
pathfinder = function(start)
file = pc.File(start)
if file.is_folder then
output.push(returnLine(file))
for f in file.get_folders
pathfinder(f.path)
end for
for f in file.get_files
output.push(returnLine(f))
end for
end if
end function
pathfinder(start)
print(format_columns(output.join(char(10))))
end function
pathfinder = function(start)
file = pc.File(start)
output = []
if file.is_folder then
output.push(returnLine(file))
for f in file.get_folders
pathfinder(f.path)
end for
for f in file.get_files
output.push(returnLine(f))
end for
if output.len > 0 then print(format_columns(output.join(char(10))))
end if
end function
lockup = function(start, unlock)
file = pc.File(start)
lock = "-"
if unlock then lock = "+"
file.chmod("u" + lock + "wrx", 1)
file.chmod("g" + lock + "wrx", 1)
file.chmod("o" + lock + "wrx", 1)
file.set_owner("root", 1)
file.set_group("root", 1)
end function
noOthers = function(start, unlock)
file = pc.File(start)
lock = "-"
if unlock then lock = "+"
file.chmod("o" + lock + "wrx", 1)
file.set_owner("root", 1)
file.set_group("root", 1)
end function
clearTrash = function(start)
file = pc.File(start)
if file.is_folder then
for f in file.get_folders
if f.name == ".Trash" then
for fi in f.get_files
fi.delete
end for
end if
clearTrash(f.path)
end for
end if
end function
//dir = "/sys"
//l = 1
//if params.len > 0 then dir = params[0]
//if params.len > 1 and typeof(params[1].to_int) == "number" then l = params[1].to_int
//lockup("/sys", 0)
//lockup("/root", 0)
//lockup("/var", 0)
//lockup("/usr", 1)
//lockup("/boot", 0)
//noOthers("/")
//clearTrash("/")
find("/")