Analysis and Evaluation of the Windows Event Log - Bill Buchanan
Analysis and Evaluation of the Windows Event Log - Bill Buchanan
Analysis and Evaluation of the Windows Event Log - Bill Buchanan
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
C:\Documents <strong>and</strong> Settings\Barrie\My ...\Projects\<strong>Event</strong> Viewer\<strong>Event</strong> Viewer\Form1.cs<br />
Length)));<br />
2<br />
string myString11 = "";<br />
string myString12 = "";<br />
hmacLbl.Text = string1.Substring((string1.IndexOf(myString11) + myString11.<br />
Length), (string1.IndexOf(myString12) - (string1.IndexOf(myString11) + myString11.<br />
Length)));<br />
hmacChecker();<br />
}<br />
catch<br />
{<br />
MessageBox.Show("No <strong>Event</strong>s Available to Display!","Error");<br />
}<br />
}<br />
private void hmacChecker()<br />
{<br />
string string1 = Convert.ToString(lines[arrayItem]);<br />
string myString1 = "";<br />
string myString2 = "";<br />
string chkMessage = string1.Substring(string1.IndexOf(myString1), ((string1.<br />
IndexOf(myString2) + myString2.Length)- string1.IndexOf(myString1)));<br />
msgTxt.Text = chkMessage;<br />
}<br />
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();<br />
byte[] keyByte = encoding.GetBytes(hmacTxt.Text);<br />
HMACSHA1 hmac = new HMACSHA1(keyByte);<br />
byte[] messageBytes = encoding.GetBytes(chkMessage);<br />
byte[] hashmessage = hmac.ComputeHash(messageBytes);<br />
hmacCheckLbl.Text = ByteToString(hashmessage);<br />
if (hmacCheckLbl.Text == hmacLbl.Text)<br />
hmacCheckLbl.Text += " : Hmac Passed!";<br />
else<br />
hmacCheckLbl.Text += " : Hmac Failed!";<br />
public static string ByteToString(byte[] buff)<br />
{<br />
string sbinary = "";<br />
for (int i = 0; i < buff.Length; i++)<br />
{<br />
sbinary += buff[i].ToString("X2"); // hex format<br />
}<br />
return (sbinary);<br />
}<br />
private void nextBtn_Click(object sender, <strong>Event</strong>Args e)<br />
{<br />
arrayItem++;<br />
if (arrayItem > lines.Count - 1)<br />
arrayItem = 0;<br />
LoadRecord();<br />
}<br />
private void prevBtn_Click(object sender, <strong>Event</strong>Args e)<br />
{<br />
arrayItem--;<br />
if (arrayItem < 0)<br />
arrayItem = lines.Count - 1;<br />
LoadRecord();<br />
}<br />
}<br />
}