Example #1
0
        private void button17_Click(object sender, EventArgs e)
        {
            string       pwd = "";
            DialogResult ret = InputBox("Passwort", "Passwort", ref pwd);

            if (ret == DialogResult.OK)
            {
                myConn.PLCSendPassword(pwd);
            }
        }
Example #2
0
        private void searchPasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            char[] zeichen = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };


            myConn = new PLCConnection((string)lstConnections.SelectedItem);
            myConn.Connect();

            Int64 anz = 0;

            bool   pwdCorr = false;
            string pwd     = "12345678";

            int[] cnt = new int[8];
            while (!pwdCorr)
            {
                cnt[0]++;
                for (int n = 0; n < 7; n++)
                {
                    if (cnt[n] >= zeichen.Length)
                    {
                        cnt[n + 1]++;
                        cnt[n] = 0;
                    }
                }

                if (cnt[7] >= zeichen.Length)
                {
                    MessageBox.Show("Password not found!");
                    return;
                }


                pwd = "";
                for (int n = 0; n < 8; n++)
                {
                    pwd += zeichen[cnt[n]];
                }

                anz++;
                pwdCorr = myConn.PLCSendPassword(pwd.Trim());
            }

            MessageBox.Show("Passwort:" + pwd + "\n" + "Anzahl geprüfter Kennwörter:" + anz.ToString());
        }
        private void searchPasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            char[] zeichen =
            {
                ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
                'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
                'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6',
                '7', '8', '9'
            };


            myConn = new PLCConnection((string) lstConnections.SelectedItem);
            myConn.Connect();

            Int64 anz = 0;

            bool pwdCorr = false;
            string pwd = "12345678";
            int[] cnt = new int[8];
            while (!pwdCorr)
            {
                cnt[0]++;
                for (int n = 0; n < 7; n++)
                {
                    if (cnt[n] >= zeichen.Length)
                    {
                        cnt[n + 1]++;
                        cnt[n] = 0;
                    }
                }

                if (cnt[7] >= zeichen.Length)
                {
                    MessageBox.Show("Password not found!");
                    return;
                }


                pwd = "";
                for (int n = 0; n < 8; n++)
                {
                    pwd += zeichen[cnt[n]];
                }

                anz++;
                pwdCorr = myConn.PLCSendPassword(pwd.Trim());
            }

            MessageBox.Show("Passwort:" + pwd + "\n" + "Anzahl geprüfter Kennwörter:" + anz.ToString());

        }