我喜欢黑夜,喜欢网络安全,孤独寂寞的黑夜里,我只需要,一包烟,一台笔记本...
更多
首  页>>博主出品>>C#版二级域名查询工具-SDomainQuery
C#版二级域名查询工具-SDomainQuery
14553 阅
3 推荐
2 评论
没什么技术含量,垃圾代码,共渗透基友专用

    运行环境:微软.net framework 3.5

更新日志:

2012-10-xx

     SDomainQueryV1.0 正式版发布,二级域名查询,导出


2012-11-2

    SDomainQueryV1.2 发布,新增二级域名标题查询


2013-7-4

     SDomainQueryV1.2 正式版发布,修复二级域名查询接口


2013-11-25

    SDomainQueryV1.3 正式版发布,加入导入其他网站域名列表功能
     加入扫描指定的URL功能

 

SDomainQueryV1.0

执行文件下载:

static/uploadFile/1350973651255.rar

源码下载:

static/uploadFile/1350973651866.rar


SDomainQueryV1.1

源码执行文件包:

static/uploadFile/1351832707432.rar



SDomainQueryV1.2

执行文件下载:/static/uploads/file/20130712/20130712221041_460.rar


v1.3下载地址:

/static/uploads/file/20131125/20131125182456_407.rar



核心代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Threading;
using System.Text.RegularExpressions;

namespace domainQuery
{
    public partial class FromMain : Form
    {
        public FromMain()
        {
            InitializeComponent();
        }

        private void btn_query_Click(object sender, EventArgs e)
        {

            if ("".Equals(this.txt_domain.Text))
            {
                MessageBox.Show("请输入域名,注意,不要加http,www,格式:qq.com");
                return;
            }
            this.btn_query.Enabled = false;
            this.btn_queryTitle.Enabled = false;
            this.btn_export.Enabled = false;
            index = 0;
            //创建查询线程
            Thread th = new Thread(new ThreadStart(Query));

            //开始查询线程
            th.Start();
     
        }

        private Listdomains;

        private void Query() {

            domains = new List();

            String domain = this.txt_domain.Text;
            
            String html = GetHttpResponseHtml(domain);

            MatchCollection mc = Regex.Matches(html, @"http://S+" + domain);
            
            //满足pattern的匹配集合               
            foreach (Match m in mc){
                String s = m.ToString();
                if (!domains.Contains(s))
                {
                    domains.Add(s);
                }
            }
            this.lvw_domainInfo.Items.Clear();
            for(int i=0;i");
            Match m = regEncode.Match(w.Headers["content-type"]);
            if (m.Success)
            {
                charset = m.Groups[0].Value;
            }  

            MemoryStream   rawdata   =   new   MemoryStream();   
            byte   []   buffer   =   new   byte[1024];   
            Stream   rs   =   w.GetResponseStream();   
            int   read   =   rs.Read(buffer,0,buffer.Length);   
            while(read>0)   
            {   
                rawdata.Write(buffer,0,read);   
                read   =   rs.Read(buffer,0,buffer.Length);   
            }   
            rs.Close();   

            //如果没有发现content-type,只好从脚本中搜索了 
            if(charset==null)   
            {   
                MemoryStream   ms   =   rawdata;   
                ms.Seek(0,SeekOrigin.Begin);   

                StreamReader   srr   =   new   StreamReader(ms,Encoding.ASCII);   
                String   meta   =   srr.ReadToEnd();   

                if(meta   !=   null)   
                {   
                    int   start_ind   =   meta.IndexOf("charset=");   
                    int   end_ind   =   -1;   
                    if(start_ind   !=   -1)   
                    {   
                        end_ind   =   meta.IndexOf( """,start_ind);  
                         if(end_ind   !=   -1)   
                        {   
                        int   start   =   start_ind   +   8;   
                        charset   =   meta.Substring(start,   end_ind   -   start   +   1);   
                        charset   =   charset.TrimEnd(new Char[]{'>','"'});   
                        }   
                    }   
                }   
            }   

            Encoding   e   =   null;   
            if(charset   ==   null)   
            {   
                e   =   Encoding.UTF8;   
            }   
            else   
            {   
                try   
                {   
                    e   =   Encoding.GetEncoding(charset);   
                }   
                catch(Exception   ee)   //如果编码不存在,使用默认编码 
                {   
                    e   =   Encoding.UTF8;   
                }   
            }   

            rawdata.Seek(0,SeekOrigin.Begin);   

            StreamReader   sr   =   new   StreamReader(rawdata,e);

            return  sr.ReadToEnd();    
        } 

        private int GetResponseCode(String url)
        {
            try
            {

                //设置模拟http访问参数
                Uri uri = new Uri(url);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
                request.Accept = "*/*";
                request.Method = "GET";
                request.Timeout = 10000;
                request.AllowAutoRedirect = false;
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                int code = (int)response.StatusCode;
                request.Abort();
                response.Close();
                return (int)response.StatusCode;
            }
           catch (Exception e)
           {
               
           }
            return 0;
        }

        private void btn_export_Click(object sender, EventArgs e)
        {
            if (domains == null)
            {
                MessageBox.Show("没有找到数据,请先查询!");
            }
            else
            {
                try
                {
                    //保存文件
          
                    FileStream fs = new FileStream(System.IO.Directory.GetCurrentDirectory()+"/"+
                        this.txt_domain.Text+ ".txt", FileMode.OpenOrCreate, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(fs);
                    foreach(String domain in domains)
                    {
                        sw.WriteLine(domain);
                    }
                    sw.Close();
                    fs.Close();
                    MessageBox.Show("导出成功!");
                }

                catch (Exception ex)
                {
                    MessageBox.Show("导出异常!");
                } 
               ;
            }
        }

        private void btn_queryTitle_Click(object sender, EventArgs e)
        {
            if (domains == null) 
            {
                MessageBox.Show("请先查询二级域名后,才能查询标题哦!");
                return;
            }
            this.btn_queryTitle.Enabled = false;
            this.btn_query.Enabled = false;
            //创建查询线程
            Thread th = new Thread(new ThreadStart(BeginGetTitle));

            //开始查询线程
            th.Start();
        }

        private void FromMain_Load(object sender, EventArgs e)
        {

        }

    }
}


已经有 ( 2 ) 位网友对此发表了自己的看法,你也评一评吧! 此文不错,我要推荐-->    推 荐
  • 2楼 发表于:2012-10-23 15:13:12        回复
    已更新,现在支持x86的,源码包的bin目录,下面Debug目录下面的x86的执行文件,x64目录下的x64的执行文件
  • 1楼 发表于:2012-10-23 14:45:57        回复
    不支持X86。?
欢迎参与讨论,请在这里发表您的看法、交流您的观点@禁止各种脚本

  • 点击Top
  • 推荐Top
  • 评论Top
更 多>>
本站采用Java语言开发,Spring框架,欢迎朋友们提意见。重新对页面进行布局,修改了程序,方便开源使用,由于本人美工真的不行 ,很少用背景图片,页面基本都用背景色...
主题:无色无味 | 网站地图|
Copyright (c) 2012-2013 www.shack2.org All Rights Reserved. | 空ICP备111111111号 | 程序设计: shack2 Powered by SJBlog v1.0 联系QQ:1341413415