C#隐藏进程 我想用c#实现隐藏某一个进程应该怎么实现?请高手指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不知道怎么隐藏,但是可以提供一个方法:把进程名改成 svchost.exe 系统有四五个这样的名字,可以混淆下 其实所谓隐藏进程,是利用微软未公开的一个api(application programming interface,应用程序接口)函数“registerserviceprocess”将自身注册为“服务进程”, Heatol,Fibona :谢谢两位的回到,现在我想挂钩API,应该怎样用C#实现呢,请指教!谢谢!! 感谢各位的回答,我现在对实现方法有了了解,但不知道具体怎么实现,用C#能实现吗?用API钩子勾住Terminate Process应该怎样钩住呢??? C# 不好办吧,如果用DELPHI 或VC可以做,DLL注入之类的 fuqiang19871117 :从来没想过要做病毒,也没有那能力呵呵 http://blog.csdn.net/hack214/archive/2008/04/11/2283599.aspx--------转别人的using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Diagnostics;namespace dllinject{ public partial class Form1 : Form { [DllImport("kernel32.dll")] public static extern int VirtualAllocEx(IntPtr hwnd, Int32 lpaddress, int size, int type, Int32 tect); [DllImport("kernel32.dll")] public static extern Boolean WriteProcessMemory(IntPtr hwnd, int baseaddress, string buffer, int nsize, int filewriten ); [DllImport("kernel32.dll")] public static extern int GetProcAddress(int hwnd, string lpname); [DllImport("kernel32.dll")] public static extern int GetModuleHandleA(string name); [DllImport("kernel32.dll")] public static extern IntPtr CreateRemoteThread(IntPtr hwnd, int attrib, int size, int address, int par, int flags, int threadid); [DllImport("kernel32.dll")] public static extern Int32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds); [DllImport("kernel32.dll")] public static extern Boolean VirtualFree(IntPtr lpAddress, Int32 dwSize,Int32 dwFreeType); Process pname; UInt32 INFINITE= 0xFFFFFFFF; Int32 PAGE_EXECUTE_READWRITE = 0x40; Int32 MEM_COMMIT= 0x1000; Int32 MEM_RESERVE= 0x2000; Int32 MEM_RELEASE= 0x8000; Int32 AllocBaseAddress; IntPtr hwnd; string dllname; Int32 Pid; Boolean ok; Int32 loadaddr; IntPtr ThreadHwnd; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { if (textBox1.Text == "" || textBox1.Text == null) { MessageBox.Show("Pid is null"); return; } if (textBox2.Text == "" || textBox2.Text == null) { MessageBox.Show("dll name is null"); return; } Pid = Int32.Parse(textBox1.Text); dllname = textBox2.Text; } catch(Exception error) { MessageBox.Show(error.Message); return; } try { pname = Process.GetProcessById(Pid); hwnd = pname.Handle; } catch(Exception error) { //当标示pid的进程不存在时发生异常; MessageBox.Show (error.Message); return; } AllocBaseAddress= VirtualAllocEx(hwnd, 0, dllname.Length + 1, MEM_COMMIT+ MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (AllocBaseAddress == 0) { MessageBox.Show("virtualallocex fail"); return; } ok=WriteProcessMemory(hwnd, AllocBaseAddress, dllname, dllname.Length + 1,0); if (!ok) { MessageBox.Show("writeprocessmemory fail"); return; } loadaddr = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"); if (loadaddr == 0) { //取得LoadLibraryA的地址失败时返回 MessageBox.Show("get loadlibraryA fail"); return; } ThreadHwnd=CreateRemoteThread(hwnd, 0, 0, loadaddr, AllocBaseAddress,0, 0); if (ThreadHwnd ==IntPtr.Zero) { MessageBox.Show("createremotethread fail"); return; } MessageBox.Show("ok ,you can check now!!!"); WaitForSingleObject(ThreadHwnd, INFINITE); VirtualFree(hwnd, 0, MEM_RELEASE); //下面开始枚举模块列表; ProcessModuleCollection pmodule = pname.Modules; foreach (ProcessModule processm in pmodule) { listBox1.Items.Add(processm.FileName); } pname.Dispose(); } }} 我现在已经知道了,给大家分享一下,点击程序名右键---属性----将应用程序名改为svchost就ok了 把应用程序名改成Svchost在360安全软件环境下可能导致XP操作系统崩溃.注意!我原先用C#编写了一款木马程序,植入Win7系统蛮好,系统会保护我的木马不被杀,运行起来后,系统认定svchost是Windows安全且必备进程,不允许用户手动删除.并且360安全软件也对它施加保护.这点我觉得蛮搞笑.但是如果运行在XP系统下,和Win7效果大致一样,但是XP不保护它,用户可以手动删除掉.但是在删除的过程中系统会发出警告,360也会发出警告提示用户不要轻易删除系统文件(此时已经把木马当成系统文件了),如果用户强行删除则无碍,如果用户犹豫了选择不删除,接着就导致了XP系统的崩溃,使系统explorer.exe文件遭到破坏,并且无法连接网络等问题. 接着跟帖,在混淆上面选择svchost还是不好,可能导致系统崩溃,破坏了系统.混淆别的进程又容易被发现,所以还是请高手指点,给出一个完美的方案来.顶贴,希望此帖不要沉下去.等待完美答案中... 可以参考下这个:http://wenku.baidu.com/view/03350c0e7cd184254b353527.html 使用zedgraph,怎么改变坐标原点,从左下角改为左上角 c#操作Excel问题 C#发送Email 帮我调试下 ,弄不出来了 微软有没有论坛的开发包?? 如何用ListView控件把一个指定的文件夹中所有的文件列出来? 如何使一个程序在两个显示器显示不同结果? 如何在指定目录下新建文件夹 问问有经验的朋友!都进来看看 C#做类似QQ截图的工具时,将截图保存为文件时将保存对话框也给保存下来了? 查询数据到dataGridView,再以dataGridView里的数据做条件,批量对比另一个表数据! 捕捉鼠标长按消息
把进程名改成 svchost.exe 系统有四五个这样的名字,可以混淆下
--------转别人的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace dllinject
{
public partial class Form1 : Form
{
[DllImport("kernel32.dll")]
public static extern int VirtualAllocEx(IntPtr hwnd, Int32 lpaddress, int size, int type, Int32 tect);
[DllImport("kernel32.dll")]
public static extern Boolean WriteProcessMemory(IntPtr hwnd, int baseaddress, string buffer, int nsize, int filewriten );
[DllImport("kernel32.dll")]
public static extern int GetProcAddress(int hwnd, string lpname);
[DllImport("kernel32.dll")]
public static extern int GetModuleHandleA(string name);
[DllImport("kernel32.dll")]
public static extern IntPtr CreateRemoteThread(IntPtr hwnd, int attrib, int size, int address, int par, int flags, int threadid);
[DllImport("kernel32.dll")]
public static extern Int32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
[DllImport("kernel32.dll")]
public static extern Boolean VirtualFree(IntPtr lpAddress, Int32 dwSize,Int32 dwFreeType);
Process pname;
UInt32 INFINITE= 0xFFFFFFFF;
Int32 PAGE_EXECUTE_READWRITE = 0x40;
Int32 MEM_COMMIT= 0x1000;
Int32 MEM_RESERVE= 0x2000;
Int32 MEM_RELEASE= 0x8000;
Int32 AllocBaseAddress;
IntPtr hwnd;
string dllname;
Int32 Pid;
Boolean ok;
Int32 loadaddr;
IntPtr ThreadHwnd;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (textBox1.Text == "" || textBox1.Text == null)
{
MessageBox.Show("Pid is null"); return;
}
if (textBox2.Text == "" || textBox2.Text == null)
{
MessageBox.Show("dll name is null"); return;
}
Pid = Int32.Parse(textBox1.Text);
dllname = textBox2.Text;
}
catch(Exception error)
{
MessageBox.Show(error.Message); return;
}
try
{
pname = Process.GetProcessById(Pid);
hwnd = pname.Handle;
}
catch(Exception error)
{ //当标示pid的进程不存在时发生异常;
MessageBox.Show (error.Message); return;
}
AllocBaseAddress= VirtualAllocEx(hwnd, 0, dllname.Length + 1, MEM_COMMIT+ MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (AllocBaseAddress == 0)
{
MessageBox.Show("virtualallocex fail"); return;
}
ok=WriteProcessMemory(hwnd, AllocBaseAddress, dllname, dllname.Length + 1,0);
if (!ok)
{
MessageBox.Show("writeprocessmemory fail"); return;
}
loadaddr = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");
if (loadaddr == 0)
{ //取得LoadLibraryA的地址失败时返回
MessageBox.Show("get loadlibraryA fail"); return;
}
ThreadHwnd=CreateRemoteThread(hwnd, 0, 0, loadaddr, AllocBaseAddress,0, 0);
if (ThreadHwnd ==IntPtr.Zero)
{
MessageBox.Show("createremotethread fail"); return;
}
MessageBox.Show("ok ,you can check now!!!");
WaitForSingleObject(ThreadHwnd, INFINITE);
VirtualFree(hwnd, 0, MEM_RELEASE);
//下面开始枚举模块列表;
ProcessModuleCollection pmodule = pname.Modules;
foreach (ProcessModule processm in pmodule)
{
listBox1.Items.Add(processm.FileName);
}
pname.Dispose();
}
}
}