[原创]K8 Cscan 大型内网渗透自定义扫描器
https://www.cnblogs.com/k8gege/p/10519321.html
Cscan简介:
何为自定义扫描器?其实也是插件化,但Cscan不需要编程同样可实现自定义功能,这比单纯插件化更容易实现插件功能
Cscan旨在为用户提供一个高度灵活、简单易用、多线程、多网段的插件化扫描框架,减少大量重复性工作提高工作效率
3.3及以上版本分为检测存活和不检测存活主机模式 程序采用多线程批量扫描大型内网IP段C段存活主机(支持上万个C段)
插件含C段旁注扫描、子域名扫描、Ftp密码爆破、Mysql密码爆、系统密码爆破、存活主机扫描、Web信息探测、端口扫描
支持调用任意外部程序或脚本,支持自定义模块,当然也可用于外网扫描(如子域名、C段旁注、FTP破、MYSQL爆破等)
Web信息插件模块:
Cscan内置Delphi、VC、.NET例子,需要更多功能,请自行添加完善
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
namespace CscanDLL
{
public class scan
{
public static string run(string ip)
{
if (string.IsNullOrEmpty(ip))
return "";
else
{
string hostName = "";
//return ip;
//return System.Net.Dns.GetHostByAddress(ip).HostName;
//192.11.22.10 Microsoft-IIS/10.0 IIS Windows
//192.11.22.1 H3C-Miniware-Webs ER3200G2
return ip + "\t" + getURLbanner(ip) + "\t" + GetTitle(getHtml("http://" + ip,2));
//return ip + "\t" + hostName + "\t[" + getURLbanner(ip) + "]\t[" + GetTitle(getHtml("http://" + ip)) + "]";
//return ip + "\t" + System.Net.Dns.GetHostByAddress(ip).HostName;
}
}
private static string getURLbanner(string url)
{
url = "http://" + url;
try
{
var req = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
req.Method = "HEAD";
req.Timeout = 10000;
var res = (HttpWebResponse)req.GetResponse();
if (res.StatusCode == HttpStatusCode.OK || res.StatusCode == HttpStatusCode.Forbidden || res.StatusCode == HttpStatusCode.Redirect || res.StatusCode == HttpStatusCode.MovedPermanently)
{
return res.Server;
}
//res.Close();
return res.Server;
}
catch (WebException ex)
{
return "";
}
}
private static string GetTitle(string html)
{
String regex = @"<title>.+</title>";
String title = Regex.Match(html, regex).ToString();
title = Regex.Replace(title, @"[\""]+", "");
return title;
}
private static string getHtml(string url)
{
try
{
if (!url.ToLower().Contains("https://") && !url.ToLower().Contains("http://"))
url = "http://" + url;
WebClient web = new WebClient();
byte[] buffer = web.DownloadData(url);
return Encoding.UTF8.GetString(buffer);
}
catch (Exception ex)
{
return ex.Message;
}
}
}
}
编译成netscan.dll后,放置Cscan.exe同目录即可(netscan.dll优先级最高,无须删除其它插件)
ip.txt填上当前IP段或内网多个IP段,执行Cscan.exe。
Cscan20对应.net 2.0编译,所以编译的DLL也要对应版本
实战使用哪个版本,由目标系统已安装.net版本来决定。
结果如图
下载:
https://github.com/k8gege/K8CScan