Skip to content

Commit e425646

Browse files
authored
Add files via upload
1 parent 654047a commit e425646

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

tools/gainRoot.src

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
gainRoot = function(shell)
2+
crypto = include_lib("/lib/crypto.so")
3+
if not crypto then
4+
aptclient = include_lib("aptclient.so")
5+
aptclient.update
6+
cryptoinstall = aptclient.install("crypto.so")
7+
if not cryptoinstall then return null
8+
crypto = include_lib("/lib/crypto.so")
9+
end if
10+
11+
victimComputer = shell.host_computer
12+
passwordFile = victimComputer.File("/etc/passwd")
13+
14+
if not passwordFile then return null
15+
if not passwordFile.has_permission("r") then return null
16+
17+
buildPath = ""
18+
for folder in victimComputer.File("/home").get_folders
19+
if folder.has_permission("w") then
20+
buildPath = folder.path
21+
break
22+
end if
23+
end for
24+
if not buildPath then return null
25+
26+
password = crypto.decipher(passwordFile.get_content.split("\n")[0].split(":")[1])
27+
28+
Files = ["/i.src", "/i", "/r.src", "/r"]
29+
for file in Files
30+
if victimComputer.File(buildPath + file) then victimComputer.File(buildPath + file).delete
31+
end for
32+
victimComputer.touch(buildPath, "i.src")
33+
victimComputer.touch(buildPath, "r.src")
34+
35+
injectCodeInstall = "aptclient = include_lib(""/lib/aptclient.so"")" + char(10) + "aptclient.update" + char(10) + "aptclient.install(""libssh.so"")" + char(10) + "service = include_lib(""/lib/libssh.so"")" + char(10) + "install_service(service)" + char(10) + "service = include_lib(""/lib/libssh.so"")" + char(10) + "start_service(service)"
36+
injectCodeRun = "get_shell(""root"",""" + password + """).launch(""" + buildPath + "/i" + """)"
37+
38+
sourceFileI = victimComputer.File(buildPath + "/i.src")
39+
sourceFileR = victimComputer.File(buildPath + "/r.src")
40+
sourceFileI.set_content(injectCodeInstall)
41+
sourceFileR.set_content(injectCodeRun)
42+
buildA = shell.build(buildPath + "/i.src", buildPath)
43+
buildB = shell.build(buildPath + "/r.src", buildPath)
44+
if buildA or buildB then return null
45+
46+
binaryFileI = victimComputer.File(buildPath + "/i")
47+
binaryFileR = victimComputer.File(buildPath + "/r")
48+
49+
shell.launch(buildPath + "/r")
50+
connection = shell.connect_service(victimComputer.local_ip, 22, "root", password)
51+
if not typeof(connection) == "shell" then return null
52+
53+
sourceFileI.delete
54+
sourceFileR.delete
55+
binaryFileI.delete
56+
binaryFileR.delete
57+
return connection
58+
end function

tools/numToSprite.src

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//Imports bltings (https://github.com/irtsa-dev/builtin-greyscript)
2+
import_code("/bin/bltings")
3+
4+
5+
6+
7+
8+
//Necessary separation of the lfill function from String class. (custom)
9+
__lfill = function(string)
10+
return ("0" * [0, 3 - string.len]).max + string
11+
end function
12+
13+
14+
15+
16+
17+
//Public Functions
18+
monoSprite = function(filepath, zeroIsInvisible = true)
19+
file = get_shell.host_computer.File(filepath)
20+
if not file then exit("<color=red>Error: File does not exist.")
21+
22+
imageData = file.get_content.split("\n")
23+
imageSize = imageData[-1].to_int
24+
imageData.pop
25+
26+
for i in range(imageData.len - 1)
27+
imageData[i] = imageData[i].group(3)
28+
if imageData[i][-1].len < 3 then exit("<color=red>Error: Could not correctly parse image data in file.")
29+
end for
30+
31+
picture = ""
32+
for a in range(0, imageData.len - 1)
33+
for b in range(0, imageData[a].len - 1)
34+
color = hex(imageData[a][b])
35+
if color == "0" and zeroIsInvisible then color = "0b0b0c" else color = color + color * (6 / color.len)
36+
picture = picture + "<pos=" + floor(b * (imageSize * 0.6)) + "px><size=" + imageSize + "><sprite=0 color=#" + color + ">"
37+
end for
38+
picture = picture + "<voffset=-" + floor((a + 1) * imageSize * 1.2) + "px>"
39+
end for
40+
41+
return picture
42+
end function
43+
44+
45+
46+
rgbSprite = function(filepath, zeroIsInvisible = true)
47+
file = get_shell.host_computer.File(filepath)
48+
if not file then exit("<color=red>Error: File does not exist.")
49+
50+
imageData = file.get_content.split("\n")
51+
imageSize = imageData[-1].to_int
52+
imageData.pop
53+
54+
for i in range(imageData.len - 1)
55+
imageData[i] = imageData[i].group(9)
56+
if imageData[i][-1].len < 9 then exit("<color=red>Error: Could not correctly parse image data in file.")
57+
end for
58+
59+
picture = ""
60+
for a in range(0, imageData.len - 1)
61+
for b in range(0, imageData[a].len - 1)
62+
color = imageData[a][b].group(3)
63+
if color[-1].len < 3 then exit("<color=red>Error: Could not correctly parse image data in file.")
64+
color.applyFunction(@hex)
65+
color.applyFunction(@__lfill)
66+
color = color.join("")
67+
if color == "000000" and zeroIsInvisible then color = "0b0b0c"
68+
picture = picture + "<pos=" + floor(b * imageSize * 0.6) + "px><size=" + imageSize + "><sprite=0 color=#" + color + ">"
69+
end for
70+
picture = picture + "<voffset=-" + floor((a + 1) * imageSize * 1.2) + "px>"
71+
end for
72+
73+
return picture
74+
end function

tools/progressBar.src

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
__parseStyle = function(style)
2+
style = style.split(",")
3+
if style[-1] == "" then style.pop
4+
if style.len > 3 then return null
5+
6+
if style.len > 1 then showPercent = {"true":true,"false":false}[style[1]] else showPercent = true
7+
if style.len > 2 then encloseBar = {"true":true,"false":false}[style[2]] else encloseBar = true
8+
9+
return [style[0][0], style[0][1]] + [style[0].split(style[0][1])[1].to_int] + [showPercent, encloseBar]
10+
end function
11+
12+
13+
14+
15+
16+
// Style Format : <bar><filler><notches [values between 10-100]>,(true/false to show percent),(true/false on enclosing the bar)
17+
// - note that both boolean values for percent and enclosing default to true if not provided.
18+
//
19+
// Examples:
20+
// #-20,true,true will make a bar that looks like : [####----------------] [20%]
21+
// # 10,true,true will make a bar that looks like : [## ] [20%]
22+
// =-20,false,true will make a bar that looks like : [=====---------------]
23+
// = 20,false will make a bar that looks like : [==== ]
24+
25+
26+
progressBar = function(style, value, limit)
27+
style = __parseStyle(style)
28+
29+
percentage = floor(value / limit * 100)
30+
value = style[0] * floor(value / limit * style[2])
31+
limit = style[1] * (style[2] - value.len)
32+
33+
bar = value + limit
34+
if style[4] then bar = "[" + bar + "]"
35+
if style[3] then bar = bar + " [" + percentage + "%]"
36+
37+
return bar
38+
end function
39+
40+
41+
42+
loopProgressBar = function(style, func, limit)
43+
v = 0
44+
for i in range(limit)
45+
func
46+
47+
v = v + 1
48+
print(progressBar(style, v, limit), true)
49+
end for
50+
end function

0 commit comments

Comments
 (0)