Example #1
0
        public void wifi_should_escape_input()
        {
            var ssid     = "MyWiFiSSID";
            var password = "******";
            var authmode = PayloadGenerator.WiFi.Authentication.WPA;
            var hideSSID = true;

            var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);

            generator.ToString().ShouldBe($"WIFI:T:WPA;S:MyWiFiSSID;P:7heP4assw0rd;H:true;");
        }
Example #2
0
        public void wifi_should_add_hiddenSSID_param()
        {
            var ssid     = "M\\y;W,i:FiSSID";
            var password = "******";
            var authmode = PayloadGenerator.WiFi.Authentication.WPA;
            var hideSSID = true;

            var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);

            generator.ToString().ShouldBe($"WIFI:T:WPA;S:M\\\\y\\;W\\,i\\:FiSSID;P:7heP4assw0rd\\\\\\;\\:\\,;H:true;");
        }
Example #3
0
        public void wifi_should_build_wep()
        {
            var ssid     = "MyWiFiSSID";
            var password = "******";
            var authmode = PayloadGenerator.WiFi.Authentication.WEP;
            var hideSSID = false;

            var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);

            generator.ToString().ShouldBe($"WIFI:T:WEP;S:MyWiFiSSID;P:7heP4assw0rd;;");
        }
Example #4
0
        public void wifi_should_escape_hex_style4()
        {
            var ssid     = "0XA9B7F18CCE";
            var password = "******";
            var authmode = PayloadGenerator.WiFi.Authentication.WPA;
            var hideSSID = true;

            var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);

            generator.ToString().ShouldBe($"WIFI:T:WPA;S:\"0XA9B7F18CCE\";P:\"0X00105F0E6\";H:true;");
        }
Example #5
0
        public void wifi_should_escape_hex_style2()
        {
            var ssid     = "a9b7f18cce";
            var password = "******";
            var authmode = PayloadGenerator.WiFi.Authentication.WPA;
            var hideSSID = true;

            var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);

            generator.ToString().ShouldBe($"WIFI:T:WPA;S:\"a9b7f18cce\";P:\"00105f0Ee6\";H:true;");
        }
Example #6
0
        public static Bitmap QRwifi(TextBox tb_ssid, TextBox tb_pass)
        {
            PayloadGenerator.WiFi generator = new PayloadGenerator.WiFi(tb_ssid.Text, tb_pass.Text, PayloadGenerator.WiFi.Authentication.WPA);
            String payload = generator.ToString();

            QRCodeGenerator QR    = new QRCodeGenerator();
            QRCodeData      data  = QR.CreateQrCode(payload, QRCodeGenerator.ECCLevel.H);
            QRCode          code  = new QRCode(data);
            Bitmap          image = code.GetGraphic(50, "#c23616", "#FFF");

            return(image);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap qrCodeImage = null;

            if (wifiSSID.Text.Length == 0)
            {
                QRCodeGenerator qrGenerator = new QRCodeGenerator();
                //# QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
                QRCodeData qrCodeData = qrGenerator.CreateQrCode(SourceText.Text.ToString(), QRCodeGenerator.ECCLevel.Q);

                QRCode qrCode = new QRCode(qrCodeData);
                qrCodeImage = qrCode.GetGraphic(20);
            }
            else
            {
                //string authType = "";
                PayloadGenerator.WiFi.Authentication authType = PayloadGenerator.WiFi.Authentication.WPA;
                switch (wifiAuth.Text.ToUpper())
                {
                case "WPA":
                    authType = PayloadGenerator.WiFi.Authentication.WPA;
                    break;

                case "WEP":
                    authType = PayloadGenerator.WiFi.Authentication.WEP;
                    break;
                }

                PayloadGenerator.WiFi generator = new PayloadGenerator.WiFi(wifiSSID.Text, wifiPassword.Text.ToString(), authType);
                string payload = generator.ToString();

                QRCodeGenerator qrGenerator    = new QRCodeGenerator();
                QRCodeData      qrCodeData     = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
                QRCode          qrCode         = new QRCode(qrCodeData);
                var             qrCodeAsBitmap = qrCode.GetGraphic(20);
                qrCodeImage = qrCodeAsBitmap;
                //pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            pictureBox1.Image    = qrCodeImage;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            //pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
        }