Skip to content

Commit

Permalink
v1.0.3: Better stability & bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Riz-ve committed Sep 8, 2024
1 parent 3dc8fe7 commit 4b00b84
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 47 deletions.
68 changes: 41 additions & 27 deletions Xeno/include/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
local XENO_UNIQUE = "%XENO_UNIQUE_ID%"

local HttpService, UserInputService, InsertService = game:FindService("HttpService"), game:FindService("UserInputService"), game:FindService("InsertService")
local RunService, CoreGui = game:FindService("RunService"), game:FindService("CoreGui")
local RunService, CoreGui, StarterGui = game:FindService("RunService"), game:FindService("CoreGui"), game:FindService("StarterGui")
local VirtualInputManager = Instance.new("VirtualInputManager")

if CoreGui:FindFirstChild("Xeno") then return end
Expand All @@ -17,22 +17,25 @@ scriptsContainer.Name = "Scripts"
local Xeno = {
about = {
_name = 'Xeno',
_version = '%XENO_VERSION%'
_version = '%XENO_VERSION%',
_publisher = ".rizve | https://rizve.us.to"
}
}
table.freeze(Xeno.about)

local coreModules = {}
for _, descendant in CoreGui.RobloxGui.Modules:GetDescendants() do
if descendant.ClassName == "ModuleScript" then
if descendant.ClassName == "ModuleScript" and
-- Blacklist some modules so the player does not get core UI issues
not descendant:IsDescendantOf(CoreGui.RobloxGui.Modules.Common) and
not descendant:IsDescendantOf(CoreGui.RobloxGui.Modules.Settings) and
not descendant:IsDescendantOf(CoreGui.RobloxGui.Modules.PlayerList)
then
table.insert(coreModules, descendant)
end
if #coreModules > 5000 then
break
end
end

_G.Xeno = Xeno -- unprotected for sharing across all scripts (easily detected)
_G.Xeno = Xeno

local libs = {
{
Expand All @@ -50,7 +53,10 @@ local libs = {
}

if script.Name == "VRNavigation" then
print("[XENO]: Used ingame method. When you leave the game it might crash!")
StarterGui:SetCore("SendNotification", {
Title = "[Xeno]",
Text = "Used ingame method. When you leave the game it might crash!"
})
end

local lookupValueToCharacter = buffer.create(64)
Expand Down Expand Up @@ -406,7 +412,13 @@ function Bridge:SyncFiles()
end
local success = pcall(function()
getAllFiles("./")
end) if not success then print("[XENO]: Could not sync virtual files from client to external. Server was closed or it is being overloaded") return end
end) if not success then
StarterGui:SetCore("SendNotification", {
Title = "[Xeno]",
Text = "Could not sync virtual files from client to external. Server was closed or it is being overloaded"
})
return
end
local latestSave = {}

local success, r = pcall(function()
Expand Down Expand Up @@ -485,7 +497,7 @@ function Bridge:loadstring(source, chunkName)
required = _require(coreModule)
end)

if type(required) == "table" and required[chunkName] and type(required[chunkName]) == "function" then -- add better checks
if type(required) == "table" and required[chunkName] and type(required[chunkName]) == "function" then
if (#cachedModules > 1) then
for _, module in pairs(cachedModules) do
if module == coreModule then continue end
Expand Down Expand Up @@ -795,10 +807,7 @@ function Xeno.loadstring(source, chunkName)
return nil, chunkName .. tostring(err)
end
local func = Bridge:loadstring(source, chunkName)
local func_env, caller_env = getfenv(func), getfenv(2)
for i, v in caller_env do
func_env[i] = v
end
setfenv(func, getfenv(debug.info(2, 'f')))
return func
end

Expand Down Expand Up @@ -1136,17 +1145,19 @@ local function InternalGet(url)
return result.Body
end

local libsLoaded = 0
do
local libsLoaded = 0

for i, libInfo in pairs(libs) do
task.spawn(function()
libs[i].content = Bridge:loadstring(InternalGet(libInfo.url), libInfo.name)()
--print("[XENO]: Successfully loaded library:", libInfo.name)
libsLoaded += 1
end)
end
for i, libInfo in pairs(libs) do
task.spawn(function()
libs[i].content = Bridge:loadstring(InternalGet(libInfo.url), libInfo.name)()
--print("[XENO]: Successfully loaded library:", libInfo.name)
libsLoaded += 1
end)
end

while libsLoaded < #libs do task.wait() end
while libsLoaded < #libs do task.wait() end
end

local function getlib(libName)
for i, lib in pairs(libs) do
Expand All @@ -1161,7 +1172,9 @@ local HashLib, lz4, DrawingLib = getlib("HashLib"), getlib("lz4"), getlib("Drawi

Xeno.base64 = base64
Xeno.base64_encode = base64.encode
Xeno.base64encode = base64.encode
Xeno.base64_decode = base64.decode
Xeno.base64decode = base64.decode

Xeno.crypt = {
base64 = base64,
Expand Down Expand Up @@ -1588,7 +1601,7 @@ local renv = {
},

delay = delay, elapsedTime = elapsedTime, spawn = spawn, tick = tick, time = time, typeof = typeof,
UserSettings = UserSettings, version = version, wait = wait,
UserSettings = UserSettings, version = version, wait = wait, _VERSION = _VERSION,

task = {
defer = task.defer, delay = task.delay, spawn = task.spawn, wait = task.wait,
Expand Down Expand Up @@ -1735,8 +1748,7 @@ Xeno.setidentity = Xeno.setthreadidentity
Xeno.setthreadcontext = Xeno.setthreadidentity

function Xeno.getsenv(script_instance)
local env = getfenv(2)

local env = getfenv(debug.info(2, 'f'))
return setmetatable({
script = script_instance,
}, {
Expand Down Expand Up @@ -2148,7 +2160,7 @@ end

function Xeno.getscriptclosure(s)
return function()
return table.clone(require(s))
return table.clone(Xeno.require(s))
end
end
Xeno.getscriptfunction = Xeno.getscriptclosure
Expand All @@ -2162,6 +2174,8 @@ function Xeno.isscriptable(object, property)
end
return false
end


-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion Xeno/include/worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace offsets {
constexpr std::uintptr_t ObjectValue = 0xc8;
}

const std::string_view Xeno_Version = "1.0.2";
const std::string_view Xeno_Version = "1.0.3";

template<typename T>
T read_memory(std::uintptr_t address, HANDLE handle);
Expand Down
4 changes: 2 additions & 2 deletions Xeno/src/Xeno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ extern "C" {
}

__declspec(dllexport) void Initialize() {

/*
FILE* conOut;
AllocConsole();
SetConsoleTitleA("Xeno");
freopen_s(&conOut, "CONOUT$", "w", stdout);
freopen_s(&conOut, "CONOUT$", "w", stderr);

*/

HMODULE ntdll = LoadLibraryA("ntdll.dll");
if (!ntdll) {
Expand Down
4 changes: 2 additions & 2 deletions Xeno/src/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void RBXClient::execute(const std::string& source) const {
if (!xenoModule)
return;

xenoModule->SetBytecode(Compile("return{[\"x e n o\"]=function(...)function c(x,y)z=x;for i,v in y do z[i]=v;end;return z;end;setfenv(1,c(getfenv(1),_G.Xeno))setfenv(0,c(getfenv(0),_G.Xeno))for i,f in _G.Xeno do getfenv(0)[i] = f;getfenv(1)[i]=f;end;setmetatable(_G.Xeno,{__newindex=function(t,i,v)rawset(t,i,v);for i,v in t do getfenv()[i]=v;end;end,__index=function(t,val)return rawget(t,val);end});" + source + "\nend};"), true);
xenoModule->SetBytecode(Compile("return{[\"x e n o\"]=function(...)function c(x,y)z=x;for i,v in y do z[i]=v;end;return z;end;setfenv(1,c(getfenv(debug.info(1, 'f')),_G.Xeno))setfenv(0,c(getfenv(debug.info(0, 'f')),_G.Xeno))for i,f in _G.Xeno do getfenv(debug.info(0, 'f'))[i] = f;getfenv(debug.info(1, 'f'))[i]=f;end;setmetatable(_G.Xeno,{__newindex=function(t,i,v)rawset(t,i,v);for i,v in t do getfenv()[i]=v;end;end,__index=function(t,val)return rawget(t,val);end});" + source + "\nend};"), true);
xenoModule->UnlockModule();
}

Expand All @@ -383,7 +383,7 @@ bool RBXClient::loadstring(const std::string& source, const std::string& script_
if (!cloned_module)
return false;

cloned_module->SetBytecode(Compile("return{[ [[" + chunk_name + "]] ] = function(...)function c(x,y)z=x;for i,v in y do z[i]=v;end;return z;end;setfenv(1,c(getfenv(1),_G.Xeno))setfenv(0,c(getfenv(0),_G.Xeno))for i,f in _G.Xeno do getfenv(0)[i] = f;getfenv(1)[i]=f;end;setmetatable(_G.Xeno,{__newindex=function(t,i,v)rawset(t,i,v);for i,v in t do getfenv()[i]=v;end;end,__index=function(t,val)return rawget(t,val);end});" + source + "\nend};"), true);
cloned_module->SetBytecode(Compile("return{[ [[" + chunk_name + "]] ] = function(...)function c(x,y)z=x;for i,v in y do z[i]=v;end;return z;end;setfenv(1,c(getfenv(debug.info(1, 'f')),_G.Xeno))setfenv(0,c(getfenv(debug.info(0, 'f')),_G.Xeno))for i,f in _G.Xeno do getfenv(debug.info(0, 'f'))[i] = f;getfenv(debug.info(1, 'f'))[i]=f;end;setmetatable(_G.Xeno,{__newindex=function(t,i,v)rawset(t,i,v);for i,v in t do getfenv()[i]=v;end;end,__index=function(t,val)return rawget(t,val);end});" + source + "\nend};"), true);
cloned_module->UnlockModule();

return true;
Expand Down
2 changes: 1 addition & 1 deletion XenoUI/ClientsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace XenoUI
{
public partial class ClientsWindow : Window
{
public string XenoVersion = "1.0.2";
public string XenoVersion = "1.0.3";

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct ClientInfo
Expand Down
2 changes: 1 addition & 1 deletion XenoUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<WrapPanel>
<Image Source="/Resources/Images/icon.ico" Margin="10,0,0,0"/>
<TextBlock Foreground="White" FontSize="18" Margin="10,0,0,0" VerticalAlignment="Center" FontFamily="Segoe UI Black" ToolTip="Made by .rizve on Discord (https://rizve.us.to)">Xeno</TextBlock>
<TextBlock Foreground="White" Margin="3,0,0,0" VerticalAlignment="Center" FontFamily="Segoe UI Semibold">v1.02</TextBlock>
<TextBlock Foreground="White" Margin="3,0,0,0" VerticalAlignment="Center" FontFamily="Segoe UI Semibold">v1.03</TextBlock>
</WrapPanel>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
Expand Down
8 changes: 2 additions & 6 deletions XenoUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private async void InitializeWebView2()
string tab = Path.Combine(bin, "editor.lua");

Directory.CreateDirectory(bin);
if (!File.Exists(tab)) File.WriteAllText(tab, "print(\"Hello, World!\")");
if (!File.Exists(tab)) File.WriteAllText(tab, "print(\"Hello, World!\")\n--Made by .rizve on Discord (https://rizve.us.to)");

if (!File.Exists(indexPath)) throw new FileNotFoundException("Could not load the Monaco");

Expand Down Expand Up @@ -82,11 +82,7 @@ private async Task<string> GetScriptContent()
textContent = textContent[1..^1];
}

string unescapedContent = Regex.Unescape(textContent);

string sanitizedContent = new(unescapedContent.Where(c => !char.IsControl(c) || c == '\n' || c == '\r').ToArray());

return sanitizedContent;
return Regex.Unescape(textContent);
}

private async Task SetScriptContent(string content)
Expand Down
6 changes: 1 addition & 5 deletions XenoUI/ScriptsWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;

namespace XenoUI
Expand Down
4 changes: 2 additions & 2 deletions XenoUI/XenoUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ https://github.com/Riz-ve/Xeno</Description>
<Authors>$(AssemblyName)</Authors>
<PackageId>$(AssemblyName)</PackageId>
<Product>Xeno</Product>
<FileVersion>1.0.2</FileVersion>
<AssemblyVersion>1.0.2</AssemblyVersion>
<FileVersion>1.0.3</FileVersion>
<AssemblyVersion>1.0.3</AssemblyVersion>
<Version>1.0.2</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down

0 comments on commit 4b00b84

Please sign in to comment.