1. sCrub

    sCrub Naked Wanderer

    I've got an old 2015 rust branch that i want to host a server on, but i need someone with a basic understanding of c# and assembly editing to help me patch the craft.add command exploit. It's server sided so i've heard its simple to patch up in the server's files. Im 99% sure its in Assembly-CSharp.dll.

    I'd do it myself if i was better at writing code lmao
     
  2. Ryan

    Ryan Airdrop Stalker Plugin Developer

    You can accomplish this in a plugin, I helped make it for another BP server a while ago.
    Code (Text):
    using System;

    namespace Oxide.Plugins
    {
        [Info("CraftFix", "Ryan", "1.0.0")]

        class CraftFix : RustPlugin
        {
            object OnServerCommand(ConsoleSystem.Arg arg)
            {
                if (arg.connection != null && arg.cmd.namefull == "craft.add")
                {
                    int amount;
                    if (arg.GetString(1) != null && int.TryParse(arg.GetString(1), out amount) && amount > 999)
                    {
                        var player = arg.connection.player as BasePlayer;
                        PrintToChat(player, "You're not allowed to craft that many");
                        ConVar.Server.Log("/oxide/logs/CraftFix.txt", $"[{DateTime.Now}] {player.displayName} ({player.UserIDString}) is trying to craft {amount}x {ItemManager.CreateByItemID(int.Parse(arg.GetString(0))).info.displayName.english}");
                        return true;
                    }
                }
                return null;
            }
        }
    }
     
  3. sCrub

    sCrub Naked Wanderer

    Well the thing is, im struggling to find a download for Oxide v2.0.1527 which is needed for that rust version. Let me know if u find it anywhere or have it laying around, or if you would wanna contact me and try do it without oxide lol. Thanks anyways buddy
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You'd have to patch it yourself using our patcher.
     
  5. sCrub

    sCrub Naked Wanderer

    Wdym your patcher? Do you have a patcher for old versions? I've looked around a whole lot but i haven't managed to find it, could you be an angel and link me it? Thanks
     
  6. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You can get the patcher from http://dl.bintray.com/oxidemod/builds/, but you'd need to find the old Rust.opj from around the time you want to patch for, otherwise, you'd have to change a lot of stuff.
     
  7. sCrub

    sCrub Naked Wanderer

    My great mate just patched it really simple without oxide lol, anyways much thanks Wulf.
    --- Double Post Merged, Jun 20, 2017 ---
    Also Ryan, ThunderZ is better pce l8
     
  8. Ryan

    Ryan Airdrop Stalker Plugin Developer

    If he's better howcome he didn't fix it originally? :p
     
  9. sCrub

    sCrub Naked Wanderer

    How come you couldn't figure it out but he could? :D Jk ty anyways
     
  10. sCrub

    sCrub Naked Wanderer

    Where would i go to find older versions of Rust.opj?
     
  11. Wulf

    Wulf Community Admin Community Admin Oxide Developer

  12. sCrub

    sCrub Naked Wanderer

    Alright i got that, but how do i get the Rust.opj for that version of rust tho? May i get your guidance please, lol.
     
  13. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Commit history.
     
  14. taehc i

    taehc i Naked Wanderer

    Is there some way someone can make a plugin to fix craft.add in the july 2016 branch? If so that would be a great plugin many servers and peoppe want!
     
  15. Ryan

    Ryan Airdrop Stalker Plugin Developer

    If you read the previous posts you'd see how you can. I even posted a plugin for it here
     
  16. sCrub

    sCrub Naked Wanderer

    Late reply, i know but if you want to patch craft.add without going through the pain of getting oxide for it then ill show how. Ill post my guide here for those who might need it sometime

    First download dnSpy: Releases · 0xd4d/dnSpy · GitHub <- Its for editing the server assembly file

    When you've done that then go to ur server folder. Then go to RustDedicated_Data > Managed and open Assembly-CSharp.dll with dnSpy. Hit the little arrow thing next to the assembly-csharp and then hit the arrow on "-".

    After that navigate down to "ItemCrafter". Click on that. Then rightclick the void called "CanCraft(ItemBlueprint)" thing and hit edit method. Just delete everything from in there and paste my code:

    Code (Text):
    using System;
    using System.Collections.Generic;
    using ProtoBuf;

    // Token: 0x02000318 RID: 792
    public partial class ItemCrafter : EntityComponent<global::BasePlayer>
    {
        // Token: 0x06000E17 RID: 3607 RVA: 0x0004DA04 File Offset: 0x0004BC04
        public bool CanCraft(ItemBlueprint bp, int amount = 1)
        {
            if (amount < 1 || amount > 9000)
            {
                return false;
            }
            foreach (ItemAmount current in bp.ingredients)
            {
                if (!this.DoesHaveUsableItem(current.itemid, (int)current.amount * amount))
                {
                    return false;
                }
            }
            return true;
        }
    }
     
    As you can see the only thing needed to add really is
    if (amount < 1 || amount > 9000)
    {
    return false;
    }

    -And this exploit was in the game forever, gj facepunch LUL
     
    taehc i likes this.
  17. taehc i

    taehc i Naked Wanderer

  18. sCrub

    sCrub Naked Wanderer

    remember to do edit method not edit class. if my code doesnt work or the code for ur branch is different than mine just add in
    Code (Text):
    if (amount < 1 || amount > 9000)
    {
    return false;
    }