NC firmware update (thanks spsf). opencomputers now uses mutiple gpus to speed up rendering and now has net drivers. currently working on kernel memory protections to prevent malicious kernel drivers. spm does not work on opencomputers, this is a known issue i am working on fixing it :D sorry for the slow development.
This commit is contained in:
1 parent
fbaafc7cff
commit
ef4b856ee6
89 files changed
+3955
-563
No files matched your search
@@ -0,0 +1,2 @@
|
||||
Hyperion
|
||||
Astronand
|
||||
@@ -0,0 +1,434 @@
|
||||
--:Minify:--
|
||||
local C_TITLE = 0x00FFFF
|
||||
local C_SELECT = 0xFFFFFF
|
||||
local C_TABLE = 0x00FF00
|
||||
local C_STRING = 0x00FF88
|
||||
local C_NUMBER = 0x24FFFF
|
||||
local C_BOOL = 0xFF6D00
|
||||
local C_NIL = 0x6D6D6D
|
||||
local C_OTHER = 0xDBDBDB
|
||||
local C_ERROR = 0xFF0000
|
||||
|
||||
local function color(col)
|
||||
syscall.devctl(1, "sfgc", col)
|
||||
end
|
||||
|
||||
local function write(s)
|
||||
syscall.write(1, tostring(s))
|
||||
end
|
||||
|
||||
local function clear()
|
||||
syscall.devctl(1, "sfgc", 0xFFFFFF)
|
||||
syscall.devctl(1, "sbgc", 0x000000)
|
||||
syscall.devctl(1, "clear")
|
||||
end
|
||||
|
||||
local function describe(value, detailed)
|
||||
local t = type(value)
|
||||
|
||||
if t == "table" then
|
||||
local count = 0
|
||||
for _ in pairs(value) do
|
||||
count = count + 1
|
||||
end
|
||||
return "{table: " .. count .. " entries}"
|
||||
elseif t == "string" then
|
||||
if detailed then
|
||||
return value
|
||||
end
|
||||
return string.format("%q", value:match("([^\r\n]*)"))
|
||||
elseif t == "function" then
|
||||
return tostring(value)
|
||||
end
|
||||
|
||||
return tostring(value)
|
||||
end
|
||||
|
||||
local function valueColor(value)
|
||||
local t = type(value)
|
||||
|
||||
if t == "table" then
|
||||
return C_TABLE
|
||||
elseif t == "string" then
|
||||
return C_STRING
|
||||
elseif t == "number" then
|
||||
return C_NUMBER
|
||||
elseif t == "boolean" then
|
||||
return C_BOOL
|
||||
elseif t == "nil" then
|
||||
return C_NIL
|
||||
end
|
||||
|
||||
return C_OTHER
|
||||
end
|
||||
|
||||
local function sortedKeys(tbl)
|
||||
local keys = {}
|
||||
|
||||
for key in pairs(tbl) do
|
||||
keys[#keys + 1] = key
|
||||
end
|
||||
|
||||
table.sort(keys, function(a, b)
|
||||
local ta = type(a)
|
||||
local tb = type(b)
|
||||
|
||||
if ta ~= tb then
|
||||
return ta < tb
|
||||
end
|
||||
|
||||
if ta == "string" or ta == "number" then
|
||||
return a < b
|
||||
end
|
||||
|
||||
return tostring(a) < tostring(b)
|
||||
end)
|
||||
|
||||
return keys
|
||||
end
|
||||
|
||||
if syscall.geteuid() ~= 0 then
|
||||
print("This application requires root permissions")
|
||||
return
|
||||
end
|
||||
|
||||
local ok, k = pcall(syscall.rootkit_getKernel)
|
||||
|
||||
if not ok then
|
||||
print("Rootkit is not installed or is not responding")
|
||||
return
|
||||
end
|
||||
|
||||
local path = {
|
||||
{
|
||||
name = "k",
|
||||
value = k,
|
||||
}
|
||||
}
|
||||
|
||||
local selected = 1
|
||||
local scroll = 1
|
||||
local message = ""
|
||||
local dirty = true
|
||||
|
||||
local function currentTable()
|
||||
return path[#path].value
|
||||
end
|
||||
|
||||
local function currentPath()
|
||||
local parts = {}
|
||||
|
||||
for _, item in ipairs(path) do
|
||||
parts[#parts + 1] = item.name
|
||||
end
|
||||
|
||||
return table.concat(parts, ".")
|
||||
end
|
||||
|
||||
local function printAt(x, y, text, col)
|
||||
syscall.devctl(1, "spos", x, y)
|
||||
|
||||
if col then
|
||||
color(col)
|
||||
end
|
||||
|
||||
write(text)
|
||||
color(0xFFFFFF)
|
||||
end
|
||||
|
||||
local function draw()
|
||||
local width, height = syscall.devctl(1, "size")
|
||||
local tbl = currentTable()
|
||||
local keys = sortedKeys(tbl)
|
||||
|
||||
if selected < 1 then
|
||||
selected = 1
|
||||
end
|
||||
|
||||
if selected > #keys and #keys > 0 then
|
||||
selected = #keys
|
||||
end
|
||||
|
||||
local headerLines = 3
|
||||
local footerLines = 2
|
||||
local listHeight = math.max(1, height - headerLines - footerLines-1)
|
||||
|
||||
if selected < scroll then
|
||||
scroll = selected
|
||||
elseif selected >= scroll + listHeight then
|
||||
scroll = selected - listHeight + 1
|
||||
end
|
||||
|
||||
local maxScroll = math.max(1, #keys - listHeight + 1)
|
||||
scroll = math.min(scroll, maxScroll)
|
||||
|
||||
clear()
|
||||
|
||||
printAt(1, 1, "HyperionOS Kernel Explorer", C_TITLE)
|
||||
printAt(1, 2, currentPath(), C_OTHER)
|
||||
printAt(1, 3, tostring(#keys) .. " entries", C_OTHER)
|
||||
|
||||
for row = 1, listHeight do
|
||||
local index = scroll + row - 1
|
||||
local key = keys[index]
|
||||
|
||||
if key ~= nil then
|
||||
local value = tbl[key]
|
||||
local prefix = index == selected and "> " or " "
|
||||
local keyText = "[" .. tostring(key) .. "]"
|
||||
local valText = describe(value)
|
||||
local line = prefix .. keyText .. " = " .. valText
|
||||
|
||||
if #line > width then
|
||||
line = line:sub(1, width)
|
||||
end
|
||||
|
||||
local col = valueColor(value)
|
||||
|
||||
if index == selected then
|
||||
col = C_SELECT
|
||||
end
|
||||
|
||||
printAt(1, headerLines + row, line, col)
|
||||
else
|
||||
printAt(1, headerLines + row, string.rep(" ", width), C_OTHER)
|
||||
end
|
||||
end
|
||||
|
||||
local footer = "Up/Down: Select Enter: Open"
|
||||
printAt(1, height - 1, footer:sub(1, width), C_TITLE)
|
||||
|
||||
footer = "e: Edit Backspace: Back q: Quit"
|
||||
printAt(1, height, footer:sub(1, width), C_TITLE)
|
||||
|
||||
if message ~= "" then
|
||||
printAt(1, height - 2, message:sub(1, width), C_ERROR)
|
||||
end
|
||||
|
||||
color(0xFFFFFF)
|
||||
|
||||
return keys
|
||||
end
|
||||
|
||||
local function inspect(value, key)
|
||||
local _, height = syscall.devctl(1, "size")
|
||||
clear()
|
||||
|
||||
printAt(1, 1, "Value Inspector", C_TITLE)
|
||||
printAt(1, 2, currentPath() .. "." .. tostring(key), C_OTHER)
|
||||
printAt(1, 4, "Type: " .. type(value), valueColor(value))
|
||||
printAt(1, 6, "Value: " .. describe(value, true), valueColor(value))
|
||||
|
||||
if type(value) == "string" then
|
||||
printAt(1, 5, "Length: " .. #value, C_OTHER)
|
||||
elseif type(value) == "table" then
|
||||
local count = 0
|
||||
|
||||
for _ in pairs(value) do
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
printAt(1, 5, "Entries: " .. count, C_OTHER)
|
||||
end
|
||||
|
||||
printAt(1, height, "Press enter to return", C_TITLE)
|
||||
color(0xFFFFFF)
|
||||
|
||||
while true do
|
||||
local keypress = syscall.read(0)
|
||||
|
||||
if keypress == "\n" or keypress == "\r" then
|
||||
return
|
||||
elseif keypress == "q" or keypress == "\27" then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function readLine(prompt)
|
||||
local _, height = syscall.devctl(1, "size")
|
||||
local width = syscall.devctl(1, "size")
|
||||
local input = ""
|
||||
|
||||
while true do
|
||||
printAt(1, height - 2, string.rep(" ", width), C_OTHER)
|
||||
printAt(1, height - 2, prompt .. input, C_TITLE)
|
||||
|
||||
local key = syscall.read(0)
|
||||
|
||||
if key == "\n" or key == "\r" then
|
||||
return input
|
||||
elseif key == "\27" then
|
||||
return nil
|
||||
elseif key == "\8" or key == "\127" then
|
||||
if #input > 0 then
|
||||
input = input:sub(1, -2)
|
||||
end
|
||||
elseif #key == 1 and key >= " " and key <= "~" then
|
||||
if #input < math.max(0, width - #prompt - 1) then
|
||||
input = input .. key
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function parseValue(input)
|
||||
if input == "nil" then
|
||||
return true, nil
|
||||
elseif input == "true" then
|
||||
return true, true
|
||||
elseif input == "false" then
|
||||
return true, false
|
||||
elseif input:sub(1, 2) == "s:" then
|
||||
return true, input:sub(3)
|
||||
elseif input:sub(1, 2) == "n:" then
|
||||
local number = tonumber(input:sub(3))
|
||||
|
||||
if number == nil then
|
||||
return false, "Invalid number"
|
||||
end
|
||||
|
||||
return true, number
|
||||
elseif input:sub(1, 2) == "b:" then
|
||||
local boolean = input:sub(3)
|
||||
|
||||
if boolean == "true" then
|
||||
return true, true
|
||||
elseif boolean == "false" then
|
||||
return true, false
|
||||
end
|
||||
|
||||
return false, "Use b:true or b:false"
|
||||
elseif input=="" then
|
||||
return
|
||||
end
|
||||
|
||||
local number = tonumber(input)
|
||||
|
||||
if number ~= nil then
|
||||
return true, number
|
||||
end
|
||||
|
||||
return true, input
|
||||
end
|
||||
|
||||
local function editValue(tbl, key)
|
||||
local oldValue = tbl[key]
|
||||
local prompt = "New value (nil/true/false/n:/s:): "
|
||||
local input = readLine(prompt)
|
||||
|
||||
if input == nil then
|
||||
message = "Edit cancelled"
|
||||
return
|
||||
end
|
||||
|
||||
local ok, newValue = parseValue(input)
|
||||
|
||||
if not ok then
|
||||
message = tostring(newValue)
|
||||
return
|
||||
end
|
||||
|
||||
local success, err = pcall(function()
|
||||
tbl[key] = newValue
|
||||
end)
|
||||
|
||||
if not success then
|
||||
message = "Edit failed: " .. tostring(err)
|
||||
return
|
||||
end
|
||||
|
||||
message = "Updated [" .. tostring(key) .. "]"
|
||||
dirty = true
|
||||
end
|
||||
|
||||
while true do
|
||||
local keys
|
||||
|
||||
if dirty then
|
||||
keys = draw()
|
||||
dirty = false
|
||||
else
|
||||
keys = sortedKeys(currentTable())
|
||||
end
|
||||
|
||||
local key = syscall.read(0)
|
||||
|
||||
if key == "q" or key == "Q" then
|
||||
break
|
||||
|
||||
elseif key == "\27[A" then
|
||||
if selected > 1 then
|
||||
selected = selected - 1
|
||||
dirty = true
|
||||
end
|
||||
message = ""
|
||||
|
||||
elseif key == "\27[B" then
|
||||
if selected < #keys then
|
||||
selected = selected + 1
|
||||
dirty = true
|
||||
end
|
||||
message = ""
|
||||
|
||||
elseif key == "\n" or key == "\r" then
|
||||
local selectedKey = keys[selected]
|
||||
|
||||
if selectedKey ~= nil then
|
||||
local value = currentTable()[selectedKey]
|
||||
|
||||
if type(value) == "table" then
|
||||
path[#path + 1] = {
|
||||
name = "[" .. tostring(selectedKey) .. "]",
|
||||
value = value,
|
||||
}
|
||||
|
||||
selected = 1
|
||||
scroll = 1
|
||||
message = ""
|
||||
dirty = true
|
||||
else
|
||||
inspect(value, selectedKey)
|
||||
dirty = true
|
||||
end
|
||||
end
|
||||
|
||||
elseif key == "e" or key == "E" then
|
||||
local selectedKey = keys[selected]
|
||||
|
||||
if selectedKey ~= nil then
|
||||
editValue(currentTable(), selectedKey)
|
||||
dirty = true
|
||||
else
|
||||
message = "No entry selected"
|
||||
dirty = true
|
||||
end
|
||||
|
||||
elseif key == "\8" or key == "\127" or key == "\27[D" then
|
||||
if #path > 1 then
|
||||
table.remove(path)
|
||||
selected = 1
|
||||
scroll = 1
|
||||
message = ""
|
||||
else
|
||||
message = "Already at root"
|
||||
end
|
||||
dirty = true
|
||||
|
||||
elseif key == "\27[5~" then
|
||||
local _, height = syscall.devctl(1, "size")
|
||||
local old = selected
|
||||
selected = math.max(1, selected - math.max(1, height - 5))
|
||||
dirty = selected ~= old
|
||||
|
||||
elseif key == "\27[6~" then
|
||||
local _, height = syscall.devctl(1, "size")
|
||||
local old = selected
|
||||
selected = math.min(#keys, selected + math.max(1, height - 5))
|
||||
dirty = selected ~= old
|
||||
end
|
||||
end
|
||||
|
||||
clear()
|
||||
color(0xFFFFFF)
|
||||
write("Kernel Table Explorer exited.\n")
|
||||
@@ -0,0 +1 @@
|
||||
rootkit
|
||||
@@ -0,0 +1,3 @@
|
||||
kernel peak utility
|
||||
this is used for debugging and viewing kernel internals
|
||||
(huge security risk do not use on prod)
|
||||
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
Reference in new issue
Block a user