예제 #1
0
 public HashBruteforcer(HashSet <string> hashes, int threadCount, BruteforceState state, IResultLog log)
 {
     _threads = new Thread[threadCount];
     _state   = state;
     _hashes  = hashes;
     _log     = log;
     for (int i = 0; i < _threads.Length; i++)
     {
         _threads[i] = new Thread(BruteForceThread);
         _threads[i].Start(i);
     }
 }
예제 #2
0
 public CleanupTools(ITimeProvider timeProvider, IResultLog log)
 {
     _timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));
     _log          = log ?? throw new ArgumentNullException(nameof(log));
 }
예제 #3
0
        public static void Compare(IResultLog Log, Assembly source, Assembly target)
        {
            var queryTM1 = GetTypesAndProperties(source);
            var queryTM2 = GetTypesAndProperties(target);

            var queryTMPossibleAdded =
            from tm1 in queryTM1
            select new TypeAndPropertyPair
            {
                First = tm1,
                Second = QueryRelatedTM(queryTM2, tm1)
            };

            var queryTMPossibleDeleted =
            from tm2 in queryTM2
            select new TypeAndPropertyPair
            {
                First = QueryRelatedTM(queryTM1, tm2),
                Second = tm2
            };

            var queryTMS =
            from pair in queryTMPossibleAdded.Union(queryTMPossibleDeleted).Distinct() select pair;

            var queryTMSNull =
                from pair in queryTMS
                where
                    pair.First.IsNull()
                    ||
                    pair.Second.IsNull()
                select
                    pair;

            var queryTMSNonNull =
            from pair in queryTMS
            where
                pair.First.NotNull()
                &&
                pair.Second.NotNull()
            select
                pair;

            var queryDifferentBody =
                queryTMSNonNull
                .Where(pair =>
                    {
                        if (pair.First.Property.CanRead != pair.Second.Property.CanRead)
                        {
                            // one can read while other cannot
                            return true;
                        }

                        if (pair.First.Property.CanWrite != pair.Second.Property.CanWrite)
                        {
                            // one can write while other cannot
                            return true;
                        }

                        if (pair.First.Property.DifferentScope(pair.Second.Property))
                        {
                            return true;
                        }

                        if (pair.First.Property.CanRead)
                        {
                            var m1info = pair.First.Property.GetGetMethod();
                            var m2info = pair.Second.Property.GetGetMethod();

                            if (CompareMethodsDifferent(m1info, m2info))
                            {
                                return true;
                            }
                        }

                        if (pair.First.Property.CanWrite)
                        {
                            var m1info = pair.First.Property.GetSetMethod();
                            var m2info = pair.Second.Property.GetSetMethod();

                            if (CompareMethodsDifferent(m1info, m2info))
                            {
                                return true;
                            }
                        }

                        return false;
                    });

            // Outputs

            Log.Context = "Properties";

            if (queryTMSNull.Count() > 0)
            {
                Log.WriteLine("Added or Deleted: {0}", queryTMSNull.Count());
                foreach (var pair in queryTMSNull)
                {
                    if (pair.First.IsNull())
                    {
                        Log.WriteLine("Added {0}", pair.Second);
                    }
                    if (pair.Second.IsNull())
                    {
                        Log.WriteLine("Deleted {0}", pair.First);
                    }
                }
            }

            if (queryDifferentBody.Count() > 0)
            {
                Log.WriteLine("Different: {0}", queryDifferentBody.Count());
                foreach (var pair in queryDifferentBody)
                {
                    Log.WriteLine("{0}", pair.First);
                }
            }
            //Console.WriteLine("Total NonNull: {0}", queryTMSNonNull.Count());
        }
        public static void Compare(IResultLog Log, Assembly source, Assembly target)
        {
            var queryTM1 = GetTypesAndMethods(source);
            var queryTM2 = GetTypesAndMethods(target);

            var queryTMPossibleAdded =
                from tm1 in queryTM1
                select new TypeAndMethodPair
            {
                First  = tm1,
                Second = QueryRelatedTM(queryTM2, tm1)
            };

            var queryTMPossibleDeleted =
                from tm2 in queryTM2
                select new TypeAndMethodPair
            {
                First  = QueryRelatedTM(queryTM1, tm2),
                Second = tm2
            };

            var queryTMS =
                from pair in queryTMPossibleAdded.Union(queryTMPossibleDeleted).Distinct() select pair;

            var queryTMSNull =
                from pair in queryTMS
                where
                pair.First.IsNull()
                ||
                pair.Second.IsNull()
                select
                pair;

            var queryTMSNonNull =
                from pair in queryTMS
                where
                pair.First.NotNull()
                &&
                pair.Second.NotNull()
                select
                pair;

            var queryDifferentBody =
                queryTMSNonNull
                .Where(pair =>
            {
                var m1info = pair.First.Method;
                var m2info = pair.Second.Method;

                if (m1info.DifferentScope(m2info))
                {
                    return(true);
                }

                return(CompareMethodsDifferent(m1info, m2info));
            });

            // Outputs

            Log.Context = "Methods";

            if (queryTMSNull.Count() > 0)
            {
                Log.WriteLine("Added or Deleted: {0}", queryTMSNull.Count());
                foreach (var pair in queryTMSNull)
                {
                    if (pair.First.IsNull())
                    {
                        Log.WriteLine("Added {0}", pair.Second);
                    }
                    if (pair.Second.IsNull())
                    {
                        Log.WriteLine("Deleted {0}", pair.First);
                    }
                }
            }

            if (queryDifferentBody.Count() > 0)
            {
                Log.WriteLine("Different: {0}", queryDifferentBody.Count());
                foreach (var pair in queryDifferentBody)
                {
                    Log.WriteLine("{0}", pair.First);
                }
            }
            //Log.WriteLine("Total NonNull: {0}", queryTMSNonNull.Count());
        }
예제 #5
0
        public static void Compare(IResultLog Log, Assembly source, Assembly target)
        {
            var queryTM1 = GetTypesAndProperties(source);
            var queryTM2 = GetTypesAndProperties(target);

            var queryTMPossibleAdded =
                from tm1 in queryTM1
                select new TypeAndPropertyPair
            {
                First  = tm1,
                Second = QueryRelatedTM(queryTM2, tm1)
            };

            var queryTMPossibleDeleted =
                from tm2 in queryTM2
                select new TypeAndPropertyPair
            {
                First  = QueryRelatedTM(queryTM1, tm2),
                Second = tm2
            };

            var queryTMS =
                from pair in queryTMPossibleAdded.Union(queryTMPossibleDeleted).Distinct() select pair;

            var queryTMSNull =
                from pair in queryTMS
                where
                pair.First.IsNull()
                ||
                pair.Second.IsNull()
                select
                pair;

            var queryTMSNonNull =
                from pair in queryTMS
                where
                pair.First.NotNull()
                &&
                pair.Second.NotNull()
                select
                pair;

            var queryDifferentBody =
                queryTMSNonNull
                .Where(pair =>
            {
                if (pair.First.Property.CanRead != pair.Second.Property.CanRead)
                {
                    // one can read while other cannot
                    return(true);
                }

                if (pair.First.Property.CanWrite != pair.Second.Property.CanWrite)
                {
                    // one can write while other cannot
                    return(true);
                }

                if (pair.First.Property.DifferentScope(pair.Second.Property))
                {
                    return(true);
                }

                if (pair.First.Property.CanRead)
                {
                    var m1info = pair.First.Property.GetGetMethod();
                    var m2info = pair.Second.Property.GetGetMethod();

                    if (CompareMethodsDifferent(m1info, m2info))
                    {
                        return(true);
                    }
                }

                if (pair.First.Property.CanWrite)
                {
                    var m1info = pair.First.Property.GetSetMethod();
                    var m2info = pair.Second.Property.GetSetMethod();

                    if (CompareMethodsDifferent(m1info, m2info))
                    {
                        return(true);
                    }
                }

                return(false);
            });

            // Outputs

            Log.Context = "Properties";

            if (queryTMSNull.Count() > 0)
            {
                Log.WriteLine("Added or Deleted: {0}", queryTMSNull.Count());
                foreach (var pair in queryTMSNull)
                {
                    if (pair.First.IsNull())
                    {
                        Log.WriteLine("Added {0}", pair.Second);
                    }
                    if (pair.Second.IsNull())
                    {
                        Log.WriteLine("Deleted {0}", pair.First);
                    }
                }
            }

            if (queryDifferentBody.Count() > 0)
            {
                Log.WriteLine("Different: {0}", queryDifferentBody.Count());
                foreach (var pair in queryDifferentBody)
                {
                    Log.WriteLine("{0}", pair.First);
                }
            }
            //Console.WriteLine("Total NonNull: {0}", queryTMSNonNull.Count());
        }
예제 #6
0
        public static void Compare(IResultLog Log, Assembly source, Assembly target)
        {
            var queryTM1 = GetTypesAndMethods(source);
            var queryTM2 = GetTypesAndMethods(target);

            var queryTMPossibleAdded =
            from tm1 in queryTM1
            select new TypeAndMethodPair
            {
                First = tm1,
                Second = QueryRelatedTM(queryTM2, tm1)
            };

            var queryTMPossibleDeleted =
            from tm2 in queryTM2
            select new TypeAndMethodPair
            {
                First = QueryRelatedTM(queryTM1, tm2),
                Second = tm2
            };

            var queryTMS =
            from pair in queryTMPossibleAdded.Union(queryTMPossibleDeleted).Distinct() select pair;

            var queryTMSNull =
                from pair in queryTMS
                where
                    pair.First.IsNull()
                    ||
                    pair.Second.IsNull()
                select
                    pair;

            var queryTMSNonNull =
            from pair in queryTMS
            where
                pair.First.NotNull()
                &&
                pair.Second.NotNull()
            select
                pair;

            var queryDifferentBody =
                queryTMSNonNull
                .Where(pair =>
                    {
                        var m1info = pair.First.Method;
                        var m2info = pair.Second.Method;

                        if (m1info.DifferentScope(m2info))
                        {
                            return true;
                        }

                        return CompareMethodsDifferent(m1info, m2info);
                    });

            // Outputs

            Log.Context = "Methods";

            if (queryTMSNull.Count() > 0)
            {
                Log.WriteLine("Added or Deleted: {0}", queryTMSNull.Count());
                foreach (var pair in queryTMSNull)
                {
                    if (pair.First.IsNull())
                    {
                        Log.WriteLine("Added {0}", pair.Second);
                    }
                    if (pair.Second.IsNull())
                    {
                        Log.WriteLine("Deleted {0}", pair.First);
                    }
                }
            }

            if (queryDifferentBody.Count() > 0)
            {
                Log.WriteLine("Different: {0}", queryDifferentBody.Count());
                foreach (var pair in queryDifferentBody)
                {
                    Log.WriteLine("{0}", pair.First);
                }
            }
            //Log.WriteLine("Total NonNull: {0}", queryTMSNonNull.Count());
        }
예제 #7
0
 public ResultEvaluation(Sourcecode csSource, IResultLog log)
 {
     _csSource = csSource;
     _log      = log;
 }
예제 #8
0
 public App(Filesystem fs, IResultLog resultLog, CLI.Command cmd)
 {
     _fs        = fs;
     _resultLog = resultLog;
     _cmd       = cmd;
 }