Esempio n. 1
0
 public Main_Form()
 {
     AppDomain.CurrentDomain.AssemblyResolve += LoadAssembly;
     InitializeComponent();
     Helper_Class.DoubleBuffered(listView1, true);
     splitContainer1.Panel1MinSize = 0;
     splitContainer1.Panel2MinSize = 0;
 }
Esempio n. 2
0
        private void Check_Clipboard()
        {
            while (true)
            {
                if (registerAmiiboKeyToolStripMenuItem.Checked)
                {
                    try
                    {
                        IDataObject ClipData = Clipboard.GetDataObject();
                        if (ClipData.GetData(DataFormats.Text) != null)
                        {
                            if (ClipData.GetDataPresent(DataFormats.Text))
                            {
                                string Clipboard_Text = ClipData.GetData(DataFormats.Text).ToString();
                                Clipboard_Text = Regex.Replace(Clipboard_Text, "[^a-zA-Z0-9-]", string.Empty);

                                if (Clipboard_Text.Length == 320)
                                {
                                    if (Helper_Class.ValidSHA1(Helper_Class.String_To_Byte_Array(Clipboard_Text), Amiibo_Keys_Hash))
                                    {
                                        this.Invoke(new Action(() =>
                                        {
                                            Helper_Class.FlashWindowEx(this);
                                            DialogResult DgResult = MessageBox.Show(this, i18n.__("Clipboard_Key_Message1"), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                                            if (DgResult == DialogResult.Yes)
                                            {
                                                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                                                saveFileDialog1.Filter         = i18n.__("Clipboard_Key_Filter", "|*.bin");
                                                saveFileDialog1.Title          = i18n.__("Clipboard_Key_Title");

                                                if (saveFileDialog1.ShowDialog(this) == DialogResult.OK && saveFileDialog1.FileName != "")
                                                {
                                                    byte[] clipboardStringBytes = Helper_Class.String_To_Byte_Array(Clipboard_Text);
                                                    Helper_Class.ByteArrayToFile(saveFileDialog1.FileName, clipboardStringBytes);
                                                    MessageBox.Show(this, i18n.__("Clipboard_Key_Message2"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                }
                                                else
                                                {
                                                    Clipboard.SetDataObject("");
                                                }
                                            }
                                            else
                                            {
                                                Clipboard.SetDataObject("");
                                            }
                                        }));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception) {}
                }

                Application.DoEvents();
            }
        }
Esempio n. 3
0
        public static string GetLocale(string Locale)
        {
            foreach (CultureInfo info in CultureInfo.GetCultures(CultureTypes.AllCultures))
            {
                if (CultureInfo.CreateSpecificCulture(info.Name).Name == Locale)
                {
                    return(Helper_Class.FirstLetterToUpperCase(info.NativeName));
                }
            }

            return(null);
        }
Esempio n. 4
0
        public Main_Form()
        {
            AppDomain.CurrentDomain.AssemblyResolve += LoadAssembly;
            InitializeComponent();
            Helper_Class.DoubleBuffered(listView1, true);
            splitContainer1.Panel1MinSize = 0;
            splitContainer1.Panel2MinSize = 0;

            splitContainer3.Panel1Collapsed = true;
            splitContainer3.Panel1.Hide();

            AddSearchButton();
        }
Esempio n. 5
0
        private void LoadAmiiboKey()
        {
            if (Helper_Class.ValidSHA1(File.ReadAllBytes(Config.KeyFile_Path), Amiibo_Keys_Hash))
            {
                AmiiKeys = AmiiboKeys.LoadKeys(Config.KeyFile_Path);
                splitContainer1.Visible = true;
            }
            else
            {
                Config.KeyFile_Path = null;
                File.WriteAllText(AmiiBomb_Config_File, JsonConvert.SerializeObject(Config));

                AskAmiiboKey();
            }
        }
Esempio n. 6
0
        public static byte[] Generate_Password(string Long_UID)
        {
            int Padding = 0;

            if (Long_UID.Length == 9 * 2)
            {
                Padding = 2;
            }

            int pw1 = 0xAA ^ Convert.ToInt32(Long_UID.Substring(2, 2), 16) ^ Convert.ToInt32(Long_UID.Substring(6 + Padding, 2), 16);
            int pw2 = 0x55 ^ Convert.ToInt32(Long_UID.Substring(4, 2), 16) ^ Convert.ToInt32(Long_UID.Substring(8 + Padding, 2), 16);
            int pw3 = 0xAA ^ Convert.ToInt32(Long_UID.Substring(6 + Padding, 2), 16) ^ Convert.ToInt32(Long_UID.Substring(10 + Padding, 2), 16);
            int pw4 = 0x55 ^ Convert.ToInt32(Long_UID.Substring(8 + Padding, 2), 16) ^ Convert.ToInt32(Long_UID.Substring(12 + Padding, 2), 16);

            return(Helper_Class.String_To_Byte_Array(pw1.ToString("X2") + pw2.ToString("X2") + pw3.ToString("X2") + pw4.ToString("X2")));
        }
Esempio n. 7
0
        public static string[] Get_AmiiboLife(string Amiibo_NFC_ID)
        {
            var HTML_Dom = new HtmlParser().Parse(Helper_Class.Get_Source_From_Url(AmiiboLife_BaseAdress + Amiibo_NFC_ID));

            try
            {
                return(new string[]
                {
                    Helper_Class.Clean_NewLine_Spaces(HTML_Dom.QuerySelectorAll("div.figure-info h1.name").First().TextContent),       //Name
                    Helper_Class.Clean_NewLine_Spaces(HTML_Dom.QuerySelectorAll("div.figure-info p.series-name").First().TextContent), //Series
                    AmiiboLife_BaseAdress + Amiibo_NFC_ID + "/image"                                                                   //Picture Link
                });
            }
            catch
            {
                return(new string[] { "", "", "" });
            }
        }
Esempio n. 8
0
        public static string[] Get_AmiiboAPI(string Amiibo_NFC_ID)
        {
            var JSON   = Helper_Class.Get_Source_From_Url(AmiiboAPI_BaseAdress + Amiibo_NFC_ID.Replace("-", string.Empty));
            var Amiibo = JObject.Parse(JSON)["amiibo"];

            try
            {
                return(new string[]
                {
                    Amiibo["name"].ToString(),         //Name
                    Amiibo["amiiboSeries"].ToString(), //Series
                    Amiibo["image"].ToString()         //Picture Link
                });
            }
            catch
            {
                return(new string[] { "", "", "" });
            }
        }
Esempio n. 9
0
        public static byte[] Calculate_Long_UID(string Short_UID)
        {
            /*
             *  0x00 - UID0 - Manufacturer Code (0x04 for NXP - random if spoofed)
             *  0x01 - UID1
             *  0x02 - UID2
             *  0x03 - BCC0 - 0x88 ^ UID0 ^ UID1 ^ UID2
             *  0x04 - UID3 (Never 0x88)
             *  0x05 - UID4
             *  0x06 - UID5
             *  0x07 - UID6
             *  0x08 - BCC1 - UID3 ^ UID4 ^ UID5 ^ UID6
             */

            int BCC0 = 0x88 ^ Convert.ToInt32(Short_UID.Substring(0, 2), 16) ^ Convert.ToInt32(Short_UID.Substring(2, 2), 16) ^ Convert.ToInt32(Short_UID.Substring(4, 2), 16);
            int BCC1 = Convert.ToInt32(Short_UID.Substring(6, 2), 16) ^ Convert.ToInt32(Short_UID.Substring(8, 2), 16) ^ Convert.ToInt32(Short_UID.Substring(10, 2), 16) ^ Convert.ToInt32(Short_UID.Substring(12, 2), 16);

            return(Helper_Class.String_To_Byte_Array(Short_UID.Substring(0, 6) + BCC0.ToString("X2") + Short_UID.Substring(6, 8) + BCC1.ToString("X2")));
        }
Esempio n. 10
0
        public static string[] Get_AmiiboAPI(string Amiibo_NFC_ID)
        {
            var     JSON   = Helper_Class.Get_Source_From_Url(AmiiboAPI_BaseAdress + Amiibo_NFC_ID.Replace("-", string.Empty));
            DataRow Amiibo = JsonConvert.DeserializeObject <DataSet>(JSON).Tables["amiibo"].Rows[0];

            try
            {
                return(new string[]
                {
                    Amiibo["name"].ToString(),         //Name
                    Amiibo["amiiboSeries"].ToString(), //Series
                    Amiibo["image"].ToString()         //Picture Link
                });
            }
            catch
            {
                return(new string[] { "", "", "" });
            }
        }
Esempio n. 11
0
 private void selectKeybinFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     openFileDialog1.FileName = "";
     openFileDialog1.Title    = i18n.__("Select_Key_Title");
     openFileDialog1.Filter   = i18n.__("Select_Key_Filter", "|*.bin|", "|*.*");
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         if (Helper_Class.ValidSHA1(File.ReadAllBytes(openFileDialog1.FileName), Amiibo_Keys_Hash))
         {
             Config.KeyFile_Path = openFileDialog1.FileName;
             File.WriteAllText(AmiiBomb_Config_File, JsonConvert.SerializeObject(Config));
         }
         else
         {
             DialogResult DgResult = MessageBox.Show(i18n.__("Select_Key_Message", Environment.NewLine), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (DgResult == DialogResult.Yes)
             {
                 selectKeybinFileToolStripMenuItem.PerformClick();
             }
         }
     }
 }
Esempio n. 12
0
        private async void button2_Click(object sender, EventArgs e)
        {
            comboBox1.Enabled = false;
            comboBox2.Enabled = false;
            comboBox3.Enabled = false;
            checkBox1.Enabled = false;
            button2.Enabled   = false;
            textBox1.Text     = "";

            if (comboBox3.SelectedIndex == 0)
            {
                Arduino = new Arduino_Class(comboBox1.SelectedValue.ToString(), comboBox2.SelectedItem.ToString());
                if (Arduino.Serial.IsOpen)
                {
                    toolStripStatusLabel1.Text = i18n.__("NFC_Connected");
                    string DeviceNFC = i18n.__("NFC_NTAG215");
                    if (!Action_Write)
                    {
                        DeviceNFC = i18n.__("NFC_Amiibo_NTAG215");
                    }

                    MessageBox.Show(i18n.__("NFC_Put_NTAG1", DeviceNFC) + Environment.NewLine + i18n.__("NFC_Put_NTAG2"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    textBox1.Text = i18n.__("NFC_Wait_NTAG");
                    await Task.Run(() => { while (!NTAG_isHere())
                                           {
                                           }
                                   });

                    textBox1.AppendText(i18n.__("NFC_Found_NTAG") + Environment.NewLine + Environment.NewLine);

                    string NTAG_Short_UID = Arduino.SendCommand("/GET_NTAG_UID");

                    if (NTAG_Short_UID.Length == 14)
                    {
                        if (Action_Write)
                        {
                            textBox1.AppendText(i18n.__("NFC_Short_UID") + " " + NTAG_Short_UID + Environment.NewLine);

                            string NTAG_Long_UID = BitConverter.ToString(Amiibo_Class.Calculate_Long_UID(NTAG_Short_UID)).Replace("-", "");
                            textBox1.AppendText(i18n.__("NFC_Long_UID") + " " + NTAG_Long_UID + Environment.NewLine + Environment.NewLine);

                            byte[] Amiibo_Data = Amiibo_Class.Patch(File.ReadAllBytes(Current_File_Bin), NTAG_Long_UID);
                            textBox1.AppendText("\"" + Current_File_Bin + "\" " + i18n.__("NFC_Patched") + Environment.NewLine);

                            if (checkBox1.Checked)
                            {
                                Arduino.SendCommand("/WRITE_AMIIBO 1");
                            }
                            else
                            {
                                Arduino.SendCommand("/WRITE_AMIIBO 0");
                            }

                            string Result = Arduino.SendCommand(Amiibo_Data);
                            textBox1.AppendText("\"" + Current_File_Bin + "\" " + i18n.__("NFC_Send") + Environment.NewLine + Environment.NewLine);

                            if (Result.Split('/', ' ')[1] == "ERROR")
                            {
                                textBox1.AppendText(i18n.__("NFC_Error") + " " + Result.Substring(1) + Environment.NewLine);
                            }
                            else if (Result.Split('/', ' ')[1] == "END_WRITE")
                            {
                                textBox1.AppendText(i18n.__("NFC_Amiibo_Ready") + Environment.NewLine);
                            }
                            else
                            {
                                textBox1.AppendText(i18n.__("NFC_Unknown_Response") + " " + Result + Environment.NewLine);
                            }
                        }
                        else
                        {
                            byte[] Amiibo_Dump = new byte[540];
                            int    i;
                            for (i = 0; i < 135; i++)
                            {
                                string Result = Arduino.SendCommand("/READ_AMIIBO " + i);

                                string[] SplitResult = Result.Split('/', ' ');

                                if (SplitResult.Length > 1)
                                {
                                    if (Result.Split('/', ' ')[1] == "ERROR")
                                    {
                                        textBox1.AppendText(i18n.__("NFC_Error") + " " + Result.Substring(1) + Environment.NewLine);
                                    }
                                    else
                                    {
                                        textBox1.AppendText(i18n.__("NFC_Unknown_Response") + " " + Result + Environment.NewLine);
                                    }

                                    i = 135;
                                }
                                else
                                {
                                    textBox1.AppendText(i18n.__("NFC_Page_Readed", (i + 1)) + Environment.NewLine);
                                    byte[] Buffer = Helper_Class.String_To_Byte_Array(Result);
                                    Array.Copy(Buffer, 0, Amiibo_Dump, i * 4, Buffer.Length);
                                }
                            }

                            if (i == 135)
                            {
                                textBox1.AppendText(i18n.__("NFC_Reading_Finished") + Environment.NewLine);

                                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                                saveFileDialog1.Filter           = i18n.__("NFC_Save_Dump_Amiibo_Filter", "|*.bin");
                                saveFileDialog1.Title            = i18n.__("NFC_Save_Dump_Amiibo_Title");
                                saveFileDialog1.InitialDirectory = Bin_Folder;

                                byte[]   Decrypted_Amiibo = Amiibo_Class.Decrypt(Amiibo_Dump, Main_Form.AmiiKeys);
                                string[] AmiiboLife_Info  = AmiiboInfo_Class.Get_AmiiboInfo(Amiibo_Class.Get_NFC_ID(Decrypted_Amiibo));
                                byte[]   UID = new byte[0x07];
                                Array.Copy(Amiibo_Dump, 0, UID, 0, UID.Length);

                                saveFileDialog1.FileName = ((AmiiboLife_Info[0].Trim() != "") ? AmiiboLife_Info[0].Trim().Replace(" ", "_") : BitConverter.ToString(UID).Replace("-", "")) + ".bin";

                                if (saveFileDialog1.ShowDialog(this.Parent) == DialogResult.OK && saveFileDialog1.FileName != "")
                                {
                                    File.WriteAllBytes(saveFileDialog1.FileName, Amiibo_Dump);
                                    MessageBox.Show(this, i18n.__("NFC_Save_Dump_Amiibo_Message"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                    else
                    {
                        textBox1.AppendText(i18n.__("NFC_Wrong_Tag_Model") + Environment.NewLine);
                    }

                    Arduino.SendCommand("/NTAG_HALT");
                    Arduino.Close();
                }
                else
                {
                    toolStripStatusLabel1.Text = i18n.__("NFC_No_Connected");
                    MessageBox.Show(i18n.__("NFC_No_Connection"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                comboBox1.Enabled = true;
                //comboBox2.Enabled = true;
                comboBox3.Enabled = true;
                checkBox1.Enabled = true;
                button2.Enabled   = true;
            }
            else
            {
            }
        }
Esempio n. 13
0
        private void Get_FileInfo(string BinFile)
        {
            byte[] Decrypted_Amiibo;

            if (File_IsEncrypted(BinFile))
            {
                Decrypted_Amiibo = Amiibo_Class.Decrypt(File.ReadAllBytes(Path.Combine(Current_Folder, BinFile)), AmiiKeys);
                spoofRandomIDToolStripMenuItem.Enabled = true;
            }
            else
            {
                Decrypted_Amiibo = File.ReadAllBytes(Path.Combine(Current_Folder, BinFile));
                spoofRandomIDToolStripMenuItem.Enabled = false;
            }

            string Char_ID       = Amiibo_Class.Get_Character_ID(Decrypted_Amiibo);
            string GameSeries_ID = Amiibo_Class.Get_GameSeries_ID(Decrypted_Amiibo);
            string NFC_ID        = Amiibo_Class.Get_NFC_ID(Decrypted_Amiibo);

            currentAmiiboToolStripMenuItem.DropDownItems.Clear();
            int Init = Amiibo_Class.Get_Amiibo_Initialize_UserData(Decrypted_Amiibo);

            if (Init != 0)
            {
                if (Init == 16 || Init == 48)
                {
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_Owner") + ": " + Amiibo_Class.Get_Amiibo_Mii_Nickname(Decrypted_Amiibo));
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_Nickname") + ": " + Amiibo_Class.Get_Amiibo_Nickname(Decrypted_Amiibo));
                }

                if (Init == 48)
                {
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_LastModDate") + ": " + Amiibo_Class.Get_Amiibo_LastModifiedDate(Decrypted_Amiibo));
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_WriteCounter") + ": " + Amiibo_Class.Get_Amiibo_Write_Counter(Decrypted_Amiibo));
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_AppID") + ": " + Amiibo_Class.Get_Amiibo_AppID(Decrypted_Amiibo));
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_InitAppID") + ": " + Amiibo_Class.Get_Amiibo_Initialized_AppID(Decrypted_Amiibo));
                    currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_Country") + ": " + Amiibo_Class.Get_Amiibo_Country(Decrypted_Amiibo));
                }
            }
            else
            {
                currentAmiiboToolStripMenuItem.DropDownItems.Add(i18n.__("Menu_Amiibo_Sorry"));
            }


            foreach (ToolStripMenuItem Item in currentAmiiboToolStripMenuItem.DropDownItems)
            {
                Item.RightToLeft = RightToLeft.No;
                Item.Enabled     = false;
            }

            string Cache_File_Path = Path.Combine("cache", Path.GetFileNameWithoutExtension(BinFile) + ".amiibomb");

            if (File.Exists(Cache_File_Path) && Config.Cache)
            {
                Stream stream                     = File.Open(Cache_File_Path, FileMode.Open);
                var    binaryFormatter            = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                AmiiboInfo_Cache_Class Cache_File = (AmiiboInfo_Cache_Class)binaryFormatter.Deserialize(stream);
                stream.Close();

                if (Helper_Class.ValidSHA1(Decrypted_Amiibo, Cache_File.SHA1))
                {
                    Current_NFC_ID               = Cache_File.NFC_ID;
                    pictureBox1.Image            = Cache_File.Picture;
                    nameToolStripMenuItem.Text   = label3.Text = Cache_File.Name;
                    seriesToolStripMenuItem.Text = label4.Text = Cache_File.Serie;
                }
                else
                {
                    File.Delete(Cache_File_Path);
                    Get_FileInfo(BinFile);
                }
            }
            else
            {
                Current_NFC_ID = NFC_ID;
                string[] AmiiboLife_Info = AmiiboInfo_Class.Get_AmiiboInfo(NFC_ID);
                if (AmiiboLife_Info[2] != "")
                {
                    pictureBox1.Load(AmiiboLife_Info[2]);
                    pictureBox1.Image = Helper_Class.DropShadow(pictureBox1.Image);
                }
                else
                {
                    pictureBox1.Image = null;
                }
                nameToolStripMenuItem.Text = AmiiboLife_Info[0].Trim();
                label3.Text = AmiiboLife_Info[0].Trim();
                seriesToolStripMenuItem.Text = AmiiboLife_Info[1].Trim();
                label4.Text = AmiiboLife_Info[1].Trim();

                AmiiboInfo_Cache_Class Cache_File = new AmiiboInfo_Cache_Class();
                Cache_File.SHA1    = Helper_Class.SHA1_File(Decrypted_Amiibo);
                Cache_File.Name    = AmiiboLife_Info[0].Trim();
                Cache_File.Serie   = AmiiboLife_Info[1].Trim();
                Cache_File.NFC_ID  = Current_NFC_ID;
                Cache_File.Picture = pictureBox1.Image;

                if (Config.Cache && AmiiboLife_Info[0] != "" && AmiiboLife_Info[1] != "" && AmiiboLife_Info[2] != "")
                {
                    Stream stream          = File.Open(Cache_File_Path, FileMode.Create);
                    var    binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    binaryFormatter.Serialize(stream, Cache_File);
                    stream.Close();
                }

                if (AmiiboLife_Info[0] == "" || AmiiboLife_Info[1] == "" || AmiiboLife_Info[2] == "")
                {
                    moreInformationsToolStripMenuItem.Visible = false;
                }
                else
                {
                    moreInformationsToolStripMenuItem.Visible = true;
                }
            }
        }