Esempio n. 1
0
        protected void btnGiris_Click(object sender, EventArgs e)
        {
            md5 sifrele = new md5();

            string email  = txtEmail.Text.Replace("'", "");
            string parola = sifrele.MD5Olustur(txtParola.Text);

            cmdKomut = new SqlCommand("Select * From film_Kullanici Where Email=@Email and Parola=@Parola and Admin = '1'", dbBag);

            cmdKomut.Parameters.Add("@Email", SqlDbType.NVarChar);
            cmdKomut.Parameters["@Email"].Value = email;

            cmdKomut.Parameters.Add("@Parola", SqlDbType.NVarChar);
            cmdKomut.Parameters["@Parola"].Value = parola;

            dtrData = cmdKomut.ExecuteReader();
            if (dtrData.Read())
            {
                Response.Cookies["adminGiris"]["giris"] = "girildi";
                Response.Cookies["adminGiris"].Expires  = DateTime.Now.AddYears(1);

                Response.Redirect("yonetim");
            }
            else
            {
                lblGirisHata.Text = "Bilgileriniz hatalı.";
            }
            dtrData.Close();
        }
Esempio n. 2
0
        public void hashtestMD5()
        {
            string[]      list         = { "0cc175b9c0f1b6a831c399e269772661" };
            IHashFunction hashfunction = new md5();

            Assert.IsTrue(hashfunction.hash("a").Equals(list[0]));
        }
Esempio n. 3
0
        public void hashedattacktestBruteforce()
        {
            //password hashed in MD5
            string[]      list       = { "5f4dcc3b5aa765d61d8327deb882cf99" };
            IHashFunction md5        = new md5();
            IAttackMethod bruteforce = new bruteforce(0);

            Assert.IsTrue(Program.attackhash(list, bruteforce, md5.hash) == 0);
        }
Esempio n. 4
0
        public void hashedattacktestDictinary()
        {
            //password hashed in MD5
            string[]      list            = { "5f4dcc3b5aa765d61d8327deb882cf99" };
            IHashFunction md5             = new md5();
            IAttackMethod DictinaryAttack = new DictinaryAttack();

            Assert.IsTrue(Program.attackhash(list, DictinaryAttack, md5.hash) == 1);
        }
Esempio n. 5
0
        public string encryptPwd(string Password)
        {
            String npwd = Password;
            md5    md   = new md5();

            md.pwd = npwd;

            return(md.calculateMD5());
        }
Esempio n. 6
0
 void Start()
 {
     md5script = GetComponent <md5>();
 }
Esempio n. 7
0
 public bool Insert_md5(md5 md5Ins)
 {
     try
     {
         db.md5.InsertOnSubmit(md5Ins);
         db.SubmitChanges();
         return true;
     }
     catch (Exception e)
     {
         Console.WriteLine("{0} Insert_md5 exception caught." + e);
         return false;
     }
 }
Esempio n. 8
0
 public bool Update_md5(md5 md5Ins)
 {
     try
     {
         md5 a = db.md5.First(t => t.id == md5Ins.id);
         a.text1 = md5Ins.text1;
         a.text2 = md5Ins.text2;
         a.ip = md5Ins.ip;
         a.time = md5Ins.time;
         db.SubmitChanges();
         return true;
     }
     catch (Exception e)
     {
         Console.WriteLine("{2} Update_md5 exception caught." + e);
         return false;
     }
 }
Esempio n. 9
0
 HashFile(md5, GameAssemblyPath);
Esempio n. 10
0
        public Header Login(string Email, string Password, string Signature)
        {
            Header header = new Header();

            try
            {
                md5 CheckSum = new md5();
                if (CheckSum.CheckSignature(Email + Password, Signature))
                {
                    string[] strFieldName  = { "Email", "Password" };
                    object[] objFieldValue = { Email, Password };

                    structDB = objDataset.ExecSP("sp_login_user", strFieldName, objFieldValue, 3600);

                    if (structDB.intCode == 1)
                    {
                        if (structDB.dstResult.Tables[0].Rows.Count > 0)
                        {
                            header = new Header
                            {
                                userid  = structDB.dstResult.Tables[0].Rows[0]["Userid"].ToString(),
                                code    = "400",
                                message = "User Login Successfully!",
                                status  = "Success"
                            };
                        }
                    }
                    else
                    {
                        header = new Header
                        {
                            userid  = "0",
                            code    = "404",
                            message = "User Login Unsuccessfully!",
                            status  = "Unsuccessful"
                        };
                    }
                }
                else
                {
                    header = new Header
                    {
                        userid  = "0",
                        code    = "-1",
                        message = "Authentication Error",
                        status  = "Unsuccessful"
                    };
                }
            }
            catch (Exception ex)
            {
                header = new Header
                {
                    userid  = "0",
                    code    = "405",
                    message = ex.Message,
                    status  = "Unsuccessful"
                };
            }

            return(header);
        }
Esempio n. 11
0
        public Header DoTransaction(string CurrencyAmount, string CurrencyType, string SourceUserId, string TargetUserId, string AccountType, string Signature)
        {
            Header header = new Header();

            try
            {
                md5 CheckSum = new md5();
                if (CheckSum.CheckSignature(CurrencyAmount + CurrencyType + SourceUserId + TargetUserId + AccountType, Signature))
                {
                    string[] strFieldName  = { "CurrencyAmount", "CurrencyType", "SourceUserId", "TargetUserId", "AccountType" };
                    object[] objFieldValue = { CurrencyAmount, CurrencyType, SourceUserId, AccountType, AccountType };

                    structDB = objDataset.ExecSP("sp_insert_transaction", strFieldName, objFieldValue, 3600);

                    if (structDB.intCode == 1)
                    {
                        if (structDB.dstResult.Tables[0].Rows.Count > 0)
                        {
                            header = new Header
                            {
                                userid  = structDB.dstResult.Tables[0].Rows[0]["Userid"].ToString(),
                                code    = "400",
                                message = "Transaction Successfully Processed!",
                                status  = "Success"
                            };
                        }
                    }
                    else
                    {
                        header = new Header
                        {
                            userid  = "0",
                            code    = "404",
                            message = "Transaction Failed!",
                            status  = "Unsuccessful"
                        };
                    }
                }


                else
                {
                    header = new Header
                    {
                        userid  = "0",
                        code    = "405",
                        message = "Authentication Error",
                        status  = "Unsuccessful"
                    };
                }
            }
            catch (Exception ex)
            {
                header = new Header
                {
                    userid  = "0",
                    code    = "405",
                    message = ex.Message,
                    status  = "Unsuccessful"
                };
            }

            return(header);
        }
Esempio n. 12
0
        public Header VerifyAccount(string UserId, string AccountType, string AccountId, string Signature)
        {
            Header header = new Header();

            try
            {
                md5 CheckSum = new md5();
                if (CheckSum.CheckSignature(UserId + AccountType + AccountId, Signature))
                {
                    string[] strFieldName  = { "UserId", "AccountType", "AccountId" };
                    object[] objFieldValue = { UserId, AccountType, AccountId };

                    structDB = objDataset.ExecSP("sp_verify_account", strFieldName, objFieldValue, 3600);

                    if (structDB.intCode == 1)
                    {
                        if (structDB.dstResult.Tables[0].Rows.Count > 0)
                        {
                            header = new Header
                            {
                                userid  = structDB.dstResult.Tables[0].Rows[0]["Userid"].ToString(),
                                code    = "400",
                                message = "Account Verified Successfully!",
                                status  = "Success"
                            };
                        }
                    }
                    else
                    {
                        header = new Header
                        {
                            userid  = "0",
                            code    = "404",
                            message = "Account Could not be Verified!",
                            status  = "Unsuccessful"
                        };
                    }
                }

                else
                {
                    header = new Header
                    {
                        userid  = "0",
                        code    = "405",
                        message = "Authentication Error",
                        status  = "Unsuccessful"
                    };
                }
            }
            catch (Exception ex)
            {
                header = new Header
                {
                    userid  = "0",
                    code    = "405",
                    message = ex.Message,
                    status  = "Unsuccessful"
                };
            }

            return(header);
        }
Esempio n. 13
0
        public TransactionHistory TransactionHistory(string UserId, string Signature)
        {
            TransactionHistory transactionHistory = new TransactionHistory();

            try
            {
                md5 CheckSum = new md5();
                if (CheckSum.CheckSignature(UserId, Signature))
                {
                    string[] strFieldName  = { "UserId" };
                    object[] objFieldValue = { UserId };

                    structDB = objDataset.ExecSP("sp_transaction_history", strFieldName, objFieldValue, 3600);

                    if (structDB.intCode == 1)
                    {
                        if (structDB.dstResult.Tables[0].Rows.Count > 0)
                        {
                            transactionHistory = new TransactionHistory
                            {
                                Transactionid   = Convert.ToInt32(structDB.dstResult.Tables[0].Rows[0]["Transactionid"].ToString()),
                                CurrencyType    = structDB.dstResult.Tables[0].Rows[0]["CurrencyType"].ToString(),
                                TransactionType = structDB.dstResult.Tables[0].Rows[0]["TransactionType"].ToString(),
                                CurrencyAmount  = structDB.dstResult.Tables[0].Rows[0]["CurrencyAmount"].ToString(),
                                ProcessedAt     = structDB.dstResult.Tables[0].Rows[0]["ProcessedAt"].ToString(),
                                State           = structDB.dstResult.Tables[0].Rows[0]["State"].ToString()
                            };
                        }
                    }
                    else
                    {
                        transactionHistory = null;
                    }
                }

                else
                {
                    transactionHistory = new TransactionHistory
                    {
                        Transactionid   = 0,
                        CurrencyType    = "invalid",
                        TransactionType = "invalid",
                        CurrencyAmount  = "invalid",
                        ProcessedAt     = "invalid",
                        State           = "Authentication Error"
                    };
                }
            }
            catch (Exception ex)
            {
                transactionHistory = new TransactionHistory
                {
                    Transactionid   = 0,
                    CurrencyType    = "invalid",
                    TransactionType = "invalid",
                    CurrencyAmount  = "invalid",
                    ProcessedAt     = "invalid",
                    State           = ex.Message
                };
            }

            return(transactionHistory);
        }