非静态字段,方法或属性需要对象引用

问题描述 投票:0回答:1
using System;
using System.Diagnostics;
using System.Reflection.Emit;
using System.Threading;
using EasyExploits;

namespace ConsoleApp1
{
    class Program
    {
        EasyExploits.Module module = new EasyExploits.Module();

        static void Main(string[] args)
        {
            Module.LaunchExploit();
            Console.ForegroundColor = ConsoleColor.Green;
            Label:
            Console.WriteLine("Please Type 'Inject'");
            string proccess1 = Console.ReadLine();
            if (proccess1 == "Inject")
            {
                Console.WriteLine("");
                Console.WriteLine("Injected!");
                goto Begin;
            }
            else
            {
                goto Label;
            }
            Begin:
            Console.WriteLine("");
            Console.WriteLine("Enter a script and press enter to execute it.");
            string answer = Console.ReadLine();
            Module.ExecuteScript(answer);
            goto Begin





        }
    }
}

因此,我尝试找到解决此问题的方法,但找不到解决方法,所以我遇到了堆栈溢出的问题。无论如何,当将脚本粘贴到输入中时,我的控制台应用程序应该注入EasyExploits.DLL并执行Lua脚本。但是,我得到的错误提示是,“非静态字段,方法或属性'Module.LaunchExploit()'”]的对象引用是必需的,而“非对象的字段需要一个对象引用。 -static字段,方法或属性'Module.ExecuteScript(string)'“我是C#的初学者,并不真正理解此错误,因此如果有人可以通过对初学者友好的简单步骤逐步指导我,那将是很棒。

使用系统;使用System.Diagnostics;使用System.Reflection.Emit;使用System.Threading;使用EasyExploits;名称空间ConsoleApp1 {类Program {EasyExploits.Module模块= ...

c# console-application dll-injection
1个回答
0
投票

您的Main方法是静态的,您可以从静态方法访问同一类的only

© www.soinside.com 2019 - 2024. All rights reserved.