Form 1 : Nothing special just a welcome form
Form 2 : Top 10 Infected Machines of the day using this :
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connectionString As String = "Data Source=bensrv35;Initial Catalog=ePO4_BENSRV33;Integrated Security=True; "
Dim connectionString As String = "Data Source=bensrv35;Initial Catalog=ePO4_BENSRV33;Integrated Security=True; "
Dim sql As String = "SELECT Top 10 TargetHostName, count(*) AS NumberThreat FROM EPOEvents WHERE (DetectedUTC between CONVERT(datetime,dateadd(dd,-1,getdate()),102) and CONVERT(datetime,getdate(),102)) GROUP BY TargetHostName ORDER BY NumberThreat DESC"
Dim connection As New SqlConnection(connectionString)
Dim dataadapter As New SqlDataAdapter(sql, connection)
Dim ds As New DataSet()
connection.Open()
dataadapter.Fill(ds, "Authors_table")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "Authors_table"
Timer2.Interval = 5000
Timer2.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Hide()
Form3.Show()
End Sub
Form 3 : Top 10 Infected Machines of the week (start using BackgroudWorler but I'm getting an error) :
code :
Imports System.Data
Imports System.Data.SqlClient
Public Class Form3
Public sqlconnection As SqlConnection
Dim connectionString As String = "Data Source=bensrv35;Initial Catalog=ePO4_BENSRV33;Integrated Security=True"
Dim sql1 As String = "SELECT TOP 10 TargetHostName, count(*) AS NumberThreat, SourceHostname FROM EPOEvents WHERE (DetectedUTC between CONVERT(datetime,dateadd(ww,-1,getdate()),102) and CONVERT(datetime,getdate(),102)) GROUP BY TargetHostName, SourceHostName ORDER BY NumberThreat DESC"
Dim ds1 As New DataSet()
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Show()
Me.WindowState = FormWindowState.Maximized
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
If BackgroundWorker1.IsBusy <> True Then
BackgroundWorker1.RunWorkerAsync()
End If
Timer3.Interval = 20000
Timer3.Start()
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Me.Hide()
Form4.Show()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim connection As New SqlConnection(connectionString)
connection.Open()
Dim dataadapter1 As New SqlDataAdapter(sql1, connection)
dataadapter1.Fill(ds1, "Authors_table")
DataGridView1.DataSource = ds1
DataGridView1.DataMember = "Authors_table"
End Sub
End Class
Form 4 : statistical curve
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms.DataVisualization.Charting
Public Class Form4
Public sqlconnection As SqlConnection
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Show()
Me.WindowState = FormWindowState.Maximized
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Dim connectionString As String = "Data Source=bensrv35;" & _
"Initial Catalog=ePO4_BENSRV33;Integrated Security=True"
Dim sql As String = "SELECT ThreatType, Count FROM EPOEvents_ThreatTypesView ORDER BY Count DESC"
Dim connection As New SqlConnection(connectionString)
Dim dataadapter As New SqlDataAdapter(sql, connection)
Dim ds As New DataSet()
connection.Open()
dataadapter.Fill(ds, "Authors_table")
'DataGridView1.DataSource = ds
'DataGridView1.DataMember = "Authors_table"
Dim ChartArea1 As ChartArea = New ChartArea()
Dim Legend1 As Legend = New Legend()
Dim Series1 As Series = New Series()
Dim Chart1 = New Chart()
Me.Controls.Add(Chart1)
ChartArea1.Name = "ChartArea1"
Chart1.ChartAreas.Add(ChartArea1)
Chart1.Size = New System.Drawing.Size(980, 500)
Legend1.Name = "Legend1"
Chart1.Legends.Add(Legend1)
Chart1.Location = New System.Drawing.Point(20, 250)
Chart1.Name = "Chart1"
Chart1.BackColor = Color.WhiteSmoke
Series1.ChartArea = "ChartArea1"
Series1.Legend = "Legend1"
Series1.Name = "ThreatStat"
Chart1.Series.Add(Series1)
Chart1.TabIndex = 0
Chart1.Text = "Chart1"
Chart1.Series("ThreatStat").XValueMember = "ThreatType"
Chart1.Series("ThreatStat").YValueMembers = "Count"
Chart1.Series("ThreatStat").Font = New Font("Arial", 10, FontStyle.Bold)
Chart1.Series("ThreatStat").IsValueShownAsLabel = True
Chart1.Series("ThreatStat").LabelForeColor = Color.Firebrick
Chart1.AlignDataPointsByAxisLabel()
Series1.ChartType = SeriesChartType.Column
Chart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
Chart1.ChartAreas("ChartArea1").Area3DStyle.Rotation = -40
Chart1.ChartAreas("ChartArea1").Area3DStyle.Inclination = 90
Chart1.ChartAreas("ChartArea1").Area3DStyle.PointDepth = 100
Chart1.ChartAreas("ChartArea1").Area3DStyle.PointGapDepth = 0
Chart1.ChartAreas(0).Area3DStyle.WallWidth = 10
Chart1.ChartAreas(0).Area3DStyle.LightStyle = LightStyle.Realistic
ChartArea1.AxisX.LabelStyle.Angle = -90
ChartArea1.AxisX.LabelStyle.Font = New Font("Verdana", 8, FontStyle.Bold)
ChartArea1.AxisY.LabelStyle.Font = New Font("Verdana", 8, FontStyle.Bold)
ChartArea1.AxisX.Interval = 1
Chart1.DataSource = ds.Tables("Authors_table")
Timer4.Interval = 20000
Timer4.Start()
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Me.Hide()
Form1.Show()
End Sub
End Class