Ejemplo n.º 1
0
        public void TestMethod1()
        {
            byte[] bytes  = { 255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, 219, 0, 67, 0, 8, 6, 6, 7, 6, 5, 8, 7, 7, 7, 9, 9, 8, 10, 12, 20, 13, 12, 11, 11, 12, 25, 18, 19, 15, 20, 29, 26, 31, 30, 29, 26, 28, 28, 32, 36, 46, 39, 32, 34, 44, 35, 28, 28, 40, 55, 41, 44, 48, 49, 52, 52, 52, 31, 39, 57, 61, 56, 50, 60, 46, 51, 52, 50, 255, 219, 0, 67, 1, 9, 9, 9, 12, 11, 12, 24, 13, 13, 24, 50, 33, 28, 33, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 255, 192, 0, 17, 8, 0, 31, 0, 91, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 255, 196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250, 255, 218, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0, 245, 157, 123, 197, 214, 154, 60, 255, 0, 100, 8, 237, 118, 113, 195, 198, 203, 26, 131, 142, 75, 99, 145, 130, 126, 238, 238, 65, 29, 106, 252, 119, 119, 86, 243, 50, 221, 252, 209, 5, 80, 24, 68, 65, 13, 147, 146, 91, 56, 32, 130, 160, 12, 12, 16, 121, 57, 192, 243, 205, 66, 72, 239, 188, 75, 172, 71, 120, 226, 73, 90, 54, 134, 0, 136, 204, 124, 213, 101, 194, 167, 82, 50, 65, 29, 129, 201, 233, 154, 234, 60, 15, 226, 25, 117, 93, 36, 197, 45, 188, 73, 29, 154, 172, 75, 44, 114, 134, 44, 57, 0, 178, 125, 229, 225, 71, 94, 188, 145, 88, 82, 173, 205, 81, 197, 252, 190, 64, 224, 148, 110, 110, 220, 223, 72, 241, 32, 180, 42, 140, 236, 51, 36, 171, 144, 171, 158, 78, 7, 83, 140, 129, 239, 215, 208, 222, 138, 77, 232, 50, 232, 206, 0, 221, 176, 228, 102, 185, 11, 255, 0, 24, 219, 232, 211, 61, 144, 38, 227, 80, 14, 187, 163, 32, 71, 17, 46, 73, 3, 121, 3, 104, 85, 219, 201, 29, 215, 147, 243, 17, 206, 248, 215, 251, 74, 222, 198, 125, 65, 117, 11, 196, 181, 154, 81, 31, 217, 103, 10, 173, 30, 228, 44, 7, 202, 112, 87, 150, 94, 112, 126, 81, 157, 195, 13, 87, 82, 188, 98, 155, 90, 219, 127, 34, 225, 65, 201, 164, 244, 185, 223, 233, 242, 11, 189, 65, 175, 99, 142, 85, 142, 72, 87, 118, 240, 48, 24, 133, 96, 1, 28, 48, 193, 31, 50, 150, 92, 228, 103, 131, 90, 217, 170, 113, 88, 173, 173, 172, 118, 246, 146, 60, 73, 18, 4, 64, 196, 184, 10, 6, 0, 228, 250, 85, 45, 75, 94, 180, 208, 214, 73, 53, 107, 235, 59, 72, 66, 150, 136, 205, 32, 86, 152, 1, 150, 218, 185, 201, 35, 35, 128, 9, 57, 30, 181, 178, 87, 49, 122, 189, 13, 104, 230, 142, 93, 251, 27, 59, 24, 163, 113, 208, 138, 171, 59, 131, 170, 218, 33, 200, 33, 92, 130, 71, 7, 142, 131, 222, 179, 116, 47, 24, 104, 190, 35, 222, 52, 171, 216, 174, 164, 76, 150, 141, 14, 215, 0, 99, 157, 175, 181, 177, 200, 231, 24, 231, 173, 90, 142, 234, 11, 57, 165, 143, 202, 152, 203, 45, 193, 243, 29, 162, 11, 185, 138, 238, 25, 42, 0, 32, 32, 85, 12, 127, 186, 20, 146, 212, 220, 90, 209, 134, 183, 177, 22, 138, 143, 104, 250, 149, 205, 210, 152, 69, 254, 160, 100, 133, 28, 124, 192, 108, 68, 25, 3, 166, 124, 178, 71, 177, 25, 193, 200, 23, 45, 93, 160, 181, 158, 118, 138, 83, 190, 86, 113, 24, 95, 159, 4, 227, 165, 87, 189, 213, 44, 226, 183, 87, 189, 196, 112, 151, 0, 52, 142, 21, 75, 117, 198, 79, 7, 167, 79, 106, 169, 30, 171, 166, 234, 218, 157, 173, 179, 94, 219, 204, 225, 154, 88, 160, 138, 117, 101, 98, 184, 33, 152, 12, 229, 151, 168, 29, 51, 243, 99, 42, 10, 174, 86, 138, 124, 207, 83, 70, 210, 67, 111, 104, 145, 131, 11, 121, 12, 69, 207, 239, 57, 139, 229, 47, 208, 3, 150, 229, 56, 56, 225, 179, 158, 128, 232, 35, 239, 141, 91, 105, 93, 195, 56, 97, 130, 62, 181, 157, 98, 147, 207, 104, 179, 201, 118, 254, 100, 165, 92, 136, 200, 101, 76, 54, 74, 41, 40, 50, 189, 87, 113, 80, 197, 113, 208, 243, 90, 84, 153, 40, 195, 190, 240, 237, 164, 241, 221, 136, 33, 17, 181, 226, 180, 119, 27, 28, 70, 88, 59, 46, 230, 221, 180, 182, 64, 4, 133, 225, 88, 146, 24, 115, 145, 14, 129, 161, 193, 164, 91, 37, 145, 181, 180, 88, 196, 113, 141, 198, 48, 37, 158, 100, 102, 45, 35, 114, 220, 125, 198, 81, 146, 87, 39, 166, 0, 27, 49, 105, 246, 144, 62, 232, 161, 84, 62, 99, 203, 242, 146, 6, 231, 57, 99, 143, 115, 205, 43, 197, 5, 180, 45, 34, 65, 24, 242, 247, 200, 2, 168, 28, 156, 150, 63, 82, 73, 36, 247, 205, 79, 36, 111, 123, 14, 238, 214, 42, 95, 232, 154, 118, 162, 37, 123, 139, 11, 105, 166, 120, 246, 111, 145, 1, 56, 231, 28, 245, 29, 122, 142, 107, 203, 181, 237, 3, 93, 134, 194, 45, 42, 1, 54, 165, 3, 204, 187, 100, 80, 113, 110, 85, 112, 85, 179, 194, 143, 152, 115, 187, 24, 82, 125, 113, 236, 17, 55, 155, 12, 114, 99, 27, 212, 54, 61, 51, 89, 243, 233, 44, 218, 132, 215, 150, 242, 196, 143, 36, 12, 133, 36, 135, 114, 249, 152, 194, 200, 112, 84, 183, 28, 16, 79, 32, 46, 10, 224, 231, 58, 180, 35, 81, 118, 53, 163, 90, 84, 229, 125, 202, 233, 18, 91, 219, 102, 1, 28, 49, 57, 37, 36, 135, 140, 179, 18, 204, 113, 158, 164, 228, 159, 122, 241, 255, 0, 31, 65, 169, 120, 135, 226, 84, 122, 60, 33, 110, 60, 136, 17, 236, 45, 46, 36, 100, 23, 43, 128, 207, 131, 144, 51, 195, 130, 65, 94, 35, 198, 119, 1, 159, 103, 154, 217, 45, 166, 180, 102, 101, 100, 89, 92, 70, 26, 21, 44, 142, 196, 237, 42, 70, 2, 128, 165, 215, 161, 36, 17, 207, 93, 216, 254, 42, 240, 110, 157, 226, 155, 117, 183, 146, 226, 75, 93, 78, 3, 246, 139, 59, 200, 70, 36, 183, 124, 140, 48, 63, 80, 50, 50, 61, 120, 32, 17, 217, 25, 171, 221, 153, 169, 35, 197, 124, 75, 61, 133, 134, 159, 12, 26, 134, 150, 52, 127, 20, 219, 74, 165, 39, 178, 8, 176, 74, 138, 72, 39, 40, 224, 7, 221, 156, 149, 7, 12, 152, 227, 162, 251, 214, 137, 126, 46, 252, 57, 166, 94, 36, 73, 246, 171, 187, 53, 150, 37, 149, 199, 206, 74, 2, 55, 58, 174, 57, 200, 201, 11, 223, 129, 218, 188, 239, 254, 17, 79, 137, 186, 9, 123, 125, 31, 198, 208, 221, 91, 51, 111, 146, 91, 232, 242, 226, 66, 57, 31, 58, 200, 113, 141, 167, 131, 212, 158, 58, 147, 232, 209, 221, 199, 166, 198, 177, 194, 170, 109, 85, 66, 67, 4, 72, 16, 69, 128, 21, 81, 70, 0, 3, 142, 51, 208, 158, 160, 96, 7, 59, 201, 104, 57, 93, 163, 150, 209, 172, 225, 241, 14, 189, 226, 11, 205, 88, 190, 163, 62, 157, 121, 36, 22, 246, 152, 69, 196, 106, 196, 160, 198, 64, 61, 8, 27, 184, 235, 146, 123, 89, 91, 127, 11, 216, 248, 174, 211, 85, 182, 158, 69, 146, 104, 60, 203, 107, 123, 40, 11, 163, 141, 172, 172, 193, 81, 73, 32, 142, 70, 0, 251, 164, 243, 154, 183, 168, 248, 95, 68, 109, 70, 77, 104, 125, 179, 78, 186, 10, 239, 52, 246, 114, 237, 221, 199, 39, 28, 224, 224, 30, 128, 103, 39, 57, 38, 167, 209, 124, 57, 160, 232, 51, 155, 139, 117, 150, 91, 165, 200, 18, 204, 119, 50, 131, 128, 64, 192, 0, 125, 113, 158, 79, 56, 172, 121, 37, 216, 109, 171, 29, 7, 146, 126, 212, 93, 38, 32, 146, 11, 175, 82, 64, 232, 7, 160, 206, 106, 205, 102, 73, 52, 58, 109, 148, 250, 198, 160, 194, 221, 98, 182, 50, 221, 132, 102, 145, 16, 42, 229, 136, 249, 65, 108, 0, 113, 192, 207, 166, 77, 84, 254, 223, 212, 255, 0, 232, 79, 214, 255, 0, 239, 245, 151, 255, 0, 36, 82, 51, 72, 255, 217 };
            byte[] result = YSEncrypt.EncryptFishFile(bytes);
            string path   = @"D:\CodeFiles\Tz\Tz.WebSiteTests\miwen.txt";

            FileHelper.ExistsFile(path);

            FileHelper.WriteText(path, "加密前长度:" + bytes.Length + "\r\n" + string.Join(",", bytes) + "\r\n加密后长度:" + result.Length + "\r\n" + string.Join(",", result), Encoding.UTF8);
        }
Ejemplo n.º 2
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            // 保存
            if (config == null)
            {
                config             = new SessionConfig();
                config.Index       = AppConfig.Instance.SessionConfigDict.Count + 1;
                config.SessionId   = "S" + YSTools.YSDateTime.ConvertDateTimeToLong();
                config.Name        = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
                config.Host        = tb_host.Text;
                config.Port        = (int)nud_port.Value;
                config.Protocol    = cb_protocol.SelectedItem.ToString();
                config.Method      = cb_method.SelectedItem.ToString();
                config.RemenberPwd = cb_remenber_pwd.Checked;
                config.UserName    = tb_userName.Text;
                config.Password    = YSEncrypt.EncryptA(tb_password.Text, KeysUtil.PassKey);

                ColorTheme theme = new ColorTheme();
                theme.ColorScheme = cb_scheme.SelectedItem.ToString();
                theme.FontName    = cb_fontName.SelectedItem.ToString();
                theme.FontSize    = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());

                config.Theme = theme;

                AppConfig.Instance.SessionConfigDict.Add(config.Index + config.Name, config);
            }
            else
            {
                config.Name        = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
                config.Host        = tb_host.Text;
                config.Port        = (int)nud_port.Value;
                config.Protocol    = cb_protocol.SelectedItem.ToString();
                config.Method      = cb_method.SelectedItem.ToString();
                config.RemenberPwd = cb_remenber_pwd.Checked;
                config.UserName    = tb_userName.Text;
                config.Password    = YSEncrypt.EncryptA(tb_password.Text, KeysUtil.PassKey);

                config.Theme.ColorScheme = cb_scheme.SelectedItem.ToString();
                config.Theme.FontName    = cb_fontName.SelectedItem.ToString();
                config.Theme.FontSize    = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());

                if (AppConfig.Instance.SessionConfigDict.ContainsKey(config.SessionId))
                {
                    AppConfig.Instance.SessionConfigDict.Remove(config.SessionId);
                }
                AppConfig.Instance.SessionConfigDict.Add(config.SessionId, config);
            }
            // 保存
            AppConfig.Instance.SaveConfig();

            this.Close();
        }
Ejemplo n.º 3
0
        public void InitUI()
        {
            tb_host.Text     = config.Host;
            tb_name.Text     = config.Name;
            tb_password.Text = YSEncrypt.DecryptB(config.Password, KeysUtil.PassKey);
            tb_userName.Text = config.UserName;

            cb_protocol.SelectedItem = config.Protocol;
            cb_method.SelectedItem   = config.Method;
            cb_scheme.SelectedItem   = config.Theme.ColorScheme;
            cb_fontName.SelectedItem = config.Theme.FontName;
            cb_fontSize.SelectedItem = config.Theme.FontSize;
            cb_remenber_pwd.Checked  = config.RemenberPwd;
        }
Ejemplo n.º 4
0
        public void Connect()
        {
            shell = new SshShell(user.Host, user.UserName, YSEncrypt.DecryptB(user.Password, KeysUtil.PassKey));

            shell.Connect(user.Port);

            m_Channel = shell.getChannel();
            session   = shell.getSession();

            sftpChannel = (ChannelSftp)session.openChannel("sftp");
            sftpChannel.connect();

            ThreadPool.QueueUserWorkItem((a) =>
            {
                string line = null;
                while (RUN_CUT && shell.ShellOpened)
                {
                    success = true;
                    logger.Debug("Successed...");
                    sftpForm.HideTool();

                    System.Threading.Thread.Sleep(100);
                    while ((line = m_Channel.GetMessage()) != null)
                    {
                        Console.WriteLine(line);
                    }
                }

                logger.Debug("Disconnecting...");
                Disconnection();
                logger.Debug("OK");
            });

            dir = sftpChannel.getHome();

            text_adress.Text = dir;

            LoadDirFilesToListView(dir);

            SetContentMenuItem(true);
        }
Ejemplo n.º 5
0
        public void TestReg()
        {
            string text = "1";

            //string key = "87654321";
            //string sbuff = DESEncrypt.EncryptHas(text, key);
            //string date = "2017-10-13";
            //DateTime dt = Convert.ToDateTime(date);

            byte[] data = Encoding.ASCII.GetBytes(text);

            byte[]        miwen = YSEncrypt.EncryptFishFile(data);
            StringBuilder ret   = new StringBuilder();

            foreach (byte b in miwen)
            {
                ret.AppendFormat("{0:X2}", b);
            }
            string mw = ret.ToString();

            int len;

            len = mw.Length / 2;
            byte[] inputByteArray = new byte[len];
            int    x, i;

            for (x = 0; x < len; x++)
            {
                i = Convert.ToInt32(mw.Substring(x * 2, 2), 16);
                inputByteArray[x] = (byte)i;
            }

            byte[] mingwen = YSEncrypt.DecryptData(inputByteArray);

            string result = Encoding.ASCII.GetString(mingwen);
            //string url = "http://192.168.1.10:11005/api/user/MemberRegister?username=w11111&userpwd=123123&yzm=1231&useryz=1231&fw=1231";
            //UserController user = new UserController();
            //user.MemberRegister("w21111", "123123", "1231", "1231", "1231");
            //string msg = Tz.Core.HttpMethods.HttpGet(url);
        }
Ejemplo n.º 6
0
        public ActionResult GetAuthCode()
        {
            VerifyCode verifyCode = new VerifyCode();

            byte[] bytes = verifyCode.CreateImage();
            string code  = verifyCode.ValidationCode;
            string token = Md5.md5(Guid.NewGuid().ToString(), 16);

            Log.Debug("生成token:" + token);
            Cache.Insert(token, (object)Md5.md5(code.ToLower(), 16), 10);
            byte[] byteArray = System.Text.Encoding.Default.GetBytes(token);
            //string str = string.Empty;
            //for (int i = 0; i < bytes.Count(); i++)
            //{
            //    str += bytes[i];
            //    str += ",";
            //}
            //string path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "a.txt";
            //FileHelper.ExistsFile(path);
            //FileHelper.AppendText(path, "长度:" + bytes.Count()+"\r\n" + str + "\r\n");
            //FileHelper.CreateFile("b.txt", str);
            //string str = "255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,255,219,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,255,219,0,67,1,9,9,9,12,11,12,24,13,13,24,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,255,192,0,17,8,0,31,0,91,3,1,34,0,2,17,1,3,17,1,255,196,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,255,196,0,181,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250,255,196,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,255,196,0,181,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250,255,218,0,12,3,1,0,2,17,3,17,0,63,0,245,7,214,175,181,77,70,225,124,61,99,5,194,192,251,62,219,59,98,16,113,146,6,57,111,76,174,59,30,65,171,62,25,251,68,150,163,251,84,121,90,170,202,207,34,44,133,75,224,99,113,81,128,70,31,156,110,92,145,208,140,46,46,137,121,14,159,162,75,165,53,229,166,159,125,105,115,42,121,237,39,14,220,141,229,120,221,193,192,221,145,242,131,142,48,32,240,230,159,112,124,68,186,133,164,255,0,109,182,49,226,75,235,213,249,158,64,49,251,188,252,192,96,227,158,56,97,216,87,58,169,102,159,115,73,65,89,163,191,43,13,204,99,114,199,42,103,35,32,48,175,57,185,248,139,174,106,55,23,95,240,139,232,6,250,205,9,72,174,89,24,229,144,110,114,202,49,128,70,54,130,65,39,212,157,163,177,144,37,238,157,44,81,19,104,110,109,204,105,52,101,161,120,213,129,193,25,25,70,4,231,4,2,14,51,94,97,160,120,195,81,240,22,143,113,225,221,79,195,215,71,81,243,165,77,62,120,45,142,203,201,115,129,156,237,46,55,20,1,151,36,169,81,129,129,159,75,13,5,81,54,149,218,232,115,75,67,213,124,61,174,218,248,139,69,183,212,109,93,8,145,64,146,48,217,49,73,129,185,15,3,145,244,25,24,61,8,171,118,247,223,105,113,229,192,230,60,202,173,40,116,101,86,71,217,131,134,39,39,146,56,227,105,13,180,241,94,93,240,158,242,242,235,71,214,39,86,142,63,62,113,182,250,72,140,146,60,228,2,85,249,203,1,144,126,174,220,243,93,190,165,227,13,47,77,191,254,206,185,191,182,183,185,151,112,134,66,76,139,25,194,99,205,81,130,153,46,78,9,198,20,146,195,165,69,90,124,181,92,35,208,47,101,118,107,23,91,171,219,73,161,33,225,17,153,4,171,202,176,97,129,130,56,62,191,74,135,84,130,105,245,13,42,88,227,45,29,164,242,92,202,195,29,60,153,35,10,7,82,196,200,8,227,24,83,146,14,1,158,61,74,214,89,226,142,41,60,197,150,35,42,74,159,52,108,6,63,140,113,159,152,16,59,142,71,67,84,36,186,150,70,139,200,137,148,189,218,155,149,121,142,2,5,234,164,54,84,101,87,128,164,49,36,17,134,103,92,110,187,148,155,47,216,31,34,222,222,217,195,137,25,25,254,227,96,12,142,9,198,1,249,135,7,147,206,51,131,139,153,172,75,217,180,61,38,11,237,70,227,109,188,126,80,23,50,40,101,5,67,59,1,199,114,210,63,78,88,183,122,243,93,11,92,241,66,234,23,55,182,241,197,55,134,164,154,89,218,254,88,240,201,107,20,142,204,55,47,206,14,24,237,86,201,244,0,3,73,202,61,10,81,111,99,216,165,144,199,19,186,198,210,178,169,33,16,128,88,250,12,144,50,125,200,20,144,201,35,193,27,73,26,135,101,5,132,111,185,65,199,56,39,25,30,248,21,201,120,91,199,62,30,241,82,127,103,218,72,208,76,16,98,218,102,8,237,146,249,85,249,178,196,4,220,113,145,134,25,57,200,29,138,168,85,10,160,5,3,0,14,212,110,43,52,236,204,91,221,27,72,187,188,123,171,237,61,76,193,182,135,118,255,0,91,242,142,112,15,32,116,228,118,61,176,76,177,73,5,178,11,116,116,242,153,178,168,126,101,65,216,113,194,168,236,59,83,245,219,215,211,172,34,184,138,56,221,218,242,214,15,222,12,128,178,207,28,108,126,184,115,143,124,117,167,107,23,113,104,250,13,229,224,182,89,35,182,133,164,242,65,218,27,28,227,161,199,229,75,151,93,6,174,236,140,237,78,223,81,188,210,153,116,201,45,109,46,217,88,172,172,161,146,55,237,145,156,28,231,208,227,57,32,244,60,77,222,159,241,7,196,214,71,71,191,211,180,123,27,59,150,217,114,202,222,99,66,163,12,27,105,145,134,79,59,113,206,70,126,94,26,189,46,77,57,26,229,37,71,49,168,32,178,1,195,96,96,125,7,181,36,182,99,122,205,29,165,187,78,173,177,88,185,83,229,179,46,254,66,231,56,25,219,208,149,3,35,168,210,156,253,158,209,79,212,151,169,207,232,62,15,181,240,214,157,21,149,156,115,188,113,92,53,192,102,156,238,121,10,149,203,1,242,145,183,0,12,118,7,168,205,114,62,39,209,180,171,77,67,76,153,236,93,173,117,27,246,146,246,234,71,32,228,177,33,119,227,10,191,59,100,12,18,16,114,8,205,122,99,69,27,92,77,104,103,185,204,137,191,135,219,177,120,92,41,28,142,121,207,94,122,246,174,31,226,192,150,31,14,192,114,126,205,29,200,99,242,15,153,138,200,120,57,206,70,14,114,57,220,48,120,53,84,156,229,86,237,189,72,169,110,71,228,115,186,31,141,116,175,9,234,115,105,198,105,111,52,217,29,126,207,114,225,219,201,92,228,130,132,140,0,89,178,85,65,36,30,15,0,119,179,235,250,74,104,211,107,163,82,142,234,27,55,145,76,182,241,238,33,183,99,96,198,7,241,0,9,236,65,207,59,142,56,210,167,215,124,29,22,157,226,111,39,70,89,46,81,227,182,210,215,104,216,206,18,53,124,110,83,151,124,241,254,201,56,193,174,133,180,77,23,65,208,6,158,44,162,254,205,146,226,36,104,60,161,32,121,36,149,85,89,183,231,118,24,175,39,56,0,99,160,20,85,228,147,210,247,254,181,232,42,92,203,71,177,230,250,222,167,121,241,2,226,238,203,77,186,138,207,68,179,249,167,188,185,109,130,103,195,20,47,158,66,101,78,61,0,220,121,192,18,69,226,175,19,105,90,69,191,129,95,74,123,93,113,227,75,104,46,119,252,162,38,221,251,192,83,166,197,192,220,51,209,137,57,82,15,85,125,224,68,209,95,80,213,124,47,12,159,218,215,17,178,69,19,186,8,33,36,134,44,163,3,7,229,194,140,144,25,134,64,92,227,156,248,124,207,174,124,70,213,175,60,67,35,182,185,98,165,109,224,12,76,112,128,89,36,3,25,24,93,192,14,78,119,19,201,228,115,242,219,67,175,153,53,126,136,236,124,19,225,93,51,194,122,124,86,240,70,151,55,238,93,101,191,22,197,89,242,119,5,39,45,181,64,85,24,206,9,25,234,107,175,195,127,120,126,85,94,43,118,71,207,156,64,243,76,132,34,40,12,8,35,105,227,159,92,140,28,129,219,32,217,171,177,141,239,169,255,217";
            //var aa = str.Split(',');
            //byte[] buffs = new byte[aa.Length];
            //for (int i = 0; i < aa.Length; i++)
            //{
            //    buffs[i] = (byte)aa[i].ToInt();
            //}
            byte[] result = YSEncrypt.EncryptFishFile(bytes);

            byte[] arr = byteArray.Concat(result).ToArray();
            //string ss = string.Empty;
            //for (int i = 0; i < result.Count(); i++)
            //{
            //    ss += result[i];
            //    ss += ",";
            //}
            //FileHelper.AppendText(path, "长度:" + result.Count()+"\r\n" + ss + "\r\n");
            return(File(arr, @"image/Gif"));
        }
Ejemplo n.º 7
0
        private void toolStripButton7_Click(object sender, EventArgs e)
        {
            string host     = text_host.Text;
            string username = text_username.Text;
            string pass     = text_pass.Text;
            string port     = text_port.Text;

            IPAddress ip;

            if (IPAddress.TryParse(host, out ip))
            {
                if (string.IsNullOrWhiteSpace(username))
                {
                    MessageBox.Show(this, "请输入用户名");
                }
                else if (string.IsNullOrWhiteSpace(pass))
                {
                    MessageBox.Show(this, "请输入密码");
                }
                else if (string.IsNullOrWhiteSpace(port))
                {
                    MessageBox.Show(this, "请输入端口号");
                }
                else
                {
                    user.Host     = host;
                    user.UserName = username;
                    user.Password = YSEncrypt.EncryptA(pass, KeysUtil.PassKey);
                    user.Port     = Convert.ToInt32(port);

                    LoadRightForm(user);
                }
            }
            else
            {
                MessageBox.Show(this, "Host地址不正确");
            }
        }
Ejemplo n.º 8
0
        public IHttpActionResult MemberRegister(string username, string userpwd, string verify, string yzm, string useryz, string fw)
        {
            Log.Debug("这个是用户注册方法");
            Regex accountRex = new Regex("^[A-Za-z0-9_][A-Za-z0-9_]*$");

            if (!accountRex.IsMatch(username))
            {
                return(Json(3));
            }
            Log.Debug("返回token:" + fw);
            string code = Cache.Get(fw)?.ToString();

            Log.Debug("服务器保存的验证码:" + code);
            Log.Debug("用户传递的验证码:" + Md5.md5(yzm.ToLower(), 16));
            string yzmMd5 = Md5.md5(yzm.ToLower(), 16);

            if (code != yzmMd5)
            {
                return(Json(2));
            }

            DbHelper helper = new DbHelper("QpAccount");

            string  sql = string.Format("select * from account where account='{0}'", username);
            DataSet ds  = helper.GetDataTablebySQL(sql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(Json(4));
            }

            string  sqlMaxNum = "select MAX(AccountNum) from Account";
            DataSet dsMaxNum  = helper.GetDataTablebySQL(sqlMaxNum);
            int     num       = 100000;

            if (dsMaxNum.Tables[0].Rows.Count > 0)
            {
                num = dsMaxNum.Tables[0].Rows[0][0].ToInt() + 1;
            }

            int len;

            len = verify.Length / 2;
            byte[] inputByteArray = new byte[len];
            int    x, i;

            for (x = 0; x < len; x++)
            {
                i = Convert.ToInt32(verify.Substring(x * 2, 2), 16);
                inputByteArray[x] = (byte)i;
            }

            byte[] mingwen = YSEncrypt.DecryptData(inputByteArray);

            string str = Encoding.ASCII.GetString(mingwen);


            string account           = username;
            string password          = userpwd;
            string accounttype       = "11";
            string accountsecondtype = "0";
            string sex        = "2";
            string nickname   = "新手" + num;
            string accountnum = num.ToString();
            string ipaddress  = Net.Ip;
            string mac        = string.Join(" , ", Tz.Core.Net.GetMacByNetworkInterface());
            string details    = "|||0|0|||||||";
            //|密保问题|密保答案|年龄|身高cm|学历|生肖|星座|职业|省|市|
            //string[] userInfo = details.Split('|');
            //string mbwt = userInfo[1];
            //string mbda = userInfo[2];
            //string age = userInfo[3];
            //string sg = userInfo[4];
            //string xl = userInfo[5];
            //string sx = userInfo[6];
            //string xz = userInfo[7];
            //string zy = userInfo[8];
            //string sheng = userInfo[9];
            //string shi = userInfo[10];

            string realname    = "";
            string idntirycard = "";
            string telephone   = "";
            string parentid    = "";
            string Url         = GetUrlStr() + string.Format("ysfunction={0}&account={1}&password={2}&accounttype={3}&accountsecondtype={4}&sex={5}&nickname={6}&accountnum={7}&ipaddress={8}&mac={9}&details={10}",
                                                             "register", account, password, accounttype, accountsecondtype, sex, nickname, accountnum, ipaddress, mac, details);
            string msg     = HttpMethods.HttpGet(Url);
            Regex  rex     = new Regex(@"(-\d+|\d+)<");
            int    result  = 0;
            string respson = rex.Match(msg).Groups[1].Value;

            Log.Debug(msg);
            if (respson != "-1" && respson != "-3" && respson != "-999" && respson != "-404")
            {
                result = 0;
            }
            else
            {
                result = respson.ToInt();
            }
            return(Json(result));
        }
Ejemplo n.º 9
0
        public IHttpActionResult TouristLogin(string verify)
        {
            Log.Debug("这个是游客登陆方法");

            string upwd = "c8c8e2585e7555ee27396f4645b415ff";

            Regex accountRex = new Regex("^[A-Za-z0-9_][A-Za-z0-9_]*$");
            int   len;

            len = verify.Length / 2;
            byte[] inputByteArray = new byte[len];
            int    x, i;

            for (x = 0; x < len; x++)
            {
                i = Convert.ToInt32(verify.Substring(x * 2, 2), 16);
                inputByteArray[x] = (byte)i;
            }

            byte[] mingwen = YSEncrypt.DecryptData(inputByteArray);

            string   macAddress = Encoding.ASCII.GetString(mingwen);
            DbHelper helper     = new DbHelper("QpAccount");
            int      rows       = 0;
            string   uname      = string.Empty;

            do
            {
                uname = BuildAccount();
                string  sql = string.Format("select * from account where account='{0}'", uname);
                DataSet ds  = helper.GetDataTablebySQL(sql);
                rows = ds.Tables[0].Rows.Count;
            } while (rows > 0);


            string  sqlMaxNum = "select MAX(AccountNum) from Account";
            DataSet dsMaxNum  = helper.GetDataTablebySQL(sqlMaxNum);
            int     num       = 100000;

            if (dsMaxNum.Tables[0].Rows.Count > 0)
            {
                num = dsMaxNum.Tables[0].Rows[0][0].ToInt() + 1;
            }


            string account           = uname;
            string password          = upwd;
            string accounttype       = "11";
            string accountsecondtype = "0";
            string sex        = "2";
            string nickname   = uname;
            string accountnum = num.ToString();
            string ipaddress  = Net.Ip;
            string mac        = Net.GetMacAddress();// string.Join(" , ", Tz.Core.Net.GetMacByNetworkInterface());
            string details    = "|||0|0|||||||";
            //|密保问题|密保答案|年龄|身高cm|学历|生肖|星座|职业|省|市|
            //string[] userInfo = details.Split('|');
            //string mbwt = userInfo[1];
            //string mbda = userInfo[2];
            //string age = userInfo[3];
            //string sg = userInfo[4];
            //string xl = userInfo[5];
            //string sx = userInfo[6];
            //string xz = userInfo[7];
            //string zy = userInfo[8];
            //string sheng = userInfo[9];
            //string shi = userInfo[10];

            string realname    = "";
            string idntirycard = "";
            string telephone   = "";
            string parentid    = "";
            string Url         = GetUrlStr() + string.Format("ysfunction={0}&account={1}&password={2}&accounttype={3}&accountsecondtype={4}&sex={5}&nickname={6}&accountnum={7}&ipaddress={8}&mac={9}&details={10}",
                                                             "register", account, password, accounttype, accountsecondtype, sex, nickname, accountnum, ipaddress, mac, details);
            string msg     = HttpMethods.HttpGet(Url);
            Regex  rex     = new Regex(@"(-\d+|\d+)<");
            string result  = "0";
            string respson = rex.Match(msg).Groups[1].Value;

            Log.Debug(msg);
            if (respson != "-1" && respson != "-3" && respson != "-999" && respson != "-404")
            {
                result = "0&" + uname + "&" + upwd;
            }
            else
            {
                result = respson;
            }
            return(Json(result));
        }