Sie sind auf Seite 1von 56

1.

PROJECT DESCRIPTION
1.1 Introduction :
DDD is a new ensemble approach for dealing with concept Drift. It is an Online learning
algorithms often have to operate in the presence of concept drifts. A recent study revealed
that different diversity levels in an ensemble of learning machines are required in order to
maintain high generalization on both old and newconcepts. Inspired by this study and based
on a further study of diversity with different strategies to deal with drifts, we propose a new
online ensemble learning approach called Diversity for Dealing with Drifts (DDD). DDD
maintains ensembles with different diversity levels and is able to attain better accuracy than
other approaches. Furthermore, it is very robust, outperforming other drift handling
approaches in terms of accuracy when there are false positive drift detections. In all the
experimental comparisons we have carried out, DDD always performed at least as well as
other drift handling approaches under various conditions, with very few exceptions.
Online learning has been showing to be very useful for agrowing number of applications
in which training dataare available continuously in time and/orthere are time and space
constraints. Examples of suchapplications are industrial process control, computersecurity,
intelligent user interfaces, market-basket analysis,information filtering, and prediction of
conditional branchoutcomes in microprocessors.
Several definitions of online learning can be found in theliterature. In this work, we adopt
the definition that onlinelearning algorithms process each training example once onarrival,
without the need for storage or re processing .this way, they take as input a single training
example aswell as a hypothesis and output an updated hypothesis .We consider online
learning as a particular case ofincremental learning.
PROBLEM DEFINITION:
A concept drift represents a change in the distribution ofthe problem Even though there
are some ensemble approachesdesigned to handle concept drift, only very recently adeeper study
of why, when, and how ensembles can behelpful for dealing with drifts has been done . The
studyreveals that different levels of ensemble diversity arerequired before and after a drift in
order to obtain bettergeneralization on the new concept.
MODULES
1

1.
2.
3.
4.
5.

Data Allocation Module


Fake Object Module
Optimization Module
Data Distributor
DDD

1.2EXISTING SYSTEM
2

We adopt the definition that online learning algorithms process each training example
once on arrival, without the need for storage or reprocessing. In this way, they take as input a
single training example as well as a hypothesis and output an updated hypothesis. We consider
online learning as a particular case of incremental learning.
The latter term refers to learning machines that are also used to model continuous
processes, but process incoming data in chunks, instead of having to process each training
example separately.
Ensembles of classifiers have been successfully used toimprove the accuracy of single
classifiers in online and incremental learning . However, onlineenvironments are often no
stationary and the variables to be predicted by the learning machine may change with time
(concept drift).

1.3 PROPOSED SYSTEM


3

We propose a new online ensemble learning approach to handle concept drifts called
Diversity for Dealing with Drifts (DDD). The approach aims at better exploiting diversity to
handle drifts, being more robust to false alarms (false positive drift detections), and having faster
recovery from drifts.
In this way, it manages to achieve improved accuracy in the presence of drifts at the same
time as good accuracy in the absence of drifts is maintained.
Experiments with artificial and real-world data show that DDD usually obtains similar or
better accuracy than Early Drift Detection Method (EDDM) and better accuracy than Dynamic
Weighted Majority (DWM).

1.3.1 HARDWARE REQUIREMENTS


PROCESSOR

Pentium IV

CPU CLOCK

2GHz

RAM

1GB

HDD

160 GB

MONITOR

Standard color

KEYBOARD

108 standard keyboard

MOUSE

Standard Optical Mouse

1.3.2 SOFTWARE REQUIREMENTS


OPERATING SYSTEM

Windows XP

FRONT END

C#.net

BACK END

SQL SERVER

2. LOGICAL DEVELOPMENT

2.1 Architectural Diagram

Adminstrator
Fake
database

Agent1

Agent2

Fake
objec
t

Flowchart

Main
Databas
e

Agent
n

Start

Admin

Logi
n
Ye
s
Agents

No

Yes

UML

Admin
Logi
n

Agent

View
View
Fake
agent
data
detail
s
Add
fake
Distri
data
bute
data

2.2 Data Flow Diagram


Level 0

Level 1

10

Level 2

11

3. DATABASE DESIGN

3.1 TABLE DESIGN


Files detailes:

LeakFiles:

12

Login:

Register:

13

3.2 DATA DICTIONARY


Files detailes

14

LeakFiles:

15

Login

16

Register

17

4. PROGRAM DESIGN
Online learning has been showing to be very useful for agrowing number of applications
in which training dataare available continuously in time and/orthere are time and space
constraints. Examples of suchapplications are industrial process control, computersecurity,
intelligent user interfaces, market-basket analysis,information filtering, and prediction of
conditional branchoutcomes in microprocessors.
Several definitions of online learning can be found in theliterature. In this work, we adopt
the definition that onlinelearning algorithms process each training example once onarrival,
without the need for storage or re processing . this way, they take as input a single training
example aswell as a hypothesis and output an updated hypothesis .We consider online learning as
a particular case ofincremental learning.
A concept drift represents a change in the distribution ofthe problem Even though there
are some ensemble approachesdesigned to handle concept drift, only very recently adeeper study
of why, when, and how ensembles can behelpful for dealing with drifts has been done . The
studyreveals that different levels of ensemble diversity arerequired before and after a drift in
order to obtain bettergeneralization on the new concept.

MODULES :
1. Data Allocation Module
The main focus of our project is the data allocation problem as how can the distributor
intelligently give data to agents in order to improve the chances of detecting a guilty
agent.When working with real-world data sets, it is not possibleto know exactly when a drift
starts to occur, which type ofdrift is present, or even if there really is a drift. So, it is notpossible
to perform a detailed analysis of the behavior ofalgorithms in the presence of concept drift using
only purereal-world data sets. In order to analyze the effect of low/high diversity ensembles in
the presence of concept driftand to assist the analysis of DDD. Then, in order to reaffirm
theanalysis of DDD, we performed experiments using threereal-world problems.
18

DATA ALLOCATION

DISTRIBUTOR
INTELLIGENTLY

DRIFTS

DDD

2. Fake Object Module


Fake objects are objects generated by the distributor in order to increase the chances of
detecting agents that leak data. The distributor may be able to add fake objects to the distributed
data in order to improve his effectiveness in detecting guilty agents. Our use of fake objects is
inspired by the use of trace records in mailing lists.
DISTRIBUTOR
FAKE OBJECTS

DETECTING
AGENTS

ADD FAKE
OBJECTS

TRACE
RECORDS

3. Optimization Module
The Optimization Module is the distributors data allocation to agents has one constraint
and one objective. The distributors constraint is to satisfy agents requests, by providing them
with the number of objects they request or with all available objects that satisfy their conditions.
His objective is to be able to detect an agent who leaks any portion of his data.
OPTIMIZATION
DISTRIBUTOR

DISTRIBUTOR
DATA

LEAKS DATA

4. Data Distributor
A data distributor has given sensitive data to a set of supposedly trusted agents (third
parties). Some of the data is leaked and found in an unauthorized place (e.g., on the web or
19

somebodys laptop). The distributor must assess the likelihood that the leaked data came from
one or more agents, as opposed to having been independently gathered by other means.
DATA DISTRI
BUTOR

DATA LEAKED
UNAUTHORIZED

DISTRIBUTOR
LEAKED DATA

5. DDD
DDD operates in two modes: prior to driftdetection and after drift detection. We chose to
use a driftdetection method, instead of treating drifts implicitly,because it allows immediate
treatment of drifts once theyare detected. So, if the parameters of the drift detectionmethod are
tuned to detect drifts the earliest possible andthe approach is designed to be robust to false
alarms, wecan obtain fast adaptation to new concepts.
DDD
PRIOR TO DRIFT
DETECTION

DETECT DRIFTS

20

AFTER DRIFT
DETECTION

SOFTWARE DESCRIPTION
Microsoft has invested millions in marketing, Advertising and development to produce
what it feels is the foundation of the future Internet. Its a corporate initiative, the strategy of
which was deemed so important, that Bill Gates himself, Microsoft Chairman and CEO,
decided to oversee personally its development. It is a technology that Microsoft claims will
reinvent the way companies carry out business globally for years to come. In his opening
speech at the Professional Developers Conference (PDC) held in Orlando Florida in July of
2000, Gates stated that a transition of this magnitude only comes around once every five to
six years. What is this show-stopping technology? Its .NET.
What is .NET?
.NET is the result of a complete make-over of Microsofts software development
products, and forms part of the companys new strategy for delivering software as a service.
The key features that
.NET Platform:
The .NET platform includes the .NET Framework and tools to build and operate services,
clients,

and so on. ASP.NET, the focus of this book, is a part of the .NET Framework.

.NET Products:
.NET products currently include MSN.NET, Office.NET, Visual Studio.NET, and Windows
Server 2003, originally known as Windows .NET Server. This suite of extensively revised
systems provides developers with a friendly, usable environment in which they may create
applications with a range of programming languages including C++. NET, Visual Basic.
NET, ASP.NET, and C#. Because all these products are built on top of .NET, they all share
key components, and underneath their basic syntaxes youll find they have much in common.

21

.NET My Services:
An initiative formerly known as "Hailstorm", .NET My Services is a set of XML Web
Services1 currently being provided by a host of partners, developers, and organizations that
are hoping to build corporate services and applications for devices and applications, as well
as the Internet. The collection of My Services currently extends to passport, messenger,
contacts, email, calendars, profiles, lists, wallets, location, document stores, application
settings, favorite Websites, devices owned, and preferences for receiving alerts.
About Asp.Net
What is ASP.net?
You've probably heard the word ASP.net fairly often these days, especially on developer sites
and news. This article will explain what the fuss is all about. ASP.NET is not just the next
version of ASP; it is the next era of web development. ASP.NET allows you to use a full
featured programming language such as C# (pronounced C-Sharp) or VB.NET to build web
applications easily.
ASP.NET still renders HTML
Unfortunately, the Internet still has bandwidth limitations and not every person is running the
same web browser. These issues make it necessary to stick with HTML as our mark-up
language of choice. This means that web pages won't look quite as amazing as a fully fledged
application running under Windows, but with a bit of skill and creative flair, you can make
some rather amazing web applications with ASP.NET. ASP.NET processes all code on the
server (in a similar way to a normal application). When the ASP.NET code has been
processed, the server returns the resultant HTML to the client. If the client supports
JavaScript, then the server will use it to make the clients browser experience quicker and
easier. Even with HTML being the limiting factor here, ASP.NET still manages to bring true
OOP (Object Oriented Programming) to the Internet.

OOP on the Internet

22

Object Oriented Programming makes it possible to build extremely large applications, while
still keeping your code clean and structured. Now with ASP.NET, we can do the same on the
web. Traditional ASP uses HTML and VBScript (or Jscript) to process and render pages, but
because VBScript is a scripting language, you were forced to write spaghetti code (VBScript
was entwined in the HTML and ended up rather messy in larger applications). ASP.NET
separates code from display, and you can even have pages with no ASP.NET code in them at
all. By adding references in your HTML (called controls), you can tell ASP.NET that you
want a button here, some text there, and then in your code, you can manipulate what these
controls look like, what they display, how big they are, etc. Controls can do more than just
display information. You can add events to controls, so that when a visitor clicks on a button,
for example, ASP.NET executes a function of your choice.
Web Services
One great feature of ASP.NET is Web Services. Web services mean that you can literally
have several pieces of your application on different servers all around the world, and the
entire application will work perfectly and seamlessly. Web services can even work with
normal .NET Windows applications. For example: A lot of people would like to have a stock
ticker on their web site, but not many people want to manually type in all changes to the
prices. If one company (a stock broker) creates a web service and updates the stock prices
periodically, then all of those people wanting the prices can use this web service to log in, run
a function which grabs the current price for a chosen company, and return it. Web services
can be used for so many things: news, currency exchange, login verification... the ways in
which they can be used are limited to your imagination!

Great XML Support


ASP.NET makes it simple to use XML for data storage, configuration and manipulation. The
tools which are built into ASP.NET for working with XML are very easy to use. XML is
excellent for storing information that rarely changes, because you can just cache that
information in the computers memory after it has been initially extracted.
23

Class Library
ASP.NET includes an enormous class library which was built by Microsoft. Because this
class library is so large, it encapsulates a huge number of common functions. For example, if
you wanted to retrieve data from a database and display that data in a simple grid control
through

classic

ASP,

then

you'd

have

to

write

quite

lot

of

code.

In ASP.NET, you don't write any code to display the data: you just write the code to
bind the data to an object called a DataGrid (which can be done in just a couple of lines).
Then, you just have to create a reference on your page to where that DataGrid should go. The
DataGrid will be rendered as a table, and will contain all of the data extracted from the
database.
Microsoft has created an amazingly well designed MSDN library for ASP.NET and
all of the other .NET languages. It includes a full class library containing information and
examples on every class, function, method, and property accessible through ASP.NET.
The MSDN library also includes some tutorials and examples to get you started. It may take
you a while to get used to the format and layout of the MSDN ASP.NET library, however,
once you do, you will find it's an invaluable resource to aid you throughout your ASP.NET
learning experience. The .NET MSDN library can be found at http://msdn.microsoft.com/net/
Complete Compatibility
One of the most important goals of .NET was to allow developers to write an ASP.NET
application using multiple programming languages. As long as each ASP.NET page contains
only one programming language, you can mix and match different pages using different
languages and they will work together seamlessly. This means you can now have a team of
developers with half programming in C#, and the other half in VB.NET, with no need to
worry about language incompatibilities, etc.
A cool little side-affect of all this is that all the programming languages look very similar,
and differ only by their language syntax.

24

Take the following code snippets for example. They both do exactly the same thing but the
first is written in C#, and the second in VB.NET.
The C# version:
void Page_Load(Object S, EventArgs E) { myLabel.Text = "Hello world!!";
</script>
The VB.NET version:
Sub Page_Load(S As Object, E As EventArgs) myLabel.Text = "Hello world!!"
End Sub
</script>
If you take either of the code examples shown above and add the following HTML to them,
then they would both run perfectly inside of an ASP.NET page:
<head>
<title>"Hello World" example!</title>
</head>
<body>
<asp:Label id="myLabel" runat="server" />
</body>
</html>
About Div Tag:
Dividing the Page with the <div> Tag
The <div> tag is used to establish separate divisions or areas of your page. It is one of the
most powerful elements in xhtml, as it is essential for positioning the design of your page
using CSS.
Positioning will not be discussed in this tutorial, but gaining a solid understanding of the
<div>

tag now, will make it easier to learn more advanced positioning if and when you

decide to learn more.

25

The id Attribute
The id attribute can be used with any tag element, but to identify and define an area of your
page, the <div> tag can be used.
Facts about ids:
The value for the id attribute must be used only once on your page. It is a unique identifier.
Keep in mind that the id value is case-sensitive. "Top" is different from "TOP" and also
different from "top" it is easiest to use all lower case letters.
Do not use spaces or any special characters as the id value. You may use letters, digits (1 thru
9), dashes (-), and underscores (_) but you must start the id value with a letter.
Defining Divisions
Working with the example file created from prior tutorials, examine the page displayed in
your web browser.
heading, content, email, footer
heading, italian, chinese, chocolate, email, footer
heading, content, footer

5. TESTING
TESTING
UNIT TESTING:

26

Unit testing begins at the vertex of the spiral and concentrates on each unit of the
software as implemented in source code. Initially test focus on each module individually,
assuring that it function properly as a unit. Hence the name unit testing. Unit testing makes
heavy use of white box testing techniques, exercising specific paths in a modules control
struture to ensure complete coverage and maximum error detection.
Unit testing focuses verification effort on the smallest unit of software design the
module. Using the procedural design description as a guide important control paths are tested to
uncover the errors within the boundary of the module. The relative complexity of the tests and
uncovered errors is limited by the constrained scope established for unit testing.
UNIT TEST PROCEDURE
Unit testing is considered as an adjacent to the coding step. After source level code has been
developed, reviewed and verify for correct syntax, unit test case design begins. A module is
not a standalone program; hence a driver or stub software must be developed for each unit
test. Stubs serve to replace modules that are subordinate to the module to be tested. Drivers
and stubs represent overhead. Unit testing is simplified when a module with high cohesion is
designed. When only one function is addressed by a module. The number of test cases is
reduced and error can be more easily predicted and uncovered.

27

INTEGRATION TESTING
Integration testing is a systematic technique for constructing a program structure
while conducting tests to uncover errors associated with interfacing. The objective is to take unit
tested modules and build a program structure that has been detected by design.
There is a often a tendency to attempt non-incremental integration, that is, to
construct the program using big bang approach. All modules are combined in advance. The
entire program is tested as a whole. A set of errors is encountered. Correction is difficult because
isolation of causes is complicated by the vast expanse of the entire program.
Incremental integration is the antithesis of the big bang approach. The program is
constructed and tested in a small segments, where errors are easier to isolate and correct;
interfaces are more likely to be tested completely; and a systematic approach may be applied.
DIFFERENT INCREMENTAL INTEGRATION STRATEGIES:
1.Top-Down Integration.
2.Bottom-up Integration.
3.Regression Testing

28

VALIDATION TESTING:
The application is tested to check how it responds to various kinds of input given. The
user should be intimated of any kind of exceptions in a more understandable manner so that
debugging becomes easier.
At the culmination of the black box testing, software is completely assembled as a
package; interfacing errors have been uncovered and corrected. Next stage is the validation
testing and it can be defined in many ways, but a simple definition is that the validation succeeds
29

when the software functions in the manner that can be reasonably expected by the user.When an
user enters incorrect inputs it should not display error messages, instead it should display helpful
messages enabling user to use the tool properly. The tool is tested with test data as well as live
data and has been found to work properly in the networked environment.

6. CONCLUSION
This paper presents an analysis of low and high diversityensembles combined with
different strategies to deal withconcept drift and proposes a new approach (DDD) tohandle
drifts.The analysis shows that different diversity levels obtainthe best prequential accuracy
depending on the type of drift.It also shows that it is possible to use information learnedfrom the
old concept in order to aid the learning of the newconcept, by training ensembles which learned
the old conceptwith high diversity, using low diversity on the new concept.Such ensembles are
able to outperform new ensemblescreated from scratch after the beginning of the drift,especially
when the drift has low severity and high speed,and soon after the beginning of medium or low
30

speed drifts.DDD maintains ensembles with different diversity levels,exploiting the advantages
of diversity to handle drifts andusing information from the old concept to aid the learning ofthe
new concept.
It has better accuracy than EDDM mainlywhen the drifts have low severity or low speed,
due to theuse of ensembles with different diversity levels. DDD hasalso considerably good
robustness to false alarms. Whenthey occur, its accuracy is better than EDDMs also duringstable
concepts due to the use of old ensembles. Besides,DDDs accuracy is almost always higher than
DWMs, bothduring stable concept and after drifts. So, DDD is accurateboth in the presence and
in the absence of drifts.Future work includes experiments using a parameter tocontrol the
maximum number of time steps maintainingfour ensembles, further investigation of the
performance onskewed data sets, and extension of DDD to better deal withrecurrent and
predictable drifts.

FUTURE ENHANCEMENT
Future work includes experiments using a parameter to control the maximum number of
time steps maintainingfour ensembles, further investigation of the performance on skewed data
sets, and extension of DDD to better deal with recurrent and predictable drifts.The analysis
shows that different diversity levels obtain the best prequential accuracy depending on the type
of drift.It also shows that it is possible to use information learned from the old concept in order
to aid the learning of the new concept, by training ensembles which learned the old concept with
high diversity, using low diversity on the new concept.Such ensembles are able to outperform
31

new ensembles created from scratch after the beginning of the drift,especially when the drift has
low severity and high speed, and soon after the beginning of medium or low speed drifts.

7. BIBLIOGRAPHY

BOOK REFERENCE

32

1. N.C. Oza and S. Russell, Experimental Comparisons of Online and Batch Versions of
Bagging and Boosting, Proc. ACM SIGKDD Intl Conf. Knowledge Discovery and Data
Mining, pp. 359-364, 2001.
2. A. Fern and R. Givan, Online Ensemble Learning: An Empirical Study, Machine
Learning, vol. 53, pp. 71-109, 2003.
3. R. Polikar, L. Udpa, S.S. Udpa, and V. Honavar, Learn++: An Incremental Learning
Algorithm for Supervised Neural Networks, IEEE Trans. Systems, Man, and
Cybernetics - Part C, vol. 31, no. 4, pp. 497-508, Nov. 2001.
4. F.L. Minku, H. Inoue, and X. Yao, Negative Correlation in Incremental Learning,
Natural Computing J., Special Issue on nature-Inspired Learning and Adaptive Systems,
vol. 8, no. 2, pp. 289-320, 2009.
5. H. Abdulsalam, D.B. Skillicorn, and P. Martin, Streaming Random Forests, Proc. Intl
Database Eng. and Applications Symp. (IDEAS), pp. 225-232, 2007.
6. A. Narasimhamurthy and L.I. Kuncheva, A Framework for Generating Data to Simulate
Changing Environments, Proc. 25th IASTED Intl Multi-Conf.: Artificial Intelligence
and Applications, pp. 384-389, 2007.
7.

J. Gama, P. Medas, G. Castillo, and P. Rodrigues, Learning with Drift

Detection, Proc. Seventh Brazilian Symp. Artificial Intelligence (SBIA 04), pp. 286295, 2004.
8.

IEEE

TRANSACTIONS

ON

KNOWLEDGE

AND

DATA

ENGINEERING, VOL. 24, APRIL 2012 Fig. 6. Average false positive and negative error
rates for PAKDD, reset at every third of the learning using MLPs as base learners and
considering 30 runs.

WEBREFERENCE
1. www.ustudy.co.in
33

2. www.w3schools.com
3. www.tutorialspoint.com

8. APPENDIX
8.1 SOURCE CODE
Login.aspx
using
using
using
using
using
using
using
using

System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;

34

using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
publicpartialclassLogin : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=E:\\Code\\App_Data\\DataLeak.mdf;Integra
ted Security=True;Connect Timeout=30;User Instance=True");
SqlCommand cmd;
int n = 0;
SqlDataReader dr;
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
con.Open();
cmd = newSqlCommand("select * from login where username='" +
Login1.UserName + "' and password = '" + Login1.Password + "'", con);
dr=cmd.ExecuteReader();
if (dr.Read())
{
n = 1;
Session["username"] = Login1.UserName;
Response.Redirect("AdminHome.aspx");
}
con.Close();
if (n == 0)
{
}

poisson();

}
protectedvoid LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("SignUp.aspx");
}
publicvoid poisson()
{
con.Open();
cmd = newSqlCommand("select * from register where userid='" +
Login1.UserName + "' and password ='" + Login1.Password + "'", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["username"] = Login1.UserName;
Response.Write("<script>alert('Welcome " + Login1.UserName + "
')</script>");
Response.Redirect("UserHome.aspx");
}
con.Close();
}
}

35

MasterPage.master
<
%@MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inhe
rits="MasterPage"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
</head>
<bodybgcolor="#ccffff">
<formid="form1"runat="server">
<div>
<tablealign="center">
<trbgcolor="#0066cc">
<tdalign="center"style="width: 1060px; font-family:TimesNewRoman;
color:White">
<h1>Diversity for Dealing with Drifts (DDD) </h1>
</td>
</tr>
<tr>
<tdstyle="width: 1060px">
<asp:contentplaceholderid="ContentPlaceHolder1"runat="server">
</asp:contentplaceholder>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

admin.master
using
using
using
using
using
using
using
using
using
using

System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;

publicpartialclassadmin : System.Web.UI.MasterPage
{
protectedvoid Page_Load(object sender, EventArgs e)
{
LblWelcome.Text = "Welcome " + Session["username"].ToString();
}
}

36

AdminHome.aspx
using
using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
System.Data.SqlClient;
System.IO;
System.Net;
System.Net.Mail;

publicpartialclassAdminHome : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=E:\\Code\\App_Data\\DataLeak.mdf;Integra
ted Security=True;Connect Timeout=30;User Instance=True");
SqlCommand cmd;
SqlDataAdapter da = newSqlDataAdapter();
DataSet ds = newDataSet();
HttpPostedFile myFile;
int nFileLen;
string user;
int num;
string filelen, datetime;
byte[] fileData;
protectedvoid Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
user=DropDownList1.SelectedItem.ToString();
}
da = newSqlDataAdapter("select userid from register", con);
da.Fill(ds);
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataTextField = "userid";
DropDownList1.DataValueField = "userid";
DropDownList1.DataBind();

}
publicvoid sendmail()
{
SmtpClient client=newSmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;

37

string loginname,pass;
loginname="projectcodeddd@gmail.com";
pass="datadrift";
//' setup Smtp authentication
System.Net.NetworkCredential credentials =new
System.Net.NetworkCredential(loginname,pass );
client.UseDefaultCredentials = false;
client.Credentials = credentials;
MailMessage msg=newMailMessage();
String frm, toadrs, body;
frm = loginname;
toadrs = Session["EmailId"].ToString();
body = "Filename : "+ Session["filename"].ToString()+"\n Date :
"+Session["date"].ToString() +"\n Sec key : "+ Session["seckey"].ToString();
msg.From = newMailAddress(frm);
msg.To.Add(newMailAddress(toadrs));
msg.Subject = Session["filename"].ToString();
msg.Body = body;
string res;
try
{
client.Send(msg);
res = "Your message has been successfully sent";
Response.Write(res);
}
catch (Exception ex)
{
res = "Error occured while sending your message." +
ex.Message.ToString();
Response.Write(res);
}
}
privatevoid MailAddress(string frm)
{
thrownewException("The method or operation is not implemented.");
}
protectedvoid Button2_Click(object sender, EventArgs e)
{
drift();
newEnsemble();
Session["seckey"] = num;
Session["filename"] = FileUpload1.FileName.ToString();
Session["date"] = datetime;
Response.Write("<script>alert('File Uploaded')</script>");
selectEmailID();
sendmail();
File.Delete(Server.MapPath("~/Files/") + FileUpload1.FileName);
}

38

publicvoid filebyte()
{
string filePath = "";
string connectionString = "";
FileStream stream = newFileStream(filePath, FileMode.Open, FileAccess.Read);
BinaryReader reader = newBinaryReader(stream);
byte[] file = reader.ReadBytes((int)stream.Length);
reader.Close();
stream.Close();
SqlCommand command;
SqlConnection connection = newSqlConnection(connectionString);
command = newSqlCommand("INSERT INTO FileTable (File)
Values(@File)", connection);
command.Parameters.Add("@File", SqlDbType.Binary,
file.Length).Value = file;
connection.Open();
command.ExecuteNonQuery();
}
publicvoid drift()
{
Random ds = newRandom();
num = ds.Next(1000);
FileUpload1.SaveAs(Server.MapPath("~/Files/") + FileUpload1.FileName);
myFile = FileUpload1.PostedFile;
nFileLen = FileUpload1.PostedFile.ContentLength;
filelen = nFileLen.ToString() + " kb";
FileStream objFileStream = newFileStream(Server.MapPath("~/Files/") +
FileUpload1.FileName, FileMode.Open, FileAccess.Read);
BinaryReader reader = newBinaryReader(objFileStream);
byte[] file = reader.ReadBytes((int)objFileStream.Length);
reader.Close();
objFileStream.Close();
fileData = newbyte[1024];
HttpPostedFile filePosted = FileUpload1.PostedFile;
//HttpPostedFile file = Request.Files[fileTagName];
if (filePosted.ContentLength > 0)
{
// Due to the limit of the max for a int type, the largest file can be
// uploaded is 2147483647, which is very large anyway.
int size = filePosted.ContentLength;
string name = filePosted.FileName;
int position = name.LastIndexOf("\\");
name = name.Substring(position + 1);
string contentType = filePosted.ContentType;
fileData = newbyte[size];
filePosted.InputStream.Read(fileData, 0, size);
}
}
publicvoid newEnsemble()
{
datetime = System.DateTime.Now.ToString();

39

con.Open();
cmd = newSqlCommand("insert into FilesDetails
(username,filename,subject,date,filetype,filesize,filedata,seckey)
values(@username,@filename,@subject,@date,@filetype,@filesize,@filedata,@secke
y)", con);
cmd.Parameters.Add("@username", SqlDbType.VarChar).Value = user;
cmd.Parameters.Add("@filename", SqlDbType.VarChar).Value =
FileUpload1.FileName.ToString();
cmd.Parameters.Add("@subject", SqlDbType.VarChar).Value =
TxtSubj.Text;
cmd.Parameters.Add("@date", SqlDbType.VarChar).Value = datetime;
cmd.Parameters.Add("@filetype", SqlDbType.VarChar).Value =
FileUpload1.PostedFile.ContentType;
cmd.Parameters.Add("@filesize", SqlDbType.VarChar).Value = filelen;
cmd.Parameters.Add("@filedata", SqlDbType.Binary).Value = fileData;
cmd.Parameters.Add("@seckey", SqlDbType.VarChar).Value = num;
cmd.ExecuteNonQuery();
con.Close();
}
publicvoid selectEmailID()
{
SqlDataReader dr;
con.Open();
cmd = newSqlCommand("select emailid from register where userid='" +
user + "'", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["EmailId"] = dr[0].ToString();
}
con.Close();
}
}
MyAccount.aspx
<
%@PageLanguage="C#"MasterPageFile="~/user.master"AutoEventWireup="true"CodeFil
e="MyAccount.aspx.cs"Inherits="MyAccount"Title="Untitled Page"%>
<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Serv
er">
<asp:DetailsViewID="DetailsView1"runat="server"AutoGenerateRows="False"CellPad
ding="4"
DataSourceID="SqlDataSource1"ForeColor="#333333"GridLines="None"Height="50px"
Style="z-index: 100; left: 235px; position: absolute; top:
141px"Width="125px">
<FooterStyleBackColor="#507CD1"Font-Bold="True"ForeColor="White"/>
<CommandRowStyleBackColor="#D1DDF1"Font-Bold="True"/>
<EditRowStyleBackColor="#2461BF"/>
<RowStyleBackColor="#EFF3FB"/>
<PagerStyleBackColor="#2461BF"ForeColor="White"HorizontalAlign="Center"/>
<Fields>
<asp:BoundFieldDataField="id"HeaderText="id"SortExpression="id"/>
<asp:BoundFieldDataField="name"HeaderText="name"SortExpression="name"/>

40

<asp:BoundFieldDataField="userid"HeaderText="userid"SortExpression="userid"/>
<asp:BoundFieldDataField="emailid"HeaderText="emailid"SortExpression="emailid"
/>
<asp:BoundFieldDataField="password"HeaderText="password"SortExpression="passwo
rd"/>
</Fields>
<FieldHeaderStyleBackColor="#DEE8F5"Font-Bold="True"/>
<HeaderStyleBackColor="#507CD1"Font-Bold="True"ForeColor="White"/>
<AlternatingRowStyleBackColor="White"/>
</asp:DetailsView>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$
ConnectionStrings:DataLeakConnectionString12 %>"
SelectCommand="SELECT [id], [name], [userid], [emailid] ,[password] FROM
[register] WHERE ([userid] = @userid)">
<SelectParameters>
<asp:SessionParameterName="userid"SessionField="username"Type="String"/>
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>
Seckey.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Net.Mail;
publicpartialclassSeckey : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=E:\\Code\\App_Data\\DataLeak.mdf;Integra
ted Security=True;Connect Timeout=30;User Instance=True");
SqlCommand cmd;
SqlDataReader dr;
protectedvoid Page_Load(object sender, EventArgs e)
{
//Label1.Text= Session["key"].ToString();
}
publicvoid sendmail()
{
SmtpClient client=newSmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
string loginname,pass;
loginname="projectcodeddd@gmail.com";

41

pass="datadrift";
//' setup Smtp authentication
System.Net.NetworkCredential credentials =new
System.Net.NetworkCredential(loginname,pass );
client.UseDefaultCredentials = false;
client.Credentials = credentials;
MailMessage msg=newMailMessage();
String frm, toadrs, body;
frm = loginname;
toadrs = Session["EmailId"].ToString();
body= "The File :"+ Session["fname"].ToString()+" was try to Leaked by
"+Session["username"].ToString()+" at "+ Session["date"].ToString();
msg.From = newMailAddress(frm);
msg.To.Add(newMailAddress(toadrs));
msg.Subject = Session["fname"].ToString()+" Leaked";
msg.Body = body;
string res;
try
{
client.Send(msg);
res = "Your message has been successfully sent";
//Response.Write(res);
}
catch (Exception ex)
{
res = "Error occured while sending your message." +
ex.Message.ToString();
Response.Write(res);
}
}
privatevoid MailAddress(string frm)
{
thrownewException("The method or operation is not implemented.");
}
publicvoid OnlineBaseLearning()
{
con.Open();
cmd = newSqlCommand("select FileName,seckey from FilesDetails where
Date='" + Session["Date"].ToString() + "'", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["fname"] = dr[0].ToString();
Session["key"] = dr[1].ToString();
}
con.Close();
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
OnlineBaseLearning();

42

if (Session["key"].ToString().Equals(TextBox1.Text))
{
ensemble();
}
else
{
DetectDrift();
sendmail();
}
}
publicint getid()
{
int x=0;
con.Open();
cmd = newSqlCommand("select max(id) from LeakFiles", con);
dr = cmd.ExecuteReader();
if (dr.Read())
x = int.Parse(dr[0].ToString());
con.Close();
return x;
}
protectedvoid TextBox1_TextChanged(object sender, EventArgs e)
{
}
publicvoid ensemble()
{
DataTable fileList = newDataTable();
SqlDataAdapter adapter = newSqlDataAdapter("SELECT FileName,FileType,FileData
FROM FilesDetails where secKey='" + TextBox1.Text + "'", con);
adapter.Fill(fileList);
DataRow row = fileList.Rows[0];
string name = (string)row["FileName"];
string contentType = (string)row["FileType"];
Byte[] data = (Byte[])row["FileData"];
// Send the file to the browser
Response.AddHeader("Content-type", contentType);
Response.AddHeader("Content-Disposition", "attachment; filename="
+ name);
Response.BinaryWrite(data);
Response.Flush();
Response.End();
}
publicvoid DetectDrift()
{
int n = 0;
Response.Write("<script>alert('Data Sec Key Error')</script>");
con.Close();
n = getid();
n++;
string datetime = System.DateTime.Now.ToString();
Session["Date"] = datetime;

43

con.Open();
cmd = newSqlCommand("insert into LeakFiles values(" + n + ",'" +
Session["username"].ToString() + "','" + Session["fname"] + "','" + datetime +
"')", con);
cmd.ExecuteNonQuery();
con.Close();
con.Open();
cmd = newSqlCommand("select emailid from login", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["EmailId"] = dr[0].ToString();
}
con.Close();
}

UserHome.aspx
using
using
using
using
using
using
using
using
using
using
using

System;
System.Data;
System.Configuration;
System.Collections;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Web.UI.HtmlControls;
System.Data.SqlClient;

publicpartialclassUserHome : System.Web.UI.Page
{
SqlDataAdapter da;
DataTable dt = newDataTable();
protectedvoid Page_Load(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=E:\\Code\\App_Data\\DataLeak.mdf;Integra
ted Security=True;Connect Timeout=30;User Instance=True");
da = newSqlDataAdapter("SELECT FileName, Subject, Date FROM
FilesDetails WHERE username ='"+ Session["username"].ToString()+"' ", con);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protectedvoid GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
bagging();
Response.Redirect("ViewFile.aspx");
}
publicvoid bagging()
{
GridViewRow row = GridView1.SelectedRow;

44

Session["Date"] = row.Cells[3].Text;

}
ViewFile.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
publicpartialclassViewFile : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=E:\\Code\\App_Data\\DataLeak.mdf;Integra
ted Security=True;Connect Timeout=30;User Instance=True");
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Seckey.aspx");
}
protectedvoid SqlDataSource1_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
}
}

DataLeaker.aspx
<
%@PageLanguage="C#"MasterPageFile="~/admin.master"AutoEventWireup="true"CodeFi
le="LeakFiles.aspx.cs"Inherits="LeakFiles"Title="Untitled Page"%>
<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Serv
er">
<tablealign="center">
<tr>
<tdstyle="height: 207px">
<asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"CellPaddin
g="4"DataSourceID="SqlDataSource1"ForeColor="#333333"GridLines="None">
<FooterStyleBackColor="#507CD1"Font-Bold="True"ForeColor="White"/>

45

<Columns>
<asp:BoundFieldDataField="id"HeaderText="id"SortExpression="id"/>
<asp:BoundFieldDataField="username"HeaderText="username"SortExpression="userna
me"/>
<asp:BoundFieldDataField="filename"HeaderText="filename"SortExpression="filena
me"/>
<asp:BoundFieldDataField="datetime"HeaderText="datetime"SortExpression="dateti
me"/>
</Columns>
<RowStyleBackColor="#EFF3FB"/>
<EditRowStyleBackColor="#2461BF"/>
<SelectedRowStyleBackColor="#D1DDF1"Font-Bold="True"ForeColor="#333333"/>
<PagerStyleBackColor="#2461BF"ForeColor="White"HorizontalAlign="Center"/>
<HeaderStyleBackColor="#507CD1"Font-Bold="True"ForeColor="White"/>
<AlternatingRowStyleBackColor="White"/>
</asp:GridView>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$
ConnectionStrings:DataLeakConnectionString6 %>"
SelectCommand="SELECT * FROM [LeakFiles]"ProviderName="<%$
ConnectionStrings:DataLeakConnectionString6.ProviderName
%>"></asp:SqlDataSource>
</td>
</tr>
</table>
</asp:Content>

8.2 SNAP SHOT


Login

46

Admin Page

View Files

47

Leak Files

Data Leakers

48

New Account for User

User Registered

49

User Page

Received Files
50

My Account

51

Admin Should Choose the File to sent User

File Uploaded :

Returns to Admin Home Page

Received files are downloaded


52

After Using Download Buttton its shows

Secret key are sent to users gmail

53

54

55

56

Das könnte Ihnen auch gefallen