Skip to content

Commit 70178da

Browse files
Add files via upload
1 parent 9ee1e8d commit 70178da

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

databreachanalysistester.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
with open("C:/Users/DFRob/data_breach.txt", "r") as breaches:
2+
#print(breaches.read(250))
3+
lineList = breaches.readlines()
4+
5+
print(lineList)
6+
7+
#create a counter to keep track of how many data breaches per organization type
8+
#HealthCare, Financial, and Government records are found
9+
HealthCare = 0
10+
Financial = 0
11+
Government = 0
12+
13+
14+
#below we are determining which type of organiztion has had the most data breaches
15+
#for line in lineList[1:]:
16+
#print(line)
17+
#cleanLine = line.strip()
18+
#breachesValues = cleanLine.split(',')
19+
#print(breachesValues)
20+
#if breachesValues[4] == "healthcare":
21+
#HealthCare += 1
22+
#elif breachesValues[4] == "financial":
23+
#Financial += 1
24+
#else:
25+
#breachesValues[4] == "government"
26+
#Government += 1
27+
#print("Health Care Organizations had", HealthCare, "data leaks,"
28+
#"Financial Organizations had", Financial, "data leaks,"
29+
#"Governmental Orginzations had", Government, "data leaks.")
30+
31+
#Once we have ran the above code you will know which one has the most data breaches which should be Goverment Organizations
32+
# From there we will determine the most comomn method of data breachs in Government Organizations
33+
#create a counter to keep track of the occurence of methods per data breach
34+
Hacked= 0
35+
Poor_Security= 0
36+
Lost_Stolen_Media= 0
37+
Accidential_Publish= 0
38+
Inside_Job= 0
39+
40+
41+
#we will know set up code to ensure it is only analyzing government organizations by adding an and statement
42+
43+
for line in lineList[1:]:
44+
print(line)
45+
cleanLine = line.strip()
46+
breachesValues = cleanLine.split(',')
47+
print(breachesValues)
48+
if breachesValues[4] == "government":
49+
if breachesValues[5] == "hacked":
50+
Hacked += 1
51+
if breachesValues[5] == "poor security":
52+
Poor_Security += 1
53+
if breachesValues[5] == "lost / stolen media":
54+
Lost_Stolen_Media += 1
55+
if breachesValues[5] == "accidentally published":
56+
Accidential_Publish += 1
57+
else:
58+
if breachesValues[5] == "inside job":
59+
Inside_Job += 1
60+
61+
print("Goverment Organizations had", Hacked, "data leaks due to hacking", Poor_Security, "data leaks due to poor security",
62+
Lost_Stolen_Media, "data leaks due to lost and stolen media, ", Accidential_Publish, "data leaks due to accidential publishing and,",
63+
Inside_Job, "data leaks due to inside jobs.")
64+
65+
with open("C:/Users/DFRob/data_breach.txt", "w") as report:
66+
report.write(str(len(lineList)-1) + "total data breach cases reviewed")
67+
report.write("\n Government Organizations had the most data breaches with a total of"+str(Government) +
68+
"\n Of all of methods of data breaching, inside jobs were the most common method with a total of"+str(Inside_Job))
69+

0 commit comments

Comments
 (0)