Beispiel #1
0
        public List <MethodGraph> AnalyzeSolution(string companyAssembliesPattern, string applicationsPattern, string solutionFolder)
        {
            try
            {
                _logOutput.LogInfo(" ");
                _logOutput.LogInfo("================================================");
                _logOutput.LogInfo("SOLUTION ANALISIS STARTED: " + solutionFolder);

                var solution = GetSolution(solutionFolder, applicationsPattern);
                if (!solution.Applications.Any())
                {
                    _logOutput.LogInfo("No applications found in solution. Process aborted.");
                    return(new List <MethodGraph>());
                }

                AnalysisScope.CurrentSolutionPath = solutionFolder;
                AnalysisScope.CurrentSolutionName = solution.Name;

                var methodGraphs = new List <MethodGraph>();
                foreach (var application in solution.Applications)
                {
                    var methodGraphsOfApp = AnalyzeApplication(companyAssembliesPattern, application);
                    methodGraphs.AddRange(methodGraphsOfApp);
                }

                return(methodGraphs);
            }
            catch (Exception ex)
            {
                _logOutput.LogError("Failed to process solution " + ex);
                return(new List <MethodGraph>());
            }
        }
Beispiel #2
0
        public AnalysisPhaseResult LoadApplication(string companyAssembliesPattern, ApplicationDetails application)
        {
            try
            {
                var assembliesFolder = AssemblyPathFinder.GetAssembliesFolder(application.FullFolderPath);
                if (assembliesFolder == null)
                {
                    return(AnalysisPhaseResult.CouldNotFindBinFolder);
                }

                var companyAssembliesInFolder = AssemblyPathFinder.GetCompanyAssemblies(companyAssembliesPattern, assembliesFolder);
                if (!companyAssembliesInFolder.Any())
                {
                    return(AnalysisPhaseResult.NoCompanyDllsFound);
                }

                AnalysisScope.ApplicationAssemblies = companyAssembliesInFolder;

                EmptyIndexes();
                foreach (var companyAssembly in companyAssembliesInFolder)
                {
                    var module = DecompilerService.GetModuleDefinition(assembliesFolder, companyAssembly);
                    _modulesToAnalyze.Add(module);
                }

                foreach (var module in _modulesToAnalyze)
                {
                    if (!_assembliesProcessed.Contains(module.Assembly.FullName))
                    {
                        _assembliesProcessed.Add(module.Assembly.FullName);

                        _assignmentGraphIndexer.IndexTriples(module);
                        _methodIndexer.Load(module);
                    }
                }

                _delegateIndexer.Load(_modulesToAnalyze);
                _methodIndexer.BuildMethodObjects(application.CsProjName);
                _typeService.Load(_modulesToAnalyze);

                return(AnalysisPhaseResult.Success);
            }
            catch (Exception ex)
            {
                _logOutput.LogError("Failed analyzing application. ", ex);
                return(AnalysisPhaseResult.Failed);
            }
        }
Beispiel #3
0
        void AcceptTcpClient(IAsyncResult iar)
        {
            var tcs = (TcpListener)iar.AsyncState;

            TcpClient tc = null;

            try
            {
                tc = tcs.EndAcceptTcpClient(iar);
            }
            catch (Exception ex)
            {
                if (_serverComms.IsVerboseOn())
                {
                    _serverComms.LogError($"Initial SOCKS Read failed for endpoint {tcs.LocalEndpoint.ToString()} {ex.Message}".Trim());
                }
                return;
            }
            Task.Factory.StartNew(() =>
            {
                try
                {
                    if (ServerComms.IsVerboseOn())
                    {
                        ServerComms.LogMessage($"Message arrived {tcs.LocalEndpoint.ToString()} from {tc.Client.RemoteEndPoint.ToString()}".Trim());
                    }
                    (new SocksProxy()
                    {
                        TOTALSOCKETTIMEOUT = SocketTimeout
                    }).ProcessRequest(tc, WaitOnConnect);
                }
                catch (Exception ex)
                {
                    ServerComms.LogError($"Error occured on EndPoint {tcs.LocalEndpoint.ToString()} shutting down cause of {ex.Message}".Trim());
                    if (tc.Connected)
                    {
                        tc.Close();
                    }
                    return;
                }
            });

            tcs.BeginAcceptTcpClient(AcceptTcpClient, tcs);
        }