Example #1
0
        //private void sendDashboard()
        //{
        //    foreach(string file in scanner.infected_files)
        //    {
        //        Program.dashboard.MatchedFile(file, scanner.matched_pattern);
        //    }
        //}

        private void sendSlackClean()
        {
            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["slack_enabled"]))
            {
                return;                                                                        // slack not enabled
            }
            Slack.Attachment a = new Slack.Attachment()
            {
                Title    = "MSB Virus Scanner Results",
                Color    = "good",
                ThumbUrl = "https://cdn3.iconfinder.com/data/icons/flat-actions-icons-9/792/Tick_Mark_Dark-512.png"
            };

            a.AddField("Computer", Environment.MachineName);
            a.AddField("Status", "All Clear");

            Slack.Payload p = new Slack.Payload()
            {
                Text = (Program.debug == 1) ? "TEST -- MSB Clean Computer Found" : "MSB Clean Computer Found",
            };

            p.Attach(a);

            slack.PostMessage(p);
        }
Example #2
0
        private void sendSlack()
        {
            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["slack_enabled"]))
            {
                return;                                                                        // slack not enabled
            }
            //if (slack_frozen) return; // wait until slack is allowed again;
            bool all_clean  = !Program.findings.Get().Any(o => !o.cleaned);
            bool some_clean = Program.findings.Get().Any(o => o.cleaned);

            string color = "danger";

            if (some_clean)
            {
                color = "warning";
            }
            if (all_clean)
            {
                color = "good";
            }

            Program.log.Write("Sending Slack Message");

            Slack.Attachment a = new Slack.Attachment()
            {
                Title = "MSB Virus Scanner Results",
                Color = color
            };

            a.AddField("Computer", Environment.MachineName);
            a.AddField("User", Environment.UserName);
            a.AddField("IP", Program.GetLocalIPAddress());
            //a.AddField("Pattern", scanner.matched_pattern);
            a.AddField("Findings", Program.findings.GetFormatted(), false);
            a.AddField("Clean Findings", Program.should_clean.ToString());
            a.AddField("Reboot After", Program.should_reboot.ToString());

            Slack.Payload p = new Slack.Payload()
            {
                Text = (Program.debug == 1) ? "TEST -- MSB Infection Found" : "MSB Infection Found"
            };

            p.Attach(a);

            slack.PostMessage(p);

            //freezeSlack();
        }