sic report

57
A Project Report On S S E E R R V V E E R R I I N N F F O O R R M M A A T T I I O O N N A A N N D D C C O O N N T T R R O O L L Submitted by DURGE AKHIL A. B-8058544 GAWADE YUVRAJ M. B-8058549 JAISWAL PRITI Z. B-8058556 SHENDE POONAM S. B-8058620 Guidance By Internal Guide: Prof. J. B. Jagdale External Guide: Mr. Prerak Shah Mr. Bhavin Patel Sponsored By: Zensar Technologies. Department of Information Technology

Upload: vicky752

Post on 30-Dec-2015

20 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SIC Report

A

Project Report

On

SSEERRVVEERR IINNFFOORRMMAATTIIOONN AANNDD CCOONNTTRROOLL

Submitted by

DURGE AKHIL A. B-8058544

GAWADE YUVRAJ M. B-8058549

JAISWAL PRITI Z. B-8058556

SHENDE POONAM S. B-8058620

Guidance By

Internal Guide: Prof. J. B. Jagdale

External Guide:

Mr. Prerak Shah

Mr. Bhavin Patel

Sponsored By: Zensar Technologies.

Department of Information Technology

Page 2: SIC Report

Server Information And Control

Page 2 of 57

APRIL 2012

CERTIFICATE

This is to certify that the project report entitled

“SERVER INFORMATION AND CONTROL”

Submitted by

DURGE AKHIL A. B-8058544

GAWADE YUVRAJ M. B-8058549

JAISWAL PRITI Z. B-8058556

SHENDE POONAM S. B-8058620

is a bonafide work carried out by them under the supervision of Prof. J. B. Jagadale and it is

approved for the partial fulfillment of the requirement of University of Pune, Pune for the award

of the degree of Bachelor of Engineering (Information Technology).

This project work has not been earlier submitted to any other Institute or University for the

award of any degree or diploma.

Prof. J. B. Jagadale Prof. Emmanuel Dr. P.T.Kulkarni

Internal Guide,

Dept. of Information Technology,

PICT, Pune.

HOD,

Dept. of Information

Technology,

PICT, Pune.

Principal

PICT, Pune.

Place: Pune

Date:

Page 3: SIC Report

Server Information And Control

Page 3 of 57

ACKNOWLEDGEMENTS

Undertaking a project in the final year of bachelor’s degree in Engineering is a

mountainous task in itself, and it require able assistance along the way to make it successful,

interesting, motivating, learning, professional and above all easy! In this we have been blessed

with many people who have served as light and mentored us towards a successful realization of

this project. It is with utmost humility and gratitude that we take this opportunity to recognize

every one for your invaluable inputs. We address you all to express our heartfelt greetings.

We express our sincere gratitude towards the Head of our IT Department, Prof. Emmanuel for

his invaluable support.

We received zestful guidance from our project guide Prof. J. B. Jagadale who provided us with

new ideas throughout the project. We honor his consistent inputs and able guidance that has extensively

served towards the completion of the task.

We express our sincere gratitude to our project coordinator Prof. Manish Khodaskar. We

acknowledge his valuable criticism as well as timely appreciations. It has been a truly humbling

experience to work under him.

We would also like to express our sincere gratitude to Mr. Prerak Shah, and Mr. Bhavin Patel

ZenSar Technologies for their idea and invaluable guidance throughout the project. This project wouldn’t

have been possible without our regular meetings held with them and their consistent efforts extended

towards completion of the project.

We sincerely thank all of the above for making this a very enriching experience.

Akhil Durge

Yuvraj Gawade

Priti Jaiswal

Poonam Shende

Page 4: SIC Report

Server Information And Control

Page 4 of 57

ABSTRACT

Companies have a huge number of servers spread across the Local Area Network. Multiple

business applications/services are running on these servers. To manage and monitor server

applications is a very difficult job. Some of the basic applications which need to be accessed by

remote terminals are accessing windows services, event logs, MSMQ (Microsoft Message

Queuing). Event viewer keeps logs of all the events regarding the applications running on a

machine. The events can be of any type such as application, security, setup, system etc. Using

these event logs the developer/tester can understand what data is being transferred by the

application and what errors or exceptions occurred in the application and can troubleshoot the

problem if any. Windows services help the upper level applications to acquire the available

resources and execute the operations needed to perform by these applications. These are

basically the daemon processes as in UNIX running in the background without user knowing it.

MSMQ is an asynchronous message transferring technique which is used to pass the textual data

between the applications running on different machines. This technology is very useful on

Business level where many applications pass data to each other to carry out a particular task. All

these technologies are available individually on the localhost only. There is no such application

which provides all these functionalities under one hood that too remotely. Hence we have built a

web application which can be accessible remotely over the intranet using which the employee

can view event log, start/stop windows services and can view/send messages to the MSMQ. The

application will be useful to the developers and testers who are working in the company.

Page 5: SIC Report

Server Information And Control

Page 5 of 57

Table of Contents

1. Introduction ................................................................................................. 8

1.1. Overview ....................................................... Error! Bookmark not defined.

1.2. Objective ....................................................................................................... 9

1.3. Basic Concepts............................................................................................... 9

1.4 Organization of basic report………………………………………………….13

2. Background Research ............................................................................. 275

2.1. Motivation ................................................................................................. 166

2.2. Existing work ............................................................................................ 166

3. Project Definition .................................................................................. 2719

3.1. Project Statement ....................................................................................... 200

3.2. Scope ........................................................................................................ 200

3.3. Assumptions and Constraints ..................................................................... 200

4. Requirements Specification ....................................................................... 21

4.1. Functionality Requirements ....................................................................... 222

4.2. External Interface Requirements ................................................................ 222

4.2.1. User Interface ............................................................................................ 223

4.2.2. Software interface........................................................................................ 27

4.3. Hardware and Software Requirements ......................................................... 27

5. Design ......................................................................................................... 28

5.1. Overview ..................................................................................................... 29

5.2. Use-case ...................................................................................................... 29

5.3. Events and actions ....................................................................................... 30

5.4. DFD diagrams ............................................................................................. 32

5.5. Class diagrams ............................................................................................ 33

5.6. Low Level Design ....................................................................................... 33

Page 6: SIC Report

Server Information And Control

Page 6 of 57

6. Implementation.......................................................................................... 35

6.1. Module 1 ..................................................................................................... 36

6.2. Module 2 ..................................................................................................... 38

6.3. Module 3 ..................................................................................................... 39

7. Testing ........................................................................................................ 42

7.1. Overview ..................................................................................................... 43

7.2 Test plan……… .......................................................................................... 44

7.3 Risk Analysis……….……………………………………….…………….…50

8. Conclusion .................................................................................................. 52

a. Future enhancements .................................................................................... 53

9. Glossary. ..................................................................................................... 54

10. References .................................................................................................. 56

Page 7: SIC Report

Server Information And Control

Page 7 of 57

List of Diagrams

1.3.1 Modules in SIC 9

1.3.1.1 MSMQ 10

1.3.2.1 Event Viewer 11

1.3.3.1 Windows services 12

4.2.1.1 Event Log Page 24

4.2.1.2 Windows Services Page 24

4.2.1.3 MSMQ Search Page 25

4.2.1.4 MSMQ Send Page 26

4.2.1.5 Administrator Page 26

5.2.1 Use Case 29

5.4.1 DFD – Level 2 32

5.5.1 Class Diagram 32

5.6.1 Activity Diagram 33

7.2.2.1 Testing strategy 44

List of Tables

7.2 Test Cases 50

Page 8: SIC Report

Server Information And Control

Page 8 of 57

CHAPTER 1:

INTRODUCTION

Page 9: SIC Report

Server Information And Control

Page 9 of 57

1.1 Overview

There are many systems available for getting information about remote servers. These

systems give the information about event logs and windows services. But there are different

systems for these purposes i.e. one system gives information about event log and another system

gives information about windows services and MSMQ. There is no integrated system for all

these services, so we come up with a solution named ―Server Information and Control‖ system

which will integrate all of these functionalities.

1.2. Objective

To provide a simple web page to control all the functionalities at one go.

To start/stop windows services from remote machine.

To view event logs from remote machine and check the information/exception

regarding that event.

1.3. Basic concepts

User Authentication

and Authorization

MSMQ

Windows Services

Event ViewerSIC

Fig. 1.3.1 Modules in SIC

Page 10: SIC Report

Server Information And Control

Page 10 of 57

1.3.1 MSMQ:

Fig 1.3.1.1 MSMQ

The Microsoft Message Queuing (MSMQ) technology enables applications running at

different times to communicate across heterogeneous networks and systems that may be

temporarily offline. Applications send messages to the queues and read messages from the

queues. MSMQ provides guaranteed message delivery, efficient routing, security, and priority-

based messaging. You don't have to think about the details, and the system architecture takes

care of the queuing processes even if the client and server are not running at the same time. It can

be used to implement solutions for both asynchronous and synchronous messaging scenarios.

MSMQ allows applications to use components that communicate with one another using queued

messages. The Server Information and Control system is designed to provide various features

such as display Event logs and windows services, start/stop windows services, Dynamic UI.

Event Viewer allows to view event logs from different servers. Windows services running on

different servers are displayed and can be started/stopped.

Page 11: SIC Report

Server Information And Control

Page 11 of 57

1.3.2 Event Viewer:

This is how an event viewer looks on windows 7.

Fig. 1.3.2.1 Event viewer

A component of Microsoft's Windows NT line of operating systems, lets administrators

and users view the event logs on a local or remote machine. Applications and operating system

components can make use of this centralized log service to report events that have taken place,

such as a failure to start a component or complete an action. The system defines three log

sources: System, Application and Security. The Event Viewer uses event IDs to define the

uniquely identifiable events that a Windows computer can encounter. For example, when a

user's authentication fails, the system may generate Event ID 672.

Page 12: SIC Report

Server Information And Control

Page 12 of 57

1.3.3 Windows Services:

This is how a windows services window looks on windows 7.

Fig. 1.3.3.1 Windows Services

On Microsoft Windows operating systems, a Windows service is a long-running

executable that performs specific functions and which is designed not to require user

intervention. Windows services can be configured to start when the operating system

is booted and run in the background as long as Windows is running, or they can be started

manually when required. They are similar in concept to a Unix daemon. Many appear in the

processes list in the Windows Task Manager, most often with a username of SYSTEM, LOCAL

SERVICE or NETWORK SERVICE, though not all processes with the SYSTEM username are

services. The remaining services run through svchost.exe as DLLs loaded into memory.

Page 13: SIC Report

Server Information And Control

Page 13 of 57

1.3.4 Server Information and Control System:

This is the system which we are developing to combine all the above mentioned features.

UI is designed in such a way that event logs, windows services, MSMQs available on particular

servers related to a particular domain are shown only. Administrator has all the rights of the

system and he/she can grant more rights to any user if requested. The system maintains different

domains. Users in different domains are having their own rights domain-wise. The new feature

of the system is it displays windows services, event logs, MSMQ services of different servers

under single webpage at one go.

1.4. Organization of Project Report

1.4.1. Purpose

This project report is provided to give the brief idea about the application we have

developed. The report contains the overview of project, the idea behind the project, various tools

and technologies used.

This report communicates the information which has been compiled as a result of

implementation and analysis of data and of issues. It provides some sort of technical information

about project.

1.4.2. Scope

The audience who is going to be using this document is banking employees so the scope

of this project report includes the some sort of technical information which will help the user

about uses of application. And it will communicate with users about technical information. It

includes the basic block diagram and some UML diagrams which gives basic idea about

application. This report includes the following topics:

Introduction of concepts used

Background Research

Page 14: SIC Report

Server Information And Control

Page 14 of 57

Project Definition

Requirement Specification

Design

Implementation

Testing methods used

Conclusion

Future Enhancement

Glossary

References

Page 15: SIC Report

Server Information And Control

Page 15 of 57

CHAPTER 2:

BACKGROUND RESEARCH

Page 16: SIC Report

Server Information And Control

Page 16 of 57

2.1. Motivation

In many organizations, many employees are working on one project from different

locations. For example employees from Pune and Mumbai are working on the same project. And

that project is present on a server and the location of that server may be Pune or Mumbai. If the

server on which the project is present is located in Pune and an employee from Mumbai wants to

view the Event logs and also wants to start/stop windows services of that server for their project.

He might use some remote login method, or tell other employee on the remote machine to do the

operations. Our application ‗SIC‘ provides interface to the employee, using which the employee

can do the operations sitting on his chair from his own PC. SIC allows user to view event logs

and start/stop windows services present on the remote machine. All user has to do is enter his

valid credentials. SIC also provides asynchronous message transferring for communication

between the applications present on the machines under a single domain server.

2.2. Existing work

2.2.1 Remote Desktop Connection (RDC)

Remote desktop connection is an existing windows service. Using this we can access any

remote desktop. The windows remote desktop client can be found in

%systemroot%/system32%/mstsc.exe. Running this command with no extensions will bring up

the remote desktop connection program. However, mstsc.exe has a full set of switches that can

be used to accomplish things from the command prompt.

If employee wants to view the event logs and windows services of one of the server then

he/she can use remote desktop connection. But the problem is that not all the employees can get

the rights to login on that server and view the event logs or start/stop windows services of that

server. To start/stop windows services of server, employees need some rights and not all the user

can get that. So, accessing windows services and MSMQ is not possible with remote desktop

connection.

Page 17: SIC Report

Server Information And Control

Page 17 of 57

Also if the employee needs to access many servers for their project, he/she needs to login

into those servers using multiple Remote Desktop Connections. Hence the employee has to open

multiple RDC windows. And this is not a perfect solution.

It will slow down the system performance and employee gets frustrated.

Advantages:

Remote handling of applications.

Easy to connect to remote pc.

Disadvantages:

Permission required.

User gets the full access.

Performance degradation in slow connections.

2.2.2 Team Viewer

TeamViewer is a simple and fast solution for remote control, desktop sharing and file.

Connecting to another computer can‘t be simpler, just run TeamViewer on both machines

without the need of an installation procedure. With the first start automatic partner IDs are

generated on both computers. Enter your partner's ID into TeamViewer and the connection is

established immediately.

Teamviewer allows two people to do file transfers, remote support (with or without

installation), remote administration of unattended servers/pc‘s & remote presentation of

products. Teamviewer works behind firewalls and Proxies, and uses secure data channels,

encoding traffic from both PCs.

Advantage:

Works can be done in one pc from another pc.

Page 18: SIC Report

Server Information And Control

Page 18 of 57

You can play games in others PC if your configuration is low.

Disadvantage:

Permission required.

Performance degradation in slower internet connections.

Dynamic user id and password.

Page 19: SIC Report

Server Information And Control

Page 19 of 57

CHAPTER 3:

PROJECT DEFINITION

Page 20: SIC Report

Server Information And Control

Page 20 of 57

3.1. Project Statement

Develop a common web application which can be accessible remotely over the intranet

using which we can view event log, start/stop windows services and can view/send

messages to the MSMQ.

3.2. Scope

Our Server Information and Control system is designed to provide various features such

as display Event viewer and windows services, start/stop windows services, Dynamic UI.

Event Viewer allows viewing event logs from different servers.

Windows services running on different servers are displayed and can be started/stopped.

UI is designed in such a way that event logs or windows services related to particular

servers are shown only. Servers related to particular type of user are shown only.

Administrator has all the rights of the system and he/she can grant more rights to any user

if requested. The system maintains different levels of users. Different users include

developer, tester, manager and administrator. Any user at higher level can also grant

rights to a user of lower level. e.g. suppose, manager is at higher level than developer and

administrator is the highest authority then, developer need not go to administrator to

request any rights, he/she can request for the rights to the manager itself.

The new feature of the system is it displays windows services and event logs of different

servers under single web page at one go.

3.3. Assumptions and Constraints

It is assumed that MSMQ is installed on all the computers using the SIC

application.

All the computers using the application should be under the same domain.

Internet connection is required to send the mails to the employees.

Page 21: SIC Report

Server Information And Control

Page 21 of 57

CHAPTER 4:

REQUIREMENT

SPECIFICATION

Page 22: SIC Report

Server Information And Control

Page 22 of 57

4.1. Functionality Requirements

4.1.1 Notification:

A notification mail about status change (start/stop) of windows services will be sent to

the users working under one project having common server. Whenever there is some

action performed by any user on any windows service on a particular server, a mail will

be generated giving time and name of user to all the other users working on the same

server. Hence, all other users will be known about exactly who changed the status.

4.1.2 Audit:

Audit feature is available for administrator only and not for any other user. Using this

feature administrator will be able to keep track of the status changes of windows services.

Administrator can keep himself informed about the changes made into the system.

4.1.3 Start/Stop Windows Services:

Developers, testers and managers will be able to change the status (start/stop) of the

windows services running on different servers under one project. Administrator is not

allowed to change the status of the services. He is just able to add/delete servers and

audit.

4.1.4 Troubleshoot:

Whenever an error is observed in any event log; developers, testers, etc. are informed

with the error. Developer, tester then can check for the problem and try to troubleshoot

the error.

4.1.5 Filter:

This feature is used with event logs and windows services. User is able to filter his search

of events and services depending on the attributes of the event or service. This feature

will help user remove all the information which is not required to him and display only

the data of his interest.

Page 23: SIC Report

Server Information And Control

Page 23 of 57

4.1.6 Dynamic UI:

User ID is checked to find the type of user whether it is developer, tester, manager,

administrator, etc. and accordingly the servers of the project under which the user is

working are displayed. If the status of the service is changed, the changed status will be

available for other users working on same server immediately.

4.1.7 Dynamic Right Distribution:

Administrator can grant some more rights if needed to any user according to the

requirements. There are levels of users who can grant rights to other users. E.g.

Administrator can grant rights to any user as Admin is the highest level authority of the

system. Manager is at higher level than developer and tester, so he can grant rights to

developer and tester. They need not go to administrator always to request rights.

4.1.8 Other Features:

The system keeps login records of users in its database. It will keep user ID and password

for verification purpose.

4.2. External Interface Requirements

4.2.1. User Interface

GUI for the system is being developed by using C#, JQuery, AJAX. The database used to

store username, password and some other information is SQL Server 2008. Following are the

screenshots of SIC application.

Page 1: Event Viewer

On this page all the events of a particular type on a server can be viewed.

Page 24: SIC Report

Server Information And Control

Page 24 of 57

Fig. 4.2.1.1 Event Logs Page

Page 2: Windows Services

All the running or stopped windows services on a selected server can be viewed on the page and

after logging in, the services can be started/stopped.

Fig.4.2.1.2 Windows Services Page

Page 25: SIC Report

Server Information And Control

Page 25 of 57

Page 3: MSMQ search

The messages present in a queue of a particular computer can be seen.

Fig. 4.2.1.3 MSMQ Search Page

Page 4: MSMQ Send

The message can be sent in a queue on a particular computer.

Page 26: SIC Report

Server Information And Control

Page 26 of 57

Fig.4.2.1.4 MSMQ Send Page

Page 5: Administrator

Administrator can see employee rights. He can also audit all the operations performed on any

windows service by any employee.

Fig.4.2.1.5 Administrator Page

Page 27: SIC Report

Server Information And Control

Page 27 of 57

4.2. Interfaces

4.2.1 Hardware Interfaces

The application will extract event logs and windows services, their status, etc.

information from various servers and display it under one web page. The hardware required for

this application is one server to maintain the database of the user and the application itself. Each

server must run windows OS on it otherwise compatibility issues may arise.

4.2.2 Software Interfaces

The database will be maintained in SQL Server 2008. The Operating Systems can be any

version of Windows as this product is developed over SQL Server as Backend and .NET

Framework 4.0. We will be using AJAX to refresh some part of the web page instead of

reloading the whole page

4.3. Hardware and Software Requirements

Hardware platform: PC/Laptops/servers Operating system and versions: Windows OS only, Windows Server 2003 onwards. Software: .NET framework 4.0, AJAX, SQL Server 2008.

Page 28: SIC Report

Server Information And Control

Page 28 of 57

CHAPTER 5:

DESIGN

Page 29: SIC Report

Server Information And Control

Page 29 of 57

5.1. Overview

User is able to see event log and windows services running at different servers on one

terminal.

User can filter event logs or windows services based on different attributes. Attributes

may be level, date and time, source, event ID, Task Category.

If any user changes the status of any windows service running on any local/remote server,

a mail/SMS will be triggered to the users related to that server giving information of the

changed status.

User can audit different windows services running on different servers.

5.2. Use-case

Figure 5.2.1 Use-Case

Page 30: SIC Report

Server Information And Control

Page 30 of 57

5.3 Events and actions

Actors in the use-case diagram are: EMPLOYEE, ADMINISTRATOR, USER, DEVELOPER,

MANAGER, TESTER.

Use Case LOGIN:

Primary actor: EMPLOYEE

Description: Employee logs in the system using this function.

Use Case SELECT SERVER:

Primary actor: EMPLOYEE

Description: Server of interest is selected using this use case.

Use Case VIEW EVENT LOGS:

Primary actor: EMPLOYEE

Description: Event logs of a particular type can be viewed.

Use Case VIEW WINDOWS SERVICES:

Primary actor: EMPLOYEE

Description: Windows services on a particular machine can be seen.

Use Case ADD/DELETE SERVER:

Primary actor: ADMINISTRATOR

Description: Administrator can add or delete a sever under particular domain.

Use Case AUDIT:

Primary actor: ADMINISTRATOR

Description: Administrator can audit the records of which employee performed what action on

which application.

Page 31: SIC Report

Server Information And Control

Page 31 of 57

Use Case GIVE RIGHTS:

Primary actor: ADMINISTRATOR

Description: Administrator can assign rights to the employees.

Use Case START/STOP WINDOWS SERVICES:

Primary actor: USER

Description: User can start/stop windows services on a particular server.

Use Case VIEW MESSAGES:

Primary actor: USER

Description: User receives messages via MSMQ.

Use Case ERROR REPORTS:

Primary actor: TESTER

Description: Tester can send error reports regarding the errors occurred in the event logs.

Use Case GIVE RIGHTS:

Primary actor: MANAGER

Description: In case administrator is busy, manager can give the rights to the employees.

Use Case TROUBLESHOOT:

Primary actor: DEVELOPER

Description: After obtaining the error reports from the tester, developer will go through it and

will troubleshoot the problem.

Page 32: SIC Report

Server Information And Control

Page 32 of 57

5.4. DFD diagrams

DFD shows about the processes of user. User can perform the different process like start/stop

windows service, View description, User verification, Select details of windows service or

event viewer, filtering of events. User passes username and password to start/stop windows

services and gets notification about the status of the service. He can view description of the

event occurred on the computer. After entering the username and password, the details are

verified and application notifies the user whether the user is valid or not. Using server name

user can view windows services and event logs. Filtering of event is achieved by passing

name of the event.

Fig. 5.4.1 DFD Level-2

Page 33: SIC Report

Server Information And Control

Page 33 of 57

5.5. Class diagram:

In the class diagram there are 9 classes which are view windows services, windows Services,

Event Log, Servers, Tester, Developer, User, Manager and Administrator. Managers,

Developer, Tester are the classes which generalize the class User. The classes View windows

Services, Windows Services and Event log are the part of class Server.

5.6. Low Level Design

Activity diagram

Activity diagram of ‗Server Information and Control‘ shows the flow of web application.

This diagram shows the function of different user.

Page 34: SIC Report

Server Information And Control

Page 34 of 57

Figure 5.6.1 Activity-Diagram

Page 35: SIC Report

Server Information And Control

Page 35 of 57

CHAPTER 6:

IMPLEMENTATION

Page 36: SIC Report

Server Information And Control

Page 36 of 57

6.1. Module 1: Impersonation code

This module is used to provide access to the critical sections of our project where a normal

Windows user doesn‘t have the access. This module is used while changing the status of the

windows services to start/stop where the administrator rights are required.

public class Impersonator : IDisposable

{

private WindowsImpersonationContext _impersonatedUser = null;

private IntPtr _userHandle;

public Impersonator()

{

_userHandle = new IntPtr(0);

string user = "[email protected]";

string userDomain = "";

string password = "sic";

bool returnValue = LogonUser(user, userDomain, password,

LOGON32_LOGON_NEW_CREDENTIALS,

LOGON32_PROVIDER_DEFAULT, ref _userHandle);

if (!returnValue)

throw new ApplicationException("Could not impersonate user");

WindowsIdentity newId = new WindowsIdentity(_userHandle);

_impersonatedUser = newId.Impersonate();

}

Page 37: SIC Report

Server Information And Control

Page 37 of 57

#region IDisposable Members

public void Dispose()

{

if (_impersonatedUser != null)

{

_impersonatedUser.Undo();

CloseHandle(_userHandle);

}

}

#endregion

#region Interop imports/constants

public const int LOGON32_LOGON_INTERACTIVE = 2;

public const int LOGON32_LOGON_SERVICE = 3;

public const int LOGON32_PROVIDER_DEFAULT = 0;

public const int LOGON32_LOGON_NEW_CREDENTIALS = 9;

[DllImport("advapi32.dll", CharSet = CharSet.Auto)]

public static extern bool LogonUser(String lpszUserName, String lpszDomain, String

lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]

public extern static bool CloseHandle(IntPtr handle);

#endregion

Page 38: SIC Report

Server Information And Control

Page 38 of 57

}

6.2 Module 2: Start/Stop Windows service

This module is used to start/stop a particular windows service. Impersonation is used while

starting/stopping the service.

protected void onclick_start(Object sender, EventArgs e)

{

try

{

String strHostName;

Button1.Visible = true;

Button2.Visible = true;

strHostName = Dns.GetHostName();

IPHostEntry ipEntry = Dns.GetHostByName(strHostName);

IPAddress[] addr = ipEntry.AddressList;

string currenttime = DateTime.Now.Hour.ToString() + ":" +

DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();

string currentdate = DateTime.Now.Day.ToString() + "/" +

DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();

row = GridView1.SelectedRow;

Page 39: SIC Report

Server Information And Control

Page 39 of 57

int n = int.Parse(row.Cells[1].Text) - 1;

using (Impersonator impersonator = new Impersonator())

{

scServices[n].Start();// to stop the service use scServices[n].Stop()

}

}

}

6.3 Module 3: Event Logs

This module is used to display the event logs related to a particular type (application,

system, security, setup). To select a particular type just change myLog.Log =

"Application" to security, setup or system.

public void GetSystemLogData()

{

DataTable objDt = new DataTable();

EventLog myLog = new EventLog();

myLog.Log = "Application";

hostname = Request.QueryString["Name"];

myLog.MachineName = hostname; //localhost

int x = 1;

//Check the number of Log entries

try

{

int LogCount = myLog.Entries.Count;

if (LogCount == 0)

Page 40: SIC Report

Server Information And Control

Page 40 of 57

lblMsg.Text = "No Events Logged in the System Log";

else

{

//Check for entries of the Current Date

for (int i = 0; i < LogCount; i++)

{

if(myLog.Entries[i].TimeGenerated.Date.ToShortDateString() ==

System.DateTime.Today.Date.ToShortDateString())

{

string cmdString = "Insert into

Applog(ID,Level,DnT,Source,eID,Message,TC)VALUES(

@ID1,@Level1,@DnT1,@Source1,@eID1,@Message1,@

TC1)";

SqlCommand cmd = new SqlCommand(cmdString, con);

cmd.Parameters.Add(new SqlParameter("@ID1", x++));

cmd.Parameters.Add(new SqlParameter("@Level1",

myLog.Entries[i].EntryType.ToString()));

cmd.Parameters.Add(new SqlParameter("@DnT1",

myLog.Entries[i].TimeGenerated.ToString()));

cmd.Parameters.Add(new SqlParameter("@Source1",

myLog.Entries[i].Source.ToString()));

cmd.Parameters.Add(new SqlParameter("@eID1",

myLog.Entries[i].EventID.ToString()));

cmd.Parameters.Add(new SqlParameter("@Message1",

myLog.Entries[i].Message.ToString()));

cmd.Parameters.Add(new SqlParameter("@TC1",

myLog.Entries[i].Category.ToString()));

// con.Open();

Page 41: SIC Report

Server Information And Control

Page 41 of 57

cmd.ExecuteNonQuery();

// con.Close();

}

}

}

}

catch (Exception ex)

{

string stackTrace = ex.StackTrace;

Log Err = new Log();

Err.ErrorLog(Server.MapPath("/Logs/ErrorLog"), ex.Message, stackTrace);

lblMsg.Visible = true;

lblMsg.Text = "Fatal error : " + ex.Message;

}

Page 42: SIC Report

Server Information And Control

Page 42 of 57

CHAPTER 7:

TESTING

Page 43: SIC Report

Server Information And Control

Page 43 of 57

7.1. Overview

The Testing phase forms an important part of the software development life cycle. Any

software product has to be tested thoroughly before it is delivered to the end customer. Well

tested software with limited features is certainly better than the one having many features with

only a few of them working. This document provides a general overview of the testing strategy

adopted for testing our product.

7.1.1 Purpose:

The software testing involves verification and validation of the Software produced. The

objectives of testing are:

Testing is a process of executing of program with the intent of finding an

error.

A good test case is the one where there is high probability of finding error.

A successful test is the one which uncovers an as-yet-undiscovered error.

Our objective of testing is systematically uncovering different classes of errors and to do

so with minimum amount of time and effort. The data collected in the test provides a good

indication of the software reliability and some indication of software quality as a whole. The

results of testing will not only help to know which parts of the system are working below

average but also helps to make the system more user friendly. Testing is considered as an

unavoidable part of any responsible effort to develop a software system.

The testing of our software involves achieving the following objectives:

Is MSMQ code work or not?

Is the code extracts windows services/event viewer of required server?

Is the window service start or stop properly?

Page 44: SIC Report

Server Information And Control

Page 44 of 57

Is auditing is work properly or not?

7.1.2 Statement of Scope:

The scope of the testing process is limited to the determination of the consistency and

integrity of the Web based automated patch propagation tool.

7.2 Test Plan:

7.2.1 Software to be tested:

The software is to be tested in the client server environment. Testing is performed by

configuring two machines – one as the server and other as the client. The project will have three

levels of testing, Unit, System/Integration and Validation.

7.2.2 Testing strategy

Figure 7.2.2.1 Testing Strategy

The diagram above outlines the Test Process approach that will be followed.

Page 45: SIC Report

Server Information And Control

Page 45 of 57

Design/Build System Test involves identifying Test Cycles, Test Cases, Entrance & Exit

Criteria, Expected Results, etc. In general, test conditions/expected results will be identified

by the Test Team in conjunction with the Project Business Analyst or Business Expert. The

Test Team will then identify Test Cases and the Data required. The Test conditions are

derived from the Business Design and the Transaction Requirements Documents.

Design/Build Test Procedures includes setting up procedures such as Error Management

systems and Status reporting, and setting up the data tables for the Automated Testing Tool.

Build Test Environment includes requesting/building hardware, software and data set-ups.

Execute Project Integration Test - Test Phases & Cycles Execute Operations Acceptance Test

- Test Phases & Cycles

Signoff - Signoff happens when all pre-defined exit criteria have been achieved.

7.2.3 Unit testing

In computer programming, unit testing is a procedure used to validate that individual

units of source code are working properly. A unit is the smallest testable part of an application. In

procedural programming a unit may be an individual program, function, procedure, etc., while in

object-oriented programming, the smallest unit is a method, which may belong to a base/super

class, abstract class or derived/child class.

Strategy: Each component is tested separately. A bottom up approach is used for testing.

1) Unit test cases

Apart from tests for each function, each major module is tested as a whole as described

below. First unit test cases are applied to each module and then modules are integrated to test the

whole application.

Page 46: SIC Report

Server Information And Control

Page 46 of 57

7.2.3.1. Unit Tests

a. STATIC UNIT TESTING:

The following metrics will be used to ensure software quality:

Team meeting every 4 days to discuss progress.

Meeting with internal guide every week to analyze the progress of the previous week.

Meeting with external guide at ZenSar technologies every month to discuss the progress till

date, suggest changes for improvement and decide the future course of action. The work done is

mailed to the guide every week so that he reviews it and suggests improvements.

QUALITY CONTROL THROUGH TESTING:

Test cases will be designed to test each module thoroughly. Each test consists of the

requirements for performing the test; the exact procedure to be carried out; the correct results of

the test and the errors which the test might expose.

AUDITING AND EXTERNAL REVIEWS:

Software reviews serve to uncover errors and defects that can be removed. A review is a

way of using the diversity of a group of people to point out needed improvements in the product

of a single person or team, confirm the parts that do not need improvement and finally achieve

technical work of more uniform quality. We use Formal Technical Review (FTR) as a reviewing

technique.

Our technical guide reviews our work after regular intervals of time. He suggests changes

wherever necessary, points out errors and indicates parts that are done correctly. Apart from this,

the progress report is mailed to the guide with the work done every week so that he can review

the work and suggest changes accordingly.

Apart from the FTR we also have occasional review meetings in which we abide by

the following guidelines:

Page 47: SIC Report

Server Information And Control

Page 47 of 57

Review each member‘s progress. Each member speaks about the work he has done. The

other members then discuss what they have understood so that it is ensured that all understand

the same thing.

Set an agenda for each meeting

Take written notes

Develop a checklist for each module that is going to be reviewed

Allocate resources and schedule time for FTRs

Review your early reviews

b. DYNAMIC UNIT TESTING:

Module 1:

Aim: To extract windows services from the local & remote computer.

Test data: Check the windows services.

Expected Results: Windows services of selected computer are extracted successfully.

Actual results: Same as expected.

Module 2:

Aim: To extract event logs from the local & remote computer.

Test data: Check the event logs.

Expected Results: Event logs of selected computer are extracted successfully.

Actual results: Same as expected.

Module 3:

Page 48: SIC Report

Server Information And Control

Page 48 of 57

Aim: To filter event logs from the local & remote computer.

Test data: Check the event logs.

Expected Results: The required event log is filtered successfully.

Actual results: Same as expected

Module 4:

Aim: To start/ stop the selected windows service.

Test data: Check the windows service.

Expected Results: The selected windows service is started/stopped successfully.

Actual results: Same as expected

Module 3:

Aim: To maintain the audit data.

Test data: Check the audit.

Expected Results: The audit is displayed successfully.

Actual results: Same as expected

Module 3:

Aim: To send/receive messages to/from local/remote computer using MSMQ.

Test data: Send/receive the message to/from selected computer.

Expected Results: The message sent/received successfully to/from the selected computer.

Actual results: Same as expected

Page 49: SIC Report

Server Information And Control

Page 49 of 57

7.2.4 Integration testing:

Strategy:

Integration testing is a systematic technique for constructing the software architecture while at the same

time conducting tests to uncover tests associated with interfacing. Integration testing is performed after

unit testing. It focuses on the problems related to integration of units that function correctly when used

individually.

An integration testing may follow either a top-down approach or a bottom-up one. Here we have used

bottom-up testing i.e. beginning with construction and testing of atomic modules. Integration testing

documentation involves:

Testing is done by executing the application in a client server environment.

After integration testing is complete and the errors detected are fixed, regression testing is required to

ensure that the changes made to the software have not introduced new errors.

7.2.5 Validation testing:

Strategy:

The test environment is designed to be identical, or as close as possible, to the anticipated user's

environment, including extremes of such that application goes on allocating memory continuously

without freeing and also performing continuous writes to that memory. These test cases accompanied by

test case input data or a formal description of the operational activities (or both) to be performed—

intended to thoroughly exercise the specific case—and a formal description of the expected results.

High-order testing:

High-order testing checks that the software meets customer requirements and that the software,

along with other system elements, meets the functional, behavioral and performance requirements. It uses

black-box techniques. The users themselves perform high-order testing. High-order testing includes

validation testing, system testing (focuses on aspects such as reliability, security, stress, usability, and

performance), and acceptance testing (includes alpha and beta testing). The testing strategy specifies the

type of high-order testing that the project requires. This depends on the aspects that are important in a

particular system from the user perspective.

Page 50: SIC Report

Server Information And Control

Page 50 of 57

7.3. Risk Analysis

Initial Risk Assessment

This Risk Mitigation Monitoring and Management Plan identify and documents the risks

associated with ―Server Information and Control‖. In addition to project risks and technical risks,

business risks are also identified, analyzed and documented. Both generic and product-specific

risks have been considered. In addition to identification, this document outlines the strategy that

we have adopted to avoid these risks. A contingency plan is also prepared for each risk, in case it

becomes a reality. Only those risks have been treated whose probability and impact are relatively

high, i.e. above a reference level.

Test cases

TestCaseID Objective Step Procedure Expected

Result

Actual

Result

Pass/Fail

Login To test

whether

employee

has rights to

start/stop

windows

services

1

2

Enter valid

username

and password

Press Login

Enter invalid

username &

password

Entered

username

and

password

should be

accepted &

Start and

Stop

buttons

enabled

Error

message

should be

shown

Same as

expected

Same as

expected

Pass

Pass

Page 51: SIC Report

Server Information And Control

Page 51 of 57

3

4

Enter either

valid

username or

password and

invalid one of

them

Press Login

without

entering

username

and password

both

Error

message

should be

shown

Error

message

should me

shown

Same as

expected

Same as

expected

Pass

Pass

Table 7.2 Test Cases

Page 52: SIC Report

Server Information And Control

Page 52 of 57

CHAPTER 8:

CONCLUSION

Page 53: SIC Report

Server Information And Control

Page 53 of 57

Conclusion

We have developed the web application Server Information And Control using ASP.NET

4.0 & SQL server 2008. This web application integrates the various windows feature like

windows services, event logs, MSMQ. Through this application we can remotely access the

windows services of other server pc which are in the same domain. One can start/stop the

windows services of other PC if he/she has the rights. The system maintains different levels of

users. Different users include developer, tester, manager and administrator. If any user at higher

level can also grant rights to a user of lower level. The new feature of the system is it displays

windows services and event logs of different servers under single web page at one go. Audit

feature is available for administrator only and not for any other user. Using this feature

administrator will be able to keep track of the status changes of windows services. Administrator

can keep himself informed about the changes made into the system.

a. Future enhancements

Currently our web application ‗Server Information and Control‘ runs on intranet only. In

future we would like to extend it for internet.

In MSMQ module, the module is able to send the message to one computer only, in

future we would like to send the messages to multiple computer serially.

In MSMQ module, the receiver computer receives the message but does not process the

message automatically, in future we would like to extract message sent in MSMQ and

process it according to the body( in case of commands) .

Page 54: SIC Report

Server Information And Control

Page 54 of 57

CHAPTER 9:

GLOSSARY

Page 55: SIC Report

Server Information And Control

Page 55 of 57

Glossary

Server Information And Control (SIC) mainly refers to web application that integrates the windows

services, event logs and MSMQ.

Microsoft Message Queuing (MSMQ) The Microsoft Message Queuing (MSMQ) technology enables

applications running at different times to communicate across heterogeneous networks and systems that

may be temporarily offline.

Asynchronous java server pages (Ajax): With Ajax, web applications can send data to, and

retrieve data from, a server asynchronously (in the background) without interfering with the

display and behavior of the existing page

Visual studio 2010: Is a handy tool which can be used to develop .net web application. It provides

many languages such as C#, VB etc. It also provides backend in the form on SQL server 2008.

Event logs: A component of Microsoft's Windows NT line of operating systems, lets administrators and

users view the event logs on a local or remote machine.

Windows services: On Microsoft Windows operating systems, a Windows service is a long-running

executable that performs specific functions and which is designed not to require user intervention.

Unit testing : Unit testing refers to testing program units in isolation.

Integration Testing: All modules are integrated and then testing of whole system is performed. It also

includes evaluation of project.

Page 56: SIC Report

Server Information And Control

Page 56 of 57

CHAPTER 10:

REFERENCES

Page 57: SIC Report

Server Information And Control

Page 57 of 57

[1] ―Performance and Stability Testing of MSMQ in the .NET Environment‖

Jae-Kyu Chun , Seok-Hyung Cho

[2] Microsoft message Queuing(MSMQ) Center, http://www.microsoft.com/msmq

[3] http://en.wikipedia.org/wiki/Windows_service

[4] http://en.wikipedia.org/wiki/Event_viewer