Exemple #1
0
        public bool Object_builder(string path_to_file)
        {
            CheckFile  chck_file  = new CheckFile(path_to_file);
            ScanObject scanObject = new ScanObject();

            if (chck_file.IsFilePE())
            {
                return(scanObject.Read(1, path_to_file));
            }
            else
            {
                if (chck_file.IsFileZip())
                {
                    return(scanObject.Read(2, path_to_file));
                }
                else
                {
                    if (chck_file.IsFileDir())
                    {
                        return(scanObject.Read(3, path_to_file));
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Exemple #2
0
        public ScanReport StartScanObject(ScanObject obj)
        {
            if (obj.ScanRegions == null)
            {
                ulong      i   = 0;
                ScanReport rep = new ScanReport();
                foreach (var chobj in obj.ChildObjects)
                {
                    for (i = 0; i < chobj.SizeObject(); i++)
                    {
                        byte[] prefix = new byte[8];
                        prefix = chobj.Read(i);

                        List <ThreadSignature> signatures = tree.CheckSignature(prefix);
                        if (signatures != null)
                        {
                            foreach (var sig in signatures)
                            {
                                if (sig.SignatureFirstByteMinOffset < i && sig.SignatureFirstByteMaxOffset > i)
                                {
                                    uint   dataLength = sig.Signature.DataLength;
                                    byte[] searchSign = new byte[dataLength];
                                    searchSign = chobj.Read(i);
                                    if (sig.Signature.IsMatch(searchSign))
                                    {
                                        rep.AddRecord(new ScanReport(new string(sig.ThreadName), obj.Path + chobj.Name));
                                    }
                                }
                            }
                        }
                    }
                }
                rep.scannedObjects = i;
                return(rep);
            }
            else
            {
                for (ulong i = 0; i < obj.SizeObject(); i++)
                {
                    byte[] prefix = new byte[8];
                    prefix = obj.Read(i);

                    List <ThreadSignature> signatures = tree.CheckSignature(prefix);
                    if (signatures != null)
                    {
                        foreach (var sig in signatures)
                        {
                            if (sig.SignatureFirstByteMinOffset < i && sig.SignatureFirstByteMaxOffset > i)
                            {
                                uint   dataLength = sig.Signature.DataLength;
                                byte[] searchSign = new byte[dataLength];
                                searchSign = obj.Read(i);
                                if (sig.Signature.IsMatch(searchSign))
                                {
                                    return(new ScanReport(new string(sig.ThreadName), obj.Path));
                                }
                            }
                        }
                    }
                }
            }
            return(null);
        }