コード例 #1
0
        private void PromptUserNamePassword()
        {
            if (String.IsNullOrEmpty(Credentials.Username))
            {
                Console.Write("Enter your SchedulesDirect username: "******"Enter your SchedulesDirect password: ");
            Credentials.Password = ConsolePassword.ReadPassword();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: robpot891/SharpSocks
        static void Main(string[] args)
        {
            bool   help              = false;
            String serverUri         = null;
            String commandChannelId  = null;
            String domain            = null;
            String username          = null;
            String password          = null;
            String proxyUrl          = null;
            String payloadCookieName = null;
            String sessionCookieName = null;
            String userAgent         = null;
            String dfHost            = null;
            String key        = null;
            short  beaconTime = 0;
            bool   useProxy   = false;
            var    errors     = new List <String>();
            var    warnings   = new List <String>();

            var p = new OptionSet()
            {
                { "use-proxy", "Use proxy server (for system proxy set this and leave -m blank)", v => useProxy = v != null },
                { "m=|proxy=", "Proxy Url in format http://<server>:<port> (-p is implied)", v => proxyUrl = v },
                { "u=|username="******"Web proxy username ", v => username = v },
                { "d=|domain=", "Web proxy domain ", v => domain = v },
                { "p=|password="******"Web proxy password ", v => password = v },
                { "k=|encryption-key=", "The encryption key, leave blank to be asked", v => key = v },
                { "c=|cmd-id=", "Command Channel Id (required) ", v => commandChannelId = v },
                { "b=|beacon=", "Beacon time in (ms)", v => beaconTime = short.Parse(v) },
                { "s=|server-uri=", "Uri of the server, default is http://127.0.0.1:8081", v => serverUri = v },
                { "session-cookie=", "The name of the cookie to pass the session identifier", v => sessionCookieName = v },
                { "payload-cookie=", "The name of the cookie to pass smaller requests through", v => payloadCookieName = v },
                { "user-agent=", "The User Agent to be sent in any web request", v => userAgent = v },
                { "df=", "The actual Host header to be sent if using domain fronting", v => dfHost = v },
                { "h|?|help", v => help = v != null },
            };
            var extra = p.Parse(args);

            var defaultCmdChannel = "7f404221-9f30-470b-b05d-e1a922be3ff6";

            if (String.IsNullOrWhiteSpace(commandChannelId))
            {
                warnings.Add($"Command Channel Id is blank defaulting to {defaultCmdChannel}");
                if (String.IsNullOrWhiteSpace(commandChannelId))
                {
                    commandChannelId = defaultCmdChannel;
                }
            }

            if (String.IsNullOrWhiteSpace(serverUri))
            {
                warnings.Add(@"Server's URI is blank defaulting to http://127.0.0.1:8081");
                if (String.IsNullOrWhiteSpace(serverUri))
                {
                    serverUri = "http://127.0.0.1:8081";
                }
            }

            var result = Uri.TryCreate(serverUri, UriKind.Absolute, out Uri parsedServerUri);

            if (!result)
            {
                errors.Add($"Server URI {serverUri} is not valid");
            }

            IWebProxy wbProxy = null;

            if (!String.IsNullOrWhiteSpace(proxyUrl))
            {
                result = Uri.TryCreate(proxyUrl, UriKind.Absolute, out Uri proxyUri);
                if (!result)
                {
                    errors.Add($"Proxy URI {proxyUri} is not valid");
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(username))
                    {
                        SecureString secPassword = null;
                        if (String.IsNullOrWhiteSpace(password))
                        {
                            Console.WriteLine("Please enter your proxy password: "******"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36", secKey, new List <String> {
                "Upload"
            }, sessionCookieName ?? "ASP.NET_SessionId", payloadCookieName ?? "__RequestVerificationToken", System.Net.HttpWebRequest.GetSystemWebProxy(), 5000, null);

            Console.WriteLine("Ready to start cmd loop?");
            Console.ReadLine();
            sock.Start();
            Console.WriteLine("Hit [x] to quit");
            var str = "";

            while ("x" != (str = Console.ReadLine()))
            {
            }
        }