private void CreateUsers()
        {
            for (int i = 0; i < user.Count; i++)
            {
                string dir = user[i].GetUsername;
                // Checks to see if the username already exists, if so, abort registration
                if (!Directory.Exists("data\\" + dir))
                {
                    Directory.CreateDirectory("data\\" + dir);
                    var sw = new StreamWriter("data\\" + dir + "\\data.ls");

                    string encryptedusername = AesCryp.Encrypt(user[i].GetUsername);
                    string encryptedpassword = AesCryp.Encrypt(user[i].GetPassword);

                    sw.WriteLine(encryptedusername);
                    sw.WriteLine(encryptedpassword);
                    sw.Close();
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (LoginUsuario.Text.Length < 3 || LoginClave.Text.Length < 5)
            {
                MessageBox.Show("Credenciales muy cortos.");
            }
            else
            {
                string dir = LoginUsuario.Text;
                if (!Directory.Exists("data\\" + dir))
                {
                    MessageBox.Show("Not Exist.", dir);
                }
                else
                {
                    var sr = new StreamReader("data\\" + dir + "\\data.ls");

                    string encusr  = sr.ReadLine();
                    string encpass = sr.ReadLine();
                    sr.Close();

                    string decusr  = AesCryp.Decrypt(encusr);
                    string decpass = AesCryp.Decrypt(encpass);

                    if (decusr == LoginUsuario.Text && decpass == LoginClave.Text)
                    {
                        MessageBox.Show("Welcom to Payroller!", decusr);
                        Principal p = new Principal();
                        p.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Credenciales incorrectos.");
                    }
                }
            }
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (RegistrarUsuario.Text.Length < 3 || RegistrarClave.Text.Length < 5)
            {
                MessageBox.Show("Credenciales muy cortos.");
            }
            else
            {
                string dir = RegistrarUsuario.Text;
                Directory.CreateDirectory("data\\" + dir);

                var sw = new StreamWriter("data\\" + dir + "\\data.ls");

                string encusr  = AesCryp.Encrypt(RegistrarUsuario.Text);
                string encpass = AesCryp.Encrypt(RegistrarClave.Text);

                sw.WriteLine(encusr);
                sw.WriteLine(encpass);
                sw.Close();

                MessageBox.Show("Usuario ha sido registrado satisfactoriamente.", RegistrarUsuario.Text);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (RegistrarUsuario.Text.Length < 3 || RegistrarClave.Text.Length < 5)
            {
                MessageBox.Show("Password is Too Small.");
            }
            else
            {
                string dir = RegistrarUsuario.Text;
                Directory.CreateDirectory("data\\" + dir);

                var sw = new StreamWriter("data\\" + dir + "\\data.ls");

                string encusr  = AesCryp.Encrypt(RegistrarUsuario.Text);
                string encpass = AesCryp.Encrypt(RegistrarClave.Text);

                sw.WriteLine(encusr);
                sw.WriteLine(encpass);
                sw.Close();

                MessageBox.Show("User has been registered successfully", RegistrarUsuario.Text);
            }
        }
示例#5
0
文件: Regform.cs 项目: TAT96/secWeb
        private void btnRegistre_Click(object sender, EventArgs e)
        {
            if (textUtil.Text.Length < 3 || texMdp.Text.Length < 3)
            {
                MessageBox.Show("Passe ou non d'utilisateur invalide !");
            }
            else
            {
                string dir = textUtil.Text;
                Directory.CreateDirectory("data\\" + dir);

                var sw = new StreamWriter("data\\" + dir + "\\data.ls");

                string verifUti  = AesCryp.Encrypt(textUtil.Text);
                string verifPass = AesCryp.Encrypt(texMdp.Text);
                sw.WriteLine(verifUti);
                sw.WriteLine(verifPass);
                sw.Close();

                MessageBox.Show("vous etes inscrit avec succes .", textUtil.Text);
                this.Close();
            }
        }
示例#6
0
        private void Button2_Click(object sender, EventArgs e)
        {
            if (username.Text.Length < 3 || password.Text.Length < 5)
            {
                MessageBox.Show("Username or password is too short");
            }
            else
            {
                string dir = username.Text;
                if (!Directory.Exists("data\\" + dir))
                {
                    MessageBox.Show("User wasn't found", dir);
                }
                else
                {
                    var    sr      = new StreamReader("data\\" + dir + "\\data.ls");
                    string encusr  = sr.ReadLine();
                    string encpass = sr.ReadLine();
                    sr.Close();

                    string decusr  = AesCryp.Decrypt(encusr);
                    string decpass = AesCryp.Decrypt(encpass);

                    if (decusr == username.Text && decpass == password.Text)
                    {
                        MessageBox.Show("Welcome to private area", decusr);
                        Form3 po = new Form3();
                        po.Show();
                    }
                    else
                    {
                        MessageBox.Show("Error. User or password is wrong");
                    }
                }
            }
        }
        private void loginButton_Click(object sender, EventArgs e)
        {
            bool usernameFound = false;

            if (usernameTextBox.Text.Length < 3 || passwordTextBox.Text.Length < 5)
            {
                MessageBox.Show("Username or Password is invalid or too short!");
                return;
            }

            for (int i = 0; i < user.Count; i++)
            {
                if (user[i].GetUsername == usernameTextBox.Text)
                {
                    usernameFound = true; currentUser = user[i];
                }
            }

            if (usernameFound)
            {
                string dir = usernameTextBox.Text;
                if (!Directory.Exists("data\\" + dir))
                {
                    MessageBox.Show("User " + dir + " was not found!");
                    return;
                }
                else
                {
                    var sr = new StreamReader("data\\" + dir + "\\data.ls");

                    string encryptedusername = sr.ReadLine();
                    string encryptedpassword = sr.ReadLine();
                    sr.Close();

                    string decusr  = AesCryp.Decrypt(encryptedusername);
                    string decpass = AesCryp.Decrypt(encryptedpassword);

                    if (decusr == usernameTextBox.Text && decpass == passwordTextBox.Text)
                    {
                        MessageBox.Show("Welcome " + currentUser.GetUsername);
                        loggedInTemp = true;
                        if (currentUser.GetAdmin)
                        {
                            adminLoggedInTemp = true;
                        }
                        // Returns loggedInTemp to LoginCheck in MainForm
                        Application.OpenForms.OfType <MainForm>().First().LoginCheck(loggedInTemp, adminLoggedInTemp, currentUser);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error! Username or password is wrong!");
                        return;
                    }
                }
            }
            else
            {
                MessageBox.Show("Username Not Found");
                return;
            }
        }
示例#8
0
        public void UserRegister()
        {
            //string query = "INSERT INTO users(name,password,matric_no) VALUES ('" + txtUsername.Text + "', '" + txtPassword.Text + "', '" + txtMatricNo.Text + "') ";
            //string query = "INSERT INTO users(name,password,matric_no) VALUES ('try', 'je0121', '0111') ";

            //connection mysql XAMPP
            //MySqlConnection dbconnection = new MySqlConnection(conn);
            // MySqlCommand commandDB = new MySqlCommand(query, dbconnection);
            // commandDB.CommandTimeout = 60;
            //MySqlDataReader reader;

            try
            {
                var txtInput = txtPassword.Text;

                if (txtInput == "")
                {
                    MessageBox.Show("Password Should not be empty");
                    return;
                }

                var hasNumber    = new Regex(@"[0-9]+");
                var hasUpperCase = new Regex(@"[A-Z]+");
                var hasLowerCase = new Regex(@"[a-z]+");
                var hasSymbols   = new Regex(@"[!@#$%^&*()_+=\[{\]};:<>|./?,-]+");

                if (!hasNumber.IsMatch(txtInput))
                {
                    MessageBox.Show("Password should have at least ONE Number Value");
                    return;
                }


                else if (!hasUpperCase.IsMatch(txtInput))
                {
                    MessageBox.Show("Password should have at least ONE upper case letter Value");
                    return;
                }


                else if (!hasLowerCase.IsMatch(txtInput))
                {
                    MessageBox.Show("Password should have at least ONE lower case letter Value");
                    return;
                }


                else if (!hasSymbols.IsMatch(txtInput))
                {
                    MessageBox.Show("Password should have at least ONE symbol Value");
                    return;
                }


                else if (string.IsNullOrEmpty(txtUsername.Text) || (string.IsNullOrEmpty(txtPassword.Text)) || (string.IsNullOrEmpty(txtMatricNo.Text)))
                {
                    MessageBox.Show("Please Fill Username and Password and Matric No", "Error");
                }

                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    MessageBox.Show("Please enter your password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string dir = txtUsername.Text;
                Directory.CreateDirectory("data\\" + dir);
                var sw = new StreamWriter("data\\" + dir + "\\data.ls");

                string encusr  = AesCryp.Encrypt(txtUsername.Text);
                string encpass = AesCryp.Encrypt(txtPassword.Text);

                sw.WriteLine(encusr);
                sw.WriteLine(encpass);
                sw.Close();


                string query = "INSERT INTO users(name,password,matric_no) VALUES ('" + encusr + "', '" + encpass + "', '" + txtMatricNo.Text + "') ";
                //string query = "INSERT INTO users(name,password,matric_no) VALUES ('try', 'je0121', '0111') ";

                //connection mysql XAMPP
                MySqlConnection dbconnection = new MySqlConnection(conn);
                dbconnection.Open();
                MySqlCommand commandDB = new MySqlCommand(query, dbconnection);
                commandDB.CommandTimeout = 60;
                commandDB.ExecuteNonQuery();
                //MySqlDataReader reader;



                MessageBox.Show("Welcome to MP4Carver");
                Login loginSys = new Login();
                loginSys.Show();
                this.Hide();
                //Profile from2 = new Profile();
                // from2.Show();
                // this.Hide();



                dbconnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            MessageBox.Show("User was successfully created.", txtUsername.Text);
            this.Close();
        }
示例#9
0
        private void button1_Click(object sender, EventArgs e)
        {
            WebClient wc = new WebClient();


            string load      = "V78CyDuxpecOJXWjqaD2HTXLjmevI89aQliXP9SYKpbDcsVm9NgkGLZWujG/cOCC";
            string kommando2 = AesCryp.Decrypt(load);

            string invite = invitetext.Text;
            string user   = usernametext1.Text;
            string pass   = passwordtext1.Text;



            string passencrypted;

            passencrypted = AesCryp.Encrypt(pass).ToString();
            string usercrypted   = AesCryp.Encrypt(user);
            string invitecrypted = AesCryp.Encrypt(invite);



            string passdecrypted = AesCryp.Decrypt(passencrypted);
            string userdecrypted = AesCryp.Decrypt(usercrypted);


            string userftp    = wc.DownloadString(kommando2 + "/ftpusr.txt");
            string passftp    = wc.DownloadString(kommando2 + "/ftpass.txt");
            string host       = wc.DownloadString(kommando2 + "/host.txt");
            string invitecode = wc.DownloadString(kommando2 + "/invites.txt");


            string invitecodeencrypted = AesCryp.Encrypt(invitecode);


            string userftpdecrypt = AesCryp.Decrypt(userftp);
            string passftpdecrypt = AesCryp.Decrypt(passftp);
            string hostdecrypt    = AesCryp.Decrypt(host);



            //Some basic debug stuff



            Process[] pname = Process.GetProcessesByName("wireshark");
            if (pname.Length > 0)
            {
                MessageBox.Show("Please close any malicious software");
                Application.Exit();
            }
            else
            {
                Process[] oof = Process.GetProcessesByName("ollydbg");
                if (pname.Length > 0)
                {
                    MessageBox.Show("Please close any malicious software");

                    Application.Exit();
                }
                else
                {
                    Process[] fiddlet = Process.GetProcessesByName("Fiddler");
                    if (pname.Length > 0)
                    {
                        MessageBox.Show("Please close any malicious software");
                        Application.Exit();
                    }
                    else
                    {
                        Process[] ndSpy = Process.GetProcessesByName("ndSpy");
                        if (pname.Length > 0)
                        {
                            MessageBox.Show("Please close any malicious software");
                            Application.Exit();
                        }
                        else
                        {
                            ftp ftpClient = new ftp(@hostdecrypt, userftpdecrypt, passftpdecrypt);

                            if (invite != invitecodeencrypted)
                            {
                                MessageBox.Show("Invalid invite code");
                            }
                            else
                            {
                                //Checking if the invite code is right , if it is we will create a temp file on the computer and tranfer it over to our server


                                if (invitetext.Text == invitecodeencrypted)
                                {
                                    FileIOPermission f = new FileIOPermission(PermissionState.None);
                                    f.AllLocalFiles = FileIOPermissionAccess.Write;

                                    f.Demand();

                                    string pathname = @"C:\\0\name.txt";
                                    string pathpass = @"C:\\0\pass.txt";
                                    string pathhwid = @"C:\\0\hwid.txt";

                                    string encryptedhwid = AesCryp.Encrypt(hwid.GetMachineGuid());
                                    File.Create(@pathname);
                                    File.Create(@pathpass);
                                    File.Create(@pathhwid);

                                    File.WriteAllText(@pathpass, passencrypted);
                                    File.WriteAllText(@pathname, user);
                                    File.WriteAllText(@pathhwid, encryptedhwid);

                                    System.Threading.Thread.Sleep(500);
                                    progressBar1.Value = 10;
                                    System.Threading.Thread.Sleep(1000);
                                    progressBar1.Value = 35;

                                    //transfering the files from our directory to our server

                                    ftpClient.upload(kommando2 + "users /" + user + " / " + user + ".txt", @pathpass);
                                    ftpClient.upload(kommando2 + "users/" + user + " / " + "userhwid.txt", @pathhwid);
                                    ftpClient.upload(kommando2 + "users/" + user + " / " + "username.txt", @pathname);
                                    System.Threading.Thread.Sleep(1000);
                                    progressBar1.Value = 75;

                                    //then deleting the files because we dont need them xDD

                                    System.IO.File.Delete(@pathname);
                                    System.IO.File.Delete(@pathpass);
                                    System.IO.File.Delete(@pathhwid);
                                    progressBar1.Value = 100;
                                    MessageBox.Show("Welcome , ", usernametext1.Text);
                                    MessageBox.Show("Your account has been created , you can now log in with your chosen credentials");
                                    ftpClient = null;
                                    Login aaaaaa = new Login();
                                    this.Hide();
                                    aaaaaa.Show();
                                }
                            }
                        }
                    }
                }
            }
        }
示例#10
0
        private static void Main(string[] args)
        {
            var uhwid = new UhwidEngine();

            //0033C6A8BFEBFBFF0004065178D78DEB08D2A6E3859728686F310C5D

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var f = new Form1();

            Logger.Hook();

            if (args.Length > 0 && args[0] != null)
            {
                if (args[0].Contains("-m") || args[0].Contains("-M") || args[0].Contains("/m") || args[0].Contains("/M"))
                {
                    f.WindowState = FormWindowState.Minimized;
                }
            }
            if (args.Length > 0 && args[1] != null)
            {
                if (args[1].Contains("-gr") || args[1].Contains("-GR") ||
                    args[1].Contains("/GR") || args[1].Contains("/GR"))
                {
                    var sr = new StreamWriter(Application.StartupPath + "\\id.txt");
                    sr.WriteLine(uhwid.AdvancedUid);
                    sr.WriteLine(AesCryp.Encrypt(uhwid.AdvancedUid));
                    sr.Flush();
                    sr.Close();
                    Process.Start("id.txt");
                }
            }

            if (AesCryp.Decrypt(File.ReadAllText(Application.StartupPath + "\\Bell.txt").Trim()) == uhwid.AdvancedUid)
            {
                //MessageBox.Show(uhwid.AdvancedUid.Length.ToString());
                try
                {
                    if (CheckFiles.Checkfolder())
                    {
                        if (CheckFiles.CheckAudioFolder())
                        {
                            if (CheckFiles.CheckMp3Folder())
                            {
                                if (CheckFiles.Checkfiles())
                                {
                                    Application.Run(f);
                                    Logger.UnHook();
                                }
                                else
                                {
                                    MessageBox.Show(@"Files not found", @"Error");
                                }
                            }
                        }
                    }
                }
                catch (IOException e)
                {
                    MessageBox.Show(e.Message, @"IOException");
                }
            }
            else
            {
                MessageBox.Show(@"invalic hwid");
                Logger.UnHook();
            }
        }
示例#11
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username;

            username = usernametext.Text;
            string password;

            password = passwordtext.Text;
            string   dir            = usernametext.Text;
            string   dirpass        = passwordtext.Text;
            string   encryptedhwid  = AesCryp.Encrypt(hwid.GetMachineGuid());
            string   decrypteddhwid = AesCryp.Decrypt(encryptedhwid);
            TimeZone localZone      = TimeZone.CurrentTimeZone;
            DateTime currentDate    = DateTime.Now;

            string dirpassencrypted = AesCryp.Encrypt(dirpass);
            string direncrypted     = AesCryp.Encrypt(dir);


            //this is the encrypted website link , replace it with your own directory

            string load = "V78CyDuxpecOJXWjqaD2HTXLjmevI89aQliXP9SYKpbDcsVm9NgkGLZWujG/cOCC";



            string kommando2 = AesCryp.Decrypt(load);


            WebClient wc            = new WebClient();
            string    hostName      = Dns.GetHostName();
            string    encryptedhost = AesCryp.Encrypt(hostName);



            var srpnume  = wc.DownloadString(kommando2 + "users/" + username + " / " + "username.txt");            //just reads the name/pass/hwid
            var srparola = wc.DownloadString(kommando2 + "users/" + username + " / " + username + ".txt");         //also you might want to change the name of the text files you put stuff in
            var srhwid   = wc.DownloadString(kommando2 + "users/" + username + " / " + "userhwid.txt");


            //decrypting the info we got


            string decusr   = AesCryp.Decrypt(srpnume);
            string decpass  = AesCryp.Decrypt(srparola);
            string hwidpass = AesCryp.Decrypt(srhwid);

            string error = "(404) Not Found.";

            if (decrypteddhwid != hwidpass)
            {
                MessageBox.Show("Invalid HWID :(");
            }
            else
            {
                //checking if the input info is fine

                if (decusr == usernametext.Text && decpass == passwordtext.Text && decrypteddhwid == hwidpass)
                {
                    MessageBox.Show("Welcome," + decusr);
                }
                else
                {
                    MessageBox.Show("Wrong username or password , please check your credentials");
                }

                //error messages

                if (srpnume == error && srparola == error && srhwid == error)
                {
                    MessageBox.Show("User does not exist");
                }
                if (srpnume == error && srparola == error)
                {
                    MessageBox.Show("User does not exist");
                }
                if (srpnume == error)
                {
                    MessageBox.Show("User does not exist");
                }
                if (usernametext.Text.Length > 0 && passwordtext.Text.Length > 0)
                {
                    button1.Enabled = true;
                }
                else
                {
                    button1.Enabled = false;
                }
            }
        }