IPC$横向渗透代码实现
2024-09-26 11:17:20
思路
IPC$横向渗透的方法,也是病毒常用的扩散方法。
1、建立连接
2、复制文件到共享中C$
、D$
、E$
、F$
3、获取服务器的时间
3、设定计划任务按时间执行
用到的Windows API
建立网络驱动器 WNetAddConnection2()
WNetAddConnection2W(
_In_ LPNETRESOURCEW lpNetResource, // 资源信息
_In_opt_ LPCWSTR lpPassword, // 密码
_In_opt_ LPCWSTR lpUserName, // 用户名
_In_ DWORD dwFlags // 标志位
);
# 使用
WNetAddConnection2(&netResource, pass, user, CONNECT_UPDATE_PROFILE))
断开网络驱动器 WNetCancelConnection2()
# 使用
WNetCancelConnection2(netResource.lpLocalName, CONNECT_UPDATE_PROFILE, true);
获取局域网内windows server 2003服务器上的时间 NetRemoteTOD()
增加计划任务 NetScheduleJobAdd()
代码实现示例
int ConnectWNet(LPWSTR user, LPWSTR pass, LPWSTR host)
{
std::wstring string;
if (host[0] != L'\\' && host[1] != L'\\')
{
string.append(L"\\\\");
}
string.append(host);
NETRESOURCE netResource;
netResource.lpLocalName = NULL;
netResource.lpRemoteName = (LPWSTR)string.c_str();
netResource.dwType = RESOURCETYPE_ANY;
netResource.lpProvider = NULL;
DWORD ret;
char okip[260];
//创建IPC连接
if ((ret = WNetAddConnection2(&netResource, pass, user, CONNECT_UPDATE_PROFILE)) == ERROR_SUCCESS)
{
sprintf(okip, "%s %s %s\n", host, user, pass);
// 断开IPC连接
DWORD dwConFlig = WNetCancelConnection2(netResource.lpLocalName, CONNECT_UPDATE_PROFILE, true);
return 1;
}
return 0;
}
参考
远程IPC种植木马
https://blog.csdn.net/weixin_34408624/article/details/86248485
WnetAddConnection2
https://blog.csdn.net/VonSdite/article/details/81230306
渗透之——内网IPC$入侵
https://blog.csdn.net/l1028386804/article/details/85995503
最新文章
- jQuery.validator 详解二
- 【bzoj2435】[NOI2011]道路修建
- Python好用的网站收集
- ClassLoader类加载机制
- 《zw版·Halcon-delphi系列原创教程》航母舰载机·视觉定位标志的识别代码
- Mvc4_@RenderBody()和@RenderSection()
- BZOJ1727 [Usaco2006 Open]The Milk Queue 挤奶队列
- 一条结合where、group、orderby的linq语法
- 以莫泰的形式进行页面转换(传值用block)
- 利用redis分布式锁的功能来实现定时器的分布式
- Tomcat 部署Undeployment Failure
- Retrofit 2.0 throwing @Field parameters can only be used with form encoding
- [ES6] 20. Polyfills
- How to get multi-touch working(Linux and Andriod)
- input事件以及中文输入法的处理
- System.getProperty(";catalina.home";)
- [CEOI2008]order
- 修改hosts不必重启 立刻生效
- zookeeper核心-zab协议-《每日五分钟搞定大数据》
- HBase详细概述
热门文章
- org.hibernate.MappingException: class com.itheima.domain.Customer.java not found while looking for property: cust_id 	at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.
- kernel(二)源码浅析
- Thymeleaf中的&;&;解析问题
- 运维监控-使用Zabbix Server 创建 Actions
- MySQL8常见客户端和启动相关参数
- hadoop 2.5 安装部署
- SNMP支持IPv6
- Dubbo服务端结合maven打jar包
- WebRequest/HttpWebRequest/HttpRequest/WebClient/HttpClient的区别
- Linux学习笔记:【002】ARM指令流水线