示例#1
0
文件: Form1.cs 项目: zanzo420/SigTool
        string[] ConvertSig(SigStyle fromstyle, SigStyle tostyle, string data, string mask)
        {
            data = ConvertPEiD(fromstyle, data, mask);
            string[] outstr = new string[] { "", "" };
            if ((tostyle == SigStyle.PEiD) && CheckPEiD(data))
            {
                outstr[0] = data;
            }
            if ((tostyle == SigStyle.IDA) && CheckPEiD(data))
            {
                outstr[0] = Regex.Replace(data, @"\?{2}", "?");
            }
            if ((tostyle == SigStyle.Code) && CheckPEiD(data) == true)
            {
                string tmpstr  = " " + data;
                string tmpmask = data;

                tmpmask = Regex.Replace(tmpmask, @"[0-9a-f]{2}\s?", "x");
                tmpmask = Regex.Replace(tmpmask, @"[\?]{2}\s?", "?");

                tmpstr    = Regex.Replace(tmpstr, @"[\s]", "\\x");
                tmpstr    = Regex.Replace(tmpstr, @"[\?]{2}\s?", "00");
                outstr[0] = tmpstr;
                outstr[1] = tmpmask;
            }
            if ((tostyle == SigStyle.Byte) && CheckPEiD(data) == true)
            {
                string tmpstr  = " " + data;
                string tmpmask = data;

                tmpmask = Regex.Replace(tmpmask, @"[0-9a-f]{2}\s?", "x");
                tmpmask = Regex.Replace(tmpmask, @"[\?]{2}\s?", "?");

                tmpstr    = Regex.Replace(tmpstr, @"[\s]", ", 0x");
                tmpstr    = Regex.Replace(tmpstr, @"[\?]{2}\s?", "00");
                outstr[0] = tmpstr.TrimStart(' ', ',');
                outstr[1] = tmpmask;
            }

            return(outstr);
        }
示例#2
0
文件: Form1.cs 项目: zanzo420/SigTool
        string ConvertPEiD(SigStyle fromsigstyle, string data, string mask)
        {
            string outstr = data;

            if ((fromsigstyle == SigStyle.IDA) && CheckIDA(data))
            {
                outstr = data.Replace("?", "??");
            }
            if ((fromsigstyle == SigStyle.PEiD) && CheckPEiD(data))
            {
                outstr = data;
            }
            if ((fromsigstyle == SigStyle.Code) && CheckCode(data, mask) == true)
            {
                for (int i = 0; i < mask.Length; i++)
                {
                    if (mask[i] == '?')
                    {
                        outstr = outstr.Remove(((i * 4) + 2), 2).Insert(((i * 4) + 2), "??");
                    }
                }
                outstr = Regex.Replace(outstr, @"\\x", " ").TrimStart(' ');
            }
            if ((fromsigstyle == SigStyle.Byte) && CheckByte(data, mask) == true)
            {
                for (int i = 0; i < mask.Length; i++)
                {
                    if (mask[i] == '?')
                    {
                        outstr = outstr.Remove(((i * 6) + 2), 2).Insert(((i * 6) + 2), "??");
                    }
                }
                outstr = Regex.Replace(outstr, @",?\s?0x", " ").TrimStart(' ');
            }

            return(outstr);
        }
示例#3
0
文件: Form1.cs 项目: zanzo420/SigTool
        void ProdUpdate()
        {
            ProdData.Text = ProdData.Text.ToLower();



            ProdRadio_Code.AutoCheck = ProdRadio_IDA.AutoCheck = ProdRadio_PEiD.AutoCheck = ProdRadio_Byte.AutoCheck = ProdAutoDetect.Enabled;

            foreach (Signature sig in Signature.list)
            {
                if (sig.name == ProdSigName.Text)
                {
                    savesigbutton.Enabled = validsigbox.Checked = false;
                    return;
                }
            }


            SigStyle ID = SigStyle.Error;

            if (ProdAutoDetect.Checked)
            {
                ID = GetAutoID(ProdData.Text);
                switch (ID)
                {
                case SigStyle.Byte: ProdRadio_Byte.Checked = true; ProdMask.Enabled = true; break;

                case SigStyle.Code: ProdRadio_Code.Checked = true; ProdMask.Enabled = true; break;

                case SigStyle.IDA: ProdRadio_IDA.Checked = true; ProdMask.Enabled = false; break;

                case SigStyle.PEiD: ProdRadio_PEiD.Checked = true; ProdMask.Enabled = false; break;

                case SigStyle.Error: ProdUnknown.Visible = ProdUnknown.Checked = true; break;
                }
            }
            else
            {
                ProdUnknown.Visible = ProdUnknown.Checked = false;
                if (ProdRadio_Byte.Checked)
                {
                    ID = SigStyle.Byte;
                }
                if (ProdRadio_Code.Checked)
                {
                    ID = SigStyle.Code;
                }
                if (ProdRadio_IDA.Checked)
                {
                    ID = SigStyle.IDA;
                }
                if (ProdRadio_PEiD.Checked)
                {
                    ID = SigStyle.PEiD;
                }
            }

            if (ID == SigStyle.Error)
            {
                ProdUnknown.Visible = ProdUnknown.Checked = true;
            }
            else
            {
                ProdUnknown.Visible = false;
            }


            bool?ProdDataGood = true;

            if (ProdRadio_Byte.Checked)
            {
                ProdDataGood = CheckByte(ProdData.Text, ProdMask.Text);
            }
            if (ProdRadio_Code.Checked)
            {
                ProdDataGood = CheckCode(ProdData.Text, ProdMask.Text);
            }
            if (ProdRadio_PEiD.Checked)
            {
                ProdDataGood = CheckPEiD(ProdData.Text);
            }
            if (ProdRadio_IDA.Checked)
            {
                ProdDataGood = CheckIDA(ProdData.Text);
            }



            switch (ProdDataGood)
            {
            case (true):
                savesigbutton.Enabled = validsigbox.Checked = true;
                SigToSave             = ConvertPEiD(ID, ProdData.Text, ProdMask.Text);
                SigToComp             = ConvertSig(ID, SigStyle.Byte, ProdData.Text, ProdMask.Text)[0];
                MaskToComp            = ConvertSig(ID, SigStyle.Code, ProdData.Text, ProdMask.Text)[1];

                break;

            case (false):
                savesigbutton.Enabled = validsigbox.Checked = false;
                break;

            case (null):
                savesigbutton.Enabled = validsigbox.Checked = false;

                break;
            }
        }
示例#4
0
文件: Form1.cs 项目: zanzo420/SigTool
        void UIUpdate()
        {
            PreRadio_Code.AutoCheck = PreRadio_IDA.AutoCheck = PreRadio_PEiD.AutoCheck = PreRadio_Byte.AutoCheck = PreCheck_Auto.Enabled;

            SigStyle ID = SigStyle.Error;

            if (PreCheck_Auto.Checked)
            {
                ID = GetAutoID(PreData.Text);
                switch (ID)
                {
                case SigStyle.Byte: PreRadio_Byte.Checked = true; break;

                case SigStyle.Code: PreRadio_Code.Checked = true; break;

                case SigStyle.IDA: PreRadio_IDA.Checked = true; break;

                case SigStyle.PEiD: PreRadio_PEiD.Checked = true; break;

                case SigStyle.Error: PreUnknown.Visible = PreUnknown.Checked = true; break;
                }
            }
            else
            {
                PreUnknown.Visible = PreUnknown.Checked = false;
                if (PreRadio_Byte.Checked)
                {
                    ID = SigStyle.Byte;
                }
                if (PreRadio_Code.Checked)
                {
                    ID = SigStyle.Code;
                }
                if (PreRadio_IDA.Checked)
                {
                    ID = SigStyle.IDA;
                }
                if (PreRadio_PEiD.Checked)
                {
                    ID = SigStyle.PEiD;
                }
            }

            if (ID == SigStyle.Error)
            {
                PreUnknown.Visible = PreUnknown.Checked = true;
            }
            else
            {
                PreUnknown.Visible = false;
            }



            PreMask.Enabled  = !(PreRadio_IDA.Checked || PreRadio_PEiD.Checked);
            PostMask.Enabled = !(PostRadio_IDA.Checked || PostRadio_PEiD.Checked);


            bool?preDataGood = true;

            if (PreRadio_Byte.Checked)
            {
                preDataGood = CheckByte(PreData.Text, PreMask.Text);
            }
            if (PreRadio_Code.Checked)
            {
                preDataGood = CheckCode(PreData.Text, PreMask.Text);
            }
            if (PreRadio_PEiD.Checked)
            {
                preDataGood = CheckPEiD(PreData.Text);
            }
            if (PreRadio_IDA.Checked)
            {
                preDataGood = CheckIDA(PreData.Text);
            }


            SigStyle PostStyle = SigStyle.Byte;

            if (PostRadio_Code.Checked)
            {
                PostStyle = SigStyle.Code;
            }
            if (PostRadio_IDA.Checked)
            {
                PostStyle = SigStyle.IDA;
            }
            if (PostRadio_PEiD.Checked)
            {
                PostStyle = SigStyle.PEiD;
            }



            switch (preDataGood)
            {
            case (true):
                PostData.Enabled = true;
                string[] result = ConvertSig(ID, PostStyle, PreData.Text, PreMask.Text);
                PostData.Text = result[0];
                if (result[1] != "")
                {
                    PostMask.Text    = result[1];
                    PostMask.Enabled = true;
                }
                else
                {
                    PostMask.Enabled = false;
                }
                break;

            case (false):
                PostData.Text    = "Bad Sig";
                PostData.Enabled = false;
                PostMask.Text    = "Bad Sig";
                PostMask.Enabled = false;
                break;

            case (null):
                PostData.Text    = "Good Sig";
                PostData.Enabled = true;
                PostMask.Text    = "Bad Mask";
                PostMask.Enabled = false;
                break;
            }
        }