【发布时间】:2019-07-26 02:53:59
【问题描述】:
我反编译了一个 .NET 应用程序来编写我自己的注入软件。不想删除线程错误。我尝试了所有方法,但它一直告诉我有问题...
{
using System;
using System.IO;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
internal class NamedPipes
{
public static string luapipename = "IDUNNOPIPE123";
public static void LuaPipe(string script)
{
if (NamedPipeExist(luapipename))
{
new Thread (delegate {
try
{
using (NamedPipeClientStream stream = new NamedPipeClientStream(".", luapipename, PipeDirection.Out))
{
stream.Connect();
using (StreamWriter writer = new StreamWriter(stream, Encoding.Default, 0xf423f))
{
writer.Write(script);
writer.Dispose();
}
stream.Dispose();
}
}
catch (IOException)
{
MessageBox.Show("Error occured connecting to the pipe.", "Connection Failed!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
catch (Exception exception1)
{
MessageBox.Show(exception1.Message.ToString());
}
}).Start();
}
else
{
MessageBox.Show("Please Inject " + Functions.exploitdllname + " before Using this!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
public static bool NamedPipeExist(string pipeName)
{
bool flag;
try
{
int timeout = 0;
if (!WaitNamedPipe(Path.GetFullPath($"\\\\.\\pipe\\{pipeName}"), timeout))
{
bool flag4;
int num2 = Marshal.GetLastWin32Error();
if (num2 != 0)
{
if (num2 != 2)
{
goto TR_0005;
}
else
{
flag4 = false;
}
}
else
{
flag4 = false;
}
return flag4;
}
TR_0005:
flag = true;
}
catch (Exception)
{
flag = false;
}
return flag;
}
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
private static extern bool WaitNamedPipe(string name, int timeout);
}
}
【问题讨论】:
-
它告诉你什么是错的——如果我们不知道问题就帮不上忙
-
这不可能是“完整代码”,因为没有代码以
{开头,其余的在哪里? -
将鼠标悬停在错误上,它说什么?
-
我将鼠标悬停在它上面。这是结果(对不起它的德语):prntscr.com/mt6686
-
@Hogan 没有休息。命名空间定义仅一行(命名空间注入工具)
标签: c# multithreading lua code-injection