Beispiel #1
0
        public PasswordFinderCommand(Daemon daemon)
            : base("findpassword", "Try to find typos in provided password.")
        {
            Daemon   = daemon;
            Language = "en";

            Options = new OptionSet()
            {
                "usage: findpassword --wallet:WalletName --language:lang --numbers:[TRUE|FALSE] --symbold:[TRUE|FALSE]",
                "",
                "Tries to find typing mistakes in the user password by brute forcing it char by char.",
                "eg: ./wassabee findpassword --wallet:MyWalletName --numbers:false --symbold:true",
                "",
                { "w|wallet=", "The name of the wallet file.",
                  x => WalletName = x },
                { "s|secret=", "You can specify an encrypted secret key instead of wallet. Example of encrypted secret: 6PYTMDmkxQrSv8TK4761tuKrV8yFwPyZDqjJafcGEiLBHiqBV6WviFxJV4",
                  x => EncryptedSecret = Guard.Correct(x) },
                { "l|language=", "The charset to use: en, es, it, fr, pt. Default=en.",
                  v => Language = v },
                { "n|numbers=", "Try passwords with numbers. Default=true.",
                  v => UseNumbers = (v == "" || v == "1" || v.ToUpper() == "TRUE") },
                { "x|symbols=", "Try passwords with symbolds. Default=true.",
                  v => UseSymbols = (v == "" || v == "1" || v.ToUpper() == "TRUE") },
                { "h|help", "Show Help",
                  v => ShowHelp = true }
            };
        }
Beispiel #2
0
        public override async Task <int> InvokeAsync(IEnumerable <string> args)
        {
            var error = false;

            try
            {
                var extra = Options.Parse(args);
                if (ShowHelp)
                {
                    Options.WriteOptionDescriptions(CommandSet.Out);
                }

                if (!error && !ShowHelp)
                {
                    await Daemon.RunAsync(WalletName, MixAll, KeepMixAlive);
                }
            }
            catch (Exception)
            {
                Console.WriteLine($"commands: There was a problem interpreting the command, please review it.");
                error = true;
            }
            Environment.Exit(error ? 1 : 0);
            return(0);
        }
Beispiel #3
0
 public MixerCommand(Daemon daemon)
     : base("mix", "Start mixing without the GUI with the specified wallet.")
 {
     Daemon  = daemon;
     Options = new OptionSet()
     {
         "usage: mix --wallet:WalletName --keepalive",
         "",
         "Start mixing without the GUI with the specified wallet.",
         "eg: ./wassabee mix --wallet:MyWalletName --keepalive",
         { "h|help", "Displays help page and exit.", x => ShowHelp = x is { } },
        /// <returns>If the GUI should run or not.</returns>
        public static async Task <bool> ExecuteCommandsAsync(Global global, string[] args)
        {
            var showHelp    = false;
            var showVersion = false;
            var daemon      = new Daemon(global);

            Logger.InitializeDefaults(Path.Combine(daemon.Global.DataDir, "Logs.txt"));

            if (args.Length == 0)
            {
                return(true);
            }

            OptionSet options = null;
            var       suite   = new CommandSet("wassabee")
            {
                "Usage: wassabee [OPTIONS]+",
                "Launches Wasabi Wallet.",
                "",
                { "h|help", "Displays help page and exit.",
                  x => showHelp = x != null },
                { "v|version", "Displays Wasabi version and exit.",
                  x => showVersion = x != null },
                "",
                "Available commands are:",
                "",
                new MixerCommand(daemon),
                new PasswordFinderCommand(daemon)
            };

            EnsureBackwardCompatibilityWithOldParameters(ref args);
            if (await suite.RunAsync(args) == 0)
            {
                return(false);
            }
            if (showHelp)
            {
                ShowHelp(options);
                return(false);
            }
            else if (showVersion)
            {
                ShowVersion();
                return(false);
            }

            return(false);
        }
Beispiel #5
0
 public MixerCommand(Daemon daemon)
     : base("mix", "Start mixing without the GUI with the specified wallet.")
 {
     Daemon  = daemon;
     Options = new OptionSet()
     {
         "usage: mix --wallet:WalletName --keepalive",
         "",
         "Start mixing without the GUI with the specified wallet.",
         "eg: ./wassabee mix --wallet:MyWalletName --keepalive",
         { "h|help", "Displays help page and exit.", x => ShowHelp = x != null },
         { "w|wallet:", "The name of the wallet file.", x => WalletName = x },
         { "destination:", "The name of the destination wallet file.", x => DestinationWalletName = x },
         { "keepalive", "Do not exit the software after mixing has been finished, rather keep mixing when new money arrives.", x => KeepMixAlive = x != null }
     };
 }
Beispiel #6
0
 public MixerCommand(Daemon daemon)
     : base("mix", "Start mixing without the GUI with the specified wallet.")
 {
     Daemon  = daemon;
     Options = new OptionSet()
     {
         "usage: mix --wallet:WalletName --mixall --keepalive",
         "",
         "Start mixing without the GUI with the specified wallet.",
         "eg: ./wassabee mix --wallet:MyWalletName --mixall --keepalive --loglevel:info",
         { "h|help", "Displays help page and exit.", x => ShowHelp = x != null },
         { "w|wallet=", "The name of the wallet file.", x => WalletName = x },
         { "mixall", "Mix once even if the coin reached the target anonymity set specified in the config file.", x => MixAll = x != null },
         { "keepalive", "Do not exit the software after mixing has been finished, rather keep mixing when new money arrives.", x => KeepMixAlive = x != null },
     };
 }
        public override Task <int> InvokeAsync(IEnumerable <string> args)
        {
            var error = false;

            try
            {
                var extra = Options.Parse(args);
                if (ShowHelp)
                {
                    Options.WriteOptionDescriptions(CommandSet.Out);
                }
                else if (string.IsNullOrWhiteSpace(WalletName) && string.IsNullOrWhiteSpace(EncryptedSecret))
                {
                    Logging.Logger.LogCritical <PasswordFinderCommand>("Missing required argument `--wallet=WalletName`.");
                    Logging.Logger.LogCritical <PasswordFinderCommand>("Use `findpassword --help` for details.");
                    error = true;
                }
                else if (!PasswordFinder.Charsets.ContainsKey(Language))
                {
                    Logging.Logger.LogCritical <PasswordFinderCommand>($"`{Language}` is not available language try with `en, es, pt, it or fr`.");
                    Logging.Logger.LogCritical <PasswordFinderCommand>("Use `findpassword --help` for details.");
                    error = true;
                }
                else if (!string.IsNullOrWhiteSpace(WalletName))
                {
                    KeyManager km = Daemon.TryGetKeyManagerFromWalletName(WalletName);
                    if (km is null)
                    {
                        error = true;
                    }
                    PasswordFinder.Find(km.EncryptedSecret.ToWif(), Language, UseNumbers, UseSymbols);
                }
                else if (!string.IsNullOrWhiteSpace(EncryptedSecret))
                {
                    PasswordFinder.Find(EncryptedSecret, Language, UseNumbers, UseSymbols);
                }
            }
            catch (Exception)
            {
                Logging.Logger.LogCritical <PasswordFinderCommand>($"There was a problem interpreting the command, please review it.");
                error = true;
            }
            Environment.Exit(error ? 1 : 0);
            return(Task.FromResult(0));
        }
        /// <returns>If the GUI should run or not.</returns>
        public static async Task <bool> ExecuteCommandsAsync(Global global, string[] args)
        {
            var showHelp    = false;
            var showVersion = false;
            var daemon      = new Daemon(global);

            if (args.Length == 0)
            {
                return(true);
            }

            OptionSet options = null;
            var       suite   = new CommandSet("mustardwalletltc")
            {
                "Usage: mustardwalletltc [OPTIONS]+",
                "Launches Mustard Wallet for Litecoin , based on Wasabi Wallet for Bitcoin .",
                "",
                { "h|help", "Displays help page and exit.", x => showHelp = x != null },
                { "v|version", "Displays version and exit.", x => showVersion = x != null },
                "",
                "Available commands are:",
                "",
                new MixerCommand(daemon),
                new PasswordFinderCommand(global.WalletManager)
            };

            EnsureBackwardCompatibilityWithOldParameters(ref args);
            if (await suite.RunAsync(args) == 0)
            {
                return(false);
            }
            if (showHelp)
            {
                ShowHelp(options);
                return(false);
            }
            else if (showVersion)
            {
                ShowVersion();
                return(false);
            }

            return(false);
        }