Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local objs = {["container"]=nil,["textOutput"]=nil,["inputBar"]=nil,["fs"]=nil}
- function download(URL,run)
- print("URL --> https://pastebin.com/raw/" .. URL .. "|")
- local hs = game:GetService("HttpService")
- local code = hs:GetAsync("https://pastebin.com/raw/" .. URL, true)
- local codem
- local runn = true
- while (runn and run) do
- codem = script.Parent.run:FireServer(code)
- codem = loadstring(code)
- if (codem==nil) then print("[CODELOADER] RESULT NIL") else runn = false end
- wait()
- print("[CODELOADER] Attempting to compile code")
- end
- local function exe()
- pcall(codem)
- end
- if (run) then
- success, message = pcall( exe )
- if success then
- return true
- else
- print("code error")
- return false
- end
- else
- return code
- end
- end
- function run(code)
- local runn = true
- while (runn) do
- codem = script.Parent.run:FireServer(code)
- codem = loadstring(code)
- if (codem==nil) then print("[CODELOADER] RESULT NIL") else runn = false end
- wait()
- print("[CODELOADER] Attempting to compile code")
- end
- local function exe()
- pcall(codem)
- end
- success, message = pcall( exe )
- if success then
- return true
- else
- print("code error")
- return false
- end
- end
- function save(code,name)
- local sobj = Instance.new("StringValue")
- sobj.Parent = objs["fs"]
- sobj.Name = name
- sobj.Value = code
- objs["textOutput"].Text = "[APT] Code Saved"
- end
- function lookupAPT(name)
- local lib = require(script.Parent.API)
- local addr = lib.repoLookup(name)
- if (addr==nil) then
- print("NILL ERROR")
- return nil
- else
- return download(addr,false)
- end
- end
- function reboot()
- print(" REBOOTING ")
- local hs = game:GetService("HttpService")
- local code = hs:GetAsync("https://pastebin.com/raw/Jwc507P3", true)
- code = loadstring(code)
- code()
- end
- function pcmd()
- print("Processing Command")
- local cmd = objs["inputBar"].Text
- local disp = objs["textOutput"]
- if (string.sub(cmd,1,3)=="apt") then
- print("APT READY")
- disp.Text = "APT READY"
- print(string.sub(cmd,5,7))
- if (string.sub(cmd,5,7)=="get") then
- print("DOWNLOADING")
- local addr = string.sub(cmd,9)
- disp.Text = "[APT] downloading and searching software repo"
- local code = lookupAPT(addr)
- if (code==nil) then
- disp.Text = "[APT] Error downloading code!"
- else
- disp.Text = "[APT] saving code"
- save(code,addr)
- disp.Text = "[APT] code saved as '" .. addr .. "'!"
- end
- end
- if (string.sub(cmd,5,7)=="run") then
- print("Running Software")
- local addr = string.sub(cmd,9)
- local software = objs["fs"]:FindFirstChild(addr)
- local state = run(software.Value)
- end
- if (string.sub(cmd,5,7)=="del") then
- local addr = string.sub(cmd,9)
- local software = objs["fs"]:FindFirstChild(addr)
- software:Destroy()
- disp.Text = "Software " .. addr .. " deleted!"
- end
- if (string.sub(cmd,5,8)=="repo") then
- local addr = string.sub(cmd,10)
- local lib = require(script.Parent.API)
- lib.repoAddURL("https://pastebin.com/raw/" .. addr)
- disp.Text = "Repository URL added!"
- end
- if (string.sub(cmd,5,8)=="mand") then
- local addr = string.sub(cmd,10)
- download(addr)
- end
- end
- end
- function runtime()
- print("Running TERMOS")
- local display = script.Parent.Parent.Frame.screen
- display:ClearAllChildren()
- --Load Objects into View
- local element
- --Start with the container
- element = objs["container"]
- element = Instance.new("Frame")
- element.Parent = display
- element.Size = UDim2.new(1,0,1,0)
- element.BackgroundColor = BrickColor.new(0,0,0)
- objs["container"] = element
- --Now te textOutput
- element = objs["textOutput"]
- element = Instance.new("TextLabel")
- element.Parent = display.Frame
- element.Size = UDim2.new(1,0,0.2,0)
- element.BackgroundTransparency = 1
- element.Text = "> Loaded"
- element.TextColor3 = Color3.new(0,255,0)
- objs["textOutput"] = element
- element = objs["inputBar"]
- element = Instance.new("TextBox")
- element.Parent = display.Frame
- element.Size = UDim2.new(1,0,0.1,0)
- element.Position = UDim2.new(0,0,0.9,0)
- element.BackgroundTransparency = 0
- element.Text = ""
- element.TextColor3 = Color3.new(0,255,0)
- objs["inputBar"] = element
- objs["inputBar"].FocusLost:connect(pcmd)
- --Create TMP FS
- objs["fs"] = Instance.new("Folder")
- objs["fs"].Parent = script.Parent
- objs["fs"].Name = "FS"
- end
- success, message = pcall( runtime )
- if success then
- else
- print("An error occurred: "..message)
- reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement