Monday, May 7, 2012

LOGGING SYSTEM ACTIVITIES

SYSTEM ACTIVITIES


Today I am Just sharing you a program to see your system activities, the codes are not more difficult and quite easily handle. (codes are using batch program & html)


The one of the primary use of the batch file is logging system activities. Periodic monitoring and logging activities is a part of security auditing. Here we are going to combine both HTML and batch file program to make a GUI and user friendly logging system.


CODE 1 (BATCH PROGRAMMING)

@echo off
echo. > voolanet.txt
echo Log File >> voolanet.txt
echo. >> voolanet.txt
echo User : %username% >> voolanet.txt
Date /t >> voolanet.txt
Time /t >> voolanet.txt
echo. >> voolanet.txt
echo Process Ran by %username% >> voolanet.txt
echo. >> voolanet.txt
qprocess >> voolanet.txt
echo. >> voolanet.txt
echo Network Activities >> voolanet.txt
netstat -s >> voolanet.txt
exit

Step 1

copy the above code in notepad and save as anyname.bat in C drive (System Drive)


In my case I am going to naming it duniya.bat in my C Drive.

Step 2

Run duniya.bat on drive C. As a result Oh! my god I see the text file name voolanet.txt CAN YOU??

NOTE:        The above code snippet will log the system activities such as the user logged in, processes ran by the user, and the network activities such as the number of bytes received and sent, then redirect it to a text file named ‘voolanet.txt’, it’s always better to open a log file in a html file, which is user friendly and GUI, hence the following HTML code will embed the ‘voolanet.txt’ into it.

CODE 2 (HTML CODE)

<html>
<title>COMPUTER DUNIYA</title>
<head><marquee>WELCOME TO COMPUTER DUNIYA's LOG FILE !</marquee></head>
<body>
<br>
<center><h1><u> Log File </u></h1>
<i>This Log file is created by <b>voolanet.blogspot.com</b> for monitoring System Activities !</i>
</center>
<br>
<ul>
<a href="c:\voolanet.txt">Click here to view the Log File</a>
</ul>
</body>
</html>

Step 3

Copy and paste the above html program in a notepad file and save it with the .html or .htm extension on the same location where you have already save the ‘voolanet.txt’ file.


Step 4

Now open up this html file using any of the available web browsers such as Internet Explorer, Mozilla Firefox, Safari or Chrome, then you might see a page like this,


When you click on the above link that says ‘Click here to view the Log File’, then it will display you the logs such as the user logged in, exact date and time when the user logged in, processes ran by the user, and the network activities such as the number of bytes sent and received, here I have enclosed the screenshot of the same log what I have mentioned in this post,






So this is the log generated in my system after executing the batch that I have created, likewise you too can customize or mess with the batch program given above as per your wish and need.