Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //NBSWY3DP
            try
            {
                int i = Auth2FA.GenerateOTP(";");
                Console.WriteLine(i);
            }
            catch (Exception e)
            {
                Console.WriteLine("ERR");
            }
            Console.ReadKey();

            /*
             * new Thread(() =>
             * {
             *  Thread.CurrentThread.IsBackground = false;
             *
             *  Console.ReadKey();
             *  e.UnsubscribeAll();
             *  Console.WriteLine("byebye");
             *
             * }).Start();
             *
             * e.Subscribe((s, i) =>
             * {
             *  Console.WriteLine(i);
             * });
             *
             * e.UnsubscribeAll();
             *
             * e.Subscribe((s, i) =>
             * {
             *  Console.WriteLine("->"+i);
             * });
             */
        }
Exemplo n.º 2
0
 public static void Main(string[] args)
 {
     Auth2FA.GenerateOTP("test");
 }
Exemplo n.º 3
0
        private void _elapsedHotkeyTime(object source, ElapsedEventArgs e)
        {
            System.Windows.Application.Current.Dispatcher.Invoke(
                () =>
            {
                if (hotkeyCounter == 1 || hotkeyCounter == 2 || hotkeyCounter == 3)
                {
                    string data = System.Windows.Clipboard.GetData(System.Windows.DataFormats.Text) as string;
                    if (!PasswordSystem.Instance.TrySelect(data))
                    {
                        data = URL.URLize(data);
                        if (!PasswordSystem.Instance.TrySelect(data))
                        {
                            return;
                        }
                    }
                    string el = null;
                    if (hotkeyCounter == 1)
                    {
                        lastUsername = data;
                        el           = PasswordSystem.Instance.GetUsernameFromSelection();
                    }

                    if (hotkeyCounter == 2)
                    {
                        el = PasswordSystem.Instance.GetPasswordFromSelection();
                    }
                    if (hotkeyCounter == 3)
                    {
                        el      = PasswordSystem.Instance.GetTFAFromSelection();
                        el      = TFAHelper.TryParseUrl(el);
                        int eli = Auth2FA.GenerateOTP(el);
                        el      = TFAHelper.AddPadding("" + eli);
                    }

                    if (el != null)
                    {
                        if (PasswordSystem.Instance.Settings.CPY_PW)
                        {
                            Clipboard.SetData(DataFormats.Text, el);
                            SendKeys.SendWait("^v");

                            if (hotkeyCounter == 1)
                            {
                                Clipboard.SetData(DataFormats.Text, lastUsername);
                            }
                            if (hotkeyCounter == 2)
                            {
                                Clipboard.SetData(DataFormats.Text, lastUsername);
                            }
                        }
                        else
                        {
                            foreach (char c in el)
                            {
                                if ("~^+(){}[]%".Contains(c))
                                {
                                    SendKeys.SendWait("{" + c + "}");
                                }
                                else
                                {
                                    SendKeys.SendWait(c.ToString());
                                }
                            }
                        }
                    }
                }


                if (hotkeyCounter == 4)
                {
                    Router.instance.ShowMain();
                }
            });


            hotkeyCounter = 0;
            _timer.Stop();
        }