Beispiel #1
0
        static void Main(string[] args)
        {
            // Set Header
            PrintMe.PrintHeader();

            #region Load

            Console.Write("                               Performing some task... ");
            using (var progress = new ProgressBar())
            {
                for (int i = 0; i <= 100; i++)
                {
                    progress.Report((double)i / 100);
                    Thread.Sleep(10);
                }
            }
            Console.WriteLine("Done. Type 'help' for help.");
            #endregion

            if (!CheckFileDb())
            {
                PrintMe.PrintInfo("ERR ", ConsoleColor.Red, "No databse file found.");
            }

            while (true)
            {
                ReadCommand();
            }

            //  Console.ReadLine();
        }
Beispiel #2
0
        private void printDocumentOtp_PrintPage(object sender, PrintPageEventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "Print";
            String    data     = "";
            String    Result   = "";
            LogWriter lw       = new LogWriter();

            ////////////////////////////////////////////////
            ///

            if (includeInOTP.Checked && !comboBox5.Text.Equals(""))
            {
                PrintMe pr = new PrintMe(cmpR, cmpS, sifrarnikArr, partListPrint, OTPNumber, napomenaOTPPrint, Properties.strings.DELIVERY, Properties.strings.customer, true, br);
                pr.Print(e);
                data = cmpR + ", " + cmpS + ", " + sifrarnikArr + ", " + partListPrint + ", " + OTPNumber + ", " + napomenaOTPPrint + ", " + Properties.strings.DELIVERY + ", " + Properties.strings.customer + ", true, " + br;
            }
            else
            {
                PrintMe pr = new PrintMe(cmpR, cmpS, sifrarnikArr, partListPrint, OTPNumber, napomenaOTPPrint, Properties.strings.DELIVERY, Properties.strings.customer, true);
                pr.Print(e);
                data = cmpR + ", " + cmpS + ", " + sifrarnikArr + ", " + partListPrint + ", " + OTPNumber + ", " + napomenaOTPPrint + ", " + Properties.strings.DELIVERY + ", " + Properties.strings.customer + ", true";
            }

            Result = "Print page called";
            lw.LogMe(function, usedQC, data, Result);
            if (!e.HasMorePages)
            {
                Properties.Settings.Default.pageNbr = 1;
                Properties.Settings.Default.Save();
            }
        }
Beispiel #3
0
        private void printDocumentIIS_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "Print";
            String    data     = "";
            String    Result   = "";
            LogWriter lw       = new LogWriter();
            ////////////////////////////////////////////////
            ///

            PrintMe pr = new PrintMe(cmpR, cmpS, sifrarnikArr, partListPrint, IISNumber, napomenaIISPrint, "IIS", "customer", false);

            pr.Print(e);

            data   = cmpS + ", " + cmpR + ", " + sifrarnikArr + ", " + partListPrint + ", " + IISNumber + ", " + napomenaIISPrint + ", IIS, customer, false";
            Result = "Print page called";
            lw.LogMe(function, usedQC, data, Result);

            if (!e.HasMorePages)
            {
                Properties.Settings.Default.pageNbr = 1;
                Properties.Settings.Default.Save();
            }
        }
Beispiel #4
0
        private void printDocumentPrim_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "Print";
            String    data     = "";
            String    Result   = "";
            LogWriter lw       = new LogWriter();

            ////////////////////////////////////////////////
            ///

            if (br.FilID != 0)
            {
                PrintMe pr = new PrintMe(cmpS, cmpR, sifrarnikArr, partListPrint, PRIMNumber, napomenaPRIMPrint, Properties.strings.RECEIPT, Properties.strings.customer, false, br);
                pr.datumIzrade   = datumIzradeM;
                pr.izradioUser   = izradioUserM;
                pr.izradioRegija = izradioRegijaM;
                pr.Print(e);
                data = cmpR + ", " + cmpS + ", " + sifrarnikArr + ", " + partListPrint + ", " + PRIMNumber + ", " + napomenaPRIMPrint + ", " + Properties.strings.DELIVERY + ", " + Properties.strings.customer + ", true, " + br;
            }
            else
            {
                PrintMe pr = new PrintMe(cmpS, cmpR, sifrarnikArr, partListPrint, PRIMNumber, napomenaPRIMPrint, Properties.strings.RECEIPT, Properties.strings.customer, false);
                pr.datumIzrade   = datumIzradeM;
                pr.izradioUser   = izradioUserM;
                pr.izradioRegija = izradioRegijaM;
                pr.Print(e);
                data = cmpR + ", " + cmpS + ", " + sifrarnikArr + ", " + partListPrint + ", " + PRIMNumber + ", " + napomenaPRIMPrint + ", " + Properties.strings.DELIVERY + ", " + Properties.strings.customer + ", false";
            }

            Result = "Print page called";
            lw.LogMe(function, usedQC, data, Result);

            if (!e.HasMorePages)
            {
                Properties.Settings.Default.pageNbr = 1;
                Properties.Settings.Default.Save();
            }
        }
Beispiel #5
0
        private static string ReadCommand()
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\n$> ");
            var cmd = Console.ReadLine().ToLower();

            if (cmd == "help")
            {
                PrintMe.PrintHelp();
            }
            else if (cmd == "dump" && !cmd.Contains("-p"))
            {
                // DUMP COMMAND

                var rows = Decrypt("");
                if (rows == 0)
                {
                    PrintMe.PrintInfo("ERR ", ConsoleColor.Red, $"$> Something goes wrong.. Retry");
                    return(null);
                }

                PrintMe.PrintInfo(" OK ", ConsoleColor.Green, $"$> DUMP DONE! {rows} Items.");
            }
            else if (cmd.Contains("dump -p") && !cmd.Contains("-d"))
            {
                // DUMP PATH COMMAND

                var spath = cmd.Split('-');

                // remove 'p'
                spath[1] = spath[1].Remove(0, 1);
                var rows = Decrypt(spath[1]);

                if (rows == 0)
                {
                    PrintMe.PrintInfo("ERR ", ConsoleColor.Red, $"$> Something goes wrong.. Retry");
                    return(null);
                }

                PrintMe.PrintInfo(" OK ", ConsoleColor.Green, $"$> DUMP DONE! {rows} Items.");
            }
            else if ((cmd.Contains("-d") && cmd.Contains("dump -d")) && !cmd.Contains("-p"))
            {
                // DUMP DESKTOP
                var rows = Decrypt(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
                if (rows == 0)
                {
                    PrintMe.PrintInfo("ERR ", ConsoleColor.Red, $"$> Something goes wrong.. Retry");
                    return(null);
                }
                PrintMe.PrintInfo(" OK ", ConsoleColor.Green, $"$> DUMP DONE! {rows} Items.");
            }
            else if (cmd == "clear" && !cmd.Contains("dump -d") && !cmd.Contains("-p"))
            {
                KillChrome();
                Thread.Sleep(20);
                string db_way = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                                + "/Google/Chrome/User Data/Default/Login Data"; // path to database file
                try
                {
                    File.Delete(db_way);
                }
                catch
                {
                    Thread.Sleep(20);
                    string db_way1 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                                     + "/Google/Chrome/User Data/Default/Login Data"; // path to database file
                    try
                    {
                        File.Delete(db_way1);
                    }
                    catch
                    {
                    }
                }

                PrintMe.PrintInfo(" OK ", ConsoleColor.Green, $"$> CLEAR DONE!");
            }
            else if (cmd.Contains("dump") && cmd.Contains("-m") && !cmd.Contains("-d") && !cmd.Contains("-p"))
            {
                // DUMP MAIL COMMAND

                PrintMe.PrintInfo("INFO", ConsoleColor.Yellow, $"$> Attention: This method send an email from your account to your same account. If you use double autentication this may not work. Password are not saved or logged. Email system use TSL/SSL");

                Console.Write("$> Your Email (i.e. [email protected]): ");
                var mail = Console.ReadLine().ToLower();
                Console.Write("$> Your Email Password (Requied for your SMTP Server aka smtp.google.com): ");
                var pwd = Console.ReadLine().ToLower();

                MailMessage mailMessage = new MailMessage(mail, mail);//replace the address value
                mailMessage.Subject = "Chromy";
                mailMessage.Body    = "ciao";


                var res = SendMail(mail, pwd, mailMessage);

                PrintMe.PrintInfo("  ", ConsoleColor.Red, $"$> Not working now.");
            }
            return(null);
        }
Beispiel #6
0
        private static int Decrypt(string path)
        {
            try
            {
                PrintMe.PrintInfo("INFO", ConsoleColor.Yellow, $"$> Killing Chrome");
                KillChrome();
                Thread.Sleep(20);
                if (path == "")
                {
                    path += "ChromyDump.html";
                }
                else
                {
                    path += "\\ChromyDump.html";
                }
                StreamWriter Writer = new StreamWriter(path, false, Encoding.UTF8);
                string       db_way = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                                      + "/Google/Chrome/User Data/Default/Login Data"; // path to database file
                //Console.WriteLine("$> DB file = " + db_way);


                string db_field = "logins"; // DB table field name
                byte[] entropy  = null;     // DPAPI class does not use entropy but requires this parameter
                string description;         // I could not understand the purpose of a this mandatory parameter
                                            // Output always is Null
                                            // Connect to DB

                string    ConnectionString = "data source=" + db_way + ";New=True;UseUTF16Encoding=True";
                DataTable DB   = new DataTable();
                string    sql  = string.Format("SELECT * FROM {0} {1} {2}", db_field, "", "");
                int       rows = 0;
                // for better closing use using key
                using (SQLiteConnection connect = new SQLiteConnection(ConnectionString))
                {
                    SQLiteCommand     command = new SQLiteCommand(sql, connect);
                    SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
                    adapter.Fill(DB);
                    rows = DB.Rows.Count;
                    for (int i = 0; i < rows; i++)
                    {
                        Writer.Write(i + 1 + "] ");               // Here we print order number of our trinity "site-login-password"
                        Writer.WriteLine(DB.Rows[i][1] + "<br>"); // site URL
                        Writer.WriteLine(DB.Rows[i][3] + "<br>"); // login
                                                                  // Here the password description
                        byte[] byteArray = (byte[])DB.Rows[i][5];
                        byte[] decrypted = DPAPI.Decrypt(byteArray, entropy, out description);
                        string password  = new UTF8Encoding(true).GetString(decrypted);
                        Writer.WriteLine(password + "<br><br>");
                    }
                }

                Writer.Close();
                return(rows);
            }
            catch (Exception ex)
            {
                PrintMe.PrintInfo("ERR ", ConsoleColor.Red, ex.Message);
                // Console.WriteLine(ex.Message);
                //    ex = ex.InnerException;
                return(0);
            }
        }