博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ASP.NET基础学习(暴力破解密码)
阅读量:4502 次
发布时间:2019-06-08

本文共 2218 字,大约阅读时间需要 7 分钟。

首先写出一段登陆程序:

//ashx端<%@ WebHandler Language="C#" Class="AddCalation" %>using System;using System.Web;public class AddCalation : IHttpHandler {        public void ProcessRequest (HttpContext context) {        context.Response.ContentType = "text/html";                string ispostback=context.Request["isback"];        string username = context.Request["username"];        string password = context.Request["password"];        if (ispostback == "yes")        {            if (username == "admin" && password == "2314")            {                context.Response.Write("登陆成功");            }            else            {                context.Response.Write("登陆失败");            }                    }        else        {            username = string.Empty;            password = string.Empty;        }        string path = context.Server.MapPath("AddCalation.html");        string content = System.IO.File.ReadAllText(path);        content=content.Replace("@user",username);        content = content.Replace("@pass", password);        context.Response.Write(content);    }     public bool IsReusable {        get {            return false;        }    }}//html端    加法计算器    

然后写一段C#控制台程序进行暴力破解

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Net; 5 using System.Text; 6 using System.Threading.Tasks; 7  8  9 namespace PasswordBreak10 {11     class Program12     {13         static void Main(string[] args)14         {15             WebClient wc = new WebClient();16             wc.Encoding = Encoding.UTF8;17             string s="";18             for (int i = 0; i < 5000; i++)19             {20                 s = wc.DownloadString("http://localhost:41566/AddCalation.ashx?isback=yes&username=admin&password=" + i);21                 if (s.Contains("登陆成功"))22                 { Console.WriteLine(i); break; }23             }24             Console.WriteLine();25             Console.Write(s);26             Console.ReadKey();27         }28     }29 }

通过循环依次试验密码来破解自己写的登陆代码中的密码

所以说登陆端口的安全性非常重要。

转载于:https://www.cnblogs.com/sytu/p/4115187.html

你可能感兴趣的文章
BZOJ 1477 青蛙的约会 【扩展欧几里得】
查看>>
用phpexcelreader将excel文件读入到mysql中(转载)
查看>>
As3 Socket高低位
查看>>
15. 三数之和
查看>>
使用angular.js获取form表单中的信息
查看>>
TestNG
查看>>
高精——模板
查看>>
生成CFree 5.0 注册码
查看>>
磁力链接
查看>>
【问题解决方案】之 关于某江加密视频swf专用播放器仍无法播放的问题
查看>>
2014,码农梦想,先从态度开始!
查看>>
常用板子
查看>>
linux中安装eclipse--CnetOS6.5
查看>>
应用层拒绝服务攻击
查看>>
JavaScript学习总结(五)——jQuery插件开发与发布
查看>>
广度优先(迷宫找人)
查看>>
word2vec 评测 window_different
查看>>
我觉得二专很OK-2
查看>>
poj 2777
查看>>
最新版本GIT安装
查看>>