Fork me on GitHub

使用C#winform编写渗透测试工具--旁站查询

使用C#winform编写渗透测试工具--旁站查询

本篇文章主要介绍使用C#winform编写渗透测试工具--旁站查询。旁站是指和目标站在同一服务器的其他网站,换句话说,旁站的ip是相同的,当目标站无法渗透时,可以考虑从旁站渗透,增大渗透的可能性。通过python编写脚本,再使用C#winform编写客户端程序调用.py脚本实现行旁站查询。

目录

  1. 实现方法

  2. 代码实现

  3. 软件使用步骤

一、实现方法

如今通常使用在线工具如The Web of WebScan站长工具旁站网等进行查询,这里使用python编写脚本调用api进行查询,网上大多数使用bing,但现在需要申请key,这里调用爱站网的api。

二、代码实现

使用python编写脚本调用Api

脚本代码参考https://github.com/Macr0phag3/ReIPDog项目,可以自己添加额外的api。

C#调用脚本

对于python脚本中包含第三方模块的情况,同样,通过直接创建Process进程,调用python脚本,返回扫描结果。

  • 创建按钮按下事件button1_Click,运行“调用python脚本”函数runPythonsidestation()
private void button8_Click(object sender, EventArgs e)
        {
            richTextBox6.Clear();
            runPythonsidestation();//运行python函数
            label29.Text = "开始扫描...";
        }
  • 实例化一个python进程 调用.py 脚本
void runPythonsidestation()
        {
            string url = textBox6.Text;
            p = new Process();
            string path = "ReIPDog-master/ReIPDog.py";//待处理python文件的路径,本例中放在debug文件夹下
            string sArguments = path;
            ArrayList arrayList = new ArrayList();
            arrayList.Add("-host");
            arrayList.Add(url);//需要挖掘的域名
            foreach (var param in arrayList)//拼接参数
            {
                sArguments += " " + param;
            }
            p.StartInfo.FileName = @"D:\Anaconda\python.exe"; //没有配环境变量的话,可以写"xx\xx\python.exe"的绝对路径。如果配了,直接写"python"即可
            p.StartInfo.Arguments = sArguments;//python命令的参数
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            p.Start();//启动进程
            //MessageBox.Show("启动成功");
            p.BeginOutputReadLine();
            p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived_sidestation);
            Console.ReadLine();
            //p.WaitForExit();
        }
  • 输出接收事件函数
void p_OutputDataReceived_sidestation(object sender, DataReceivedEventArgs e)
        {
            var printedStr = e.Data;
            Action at = new Action(delegate ()
            {
                //接受.py进程打印的字符信息到文本显示框
                richTextBox6.AppendText(printedStr + "\n");
                label29.Text = "扫描结束";
            });
            Invoke(at);
        }

三、软件使用步骤

  • 首先在url栏中输入地址,点击开始查询,最后得到旁站信息。

github地址:https://github.com/Chenmengx/Penetration-testing-tool

posted @ 2021-08-04 21:00  吟风芥尘  阅读(386)  评论(0编辑  收藏  举报