From 7b836dff04bea4dd7748a44a061d1bd04044c2b3 Mon Sep 17 00:00:00 2001 From: Miguel Tuñón Date: Thu, 22 Dec 2016 17:23:51 +0100 Subject: [PATCH] Checked report rmd file and added new Roxygen documentation --- ISO27001effectiveness/Main.R | 2 ++ ISO27001effectiveness/NAMESPACE | 1 + ISO27001effectiveness/R/ReportGraphs.R | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ISO27001effectiveness/R/graphs.R | 118 ---------------------------------------------------------------------------------------------------------------------- ISO27001effectiveness/Report.Rmd | 11 +++++------ ISO27001effectiveness/Report.html | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ISO27001effectiveness/man/GetReportGraphs.Rd | 20 ++++++++++++++++++++ 7 files changed, 417 insertions(+), 124 deletions(-) create mode 100644 ISO27001effectiveness/R/ReportGraphs.R delete mode 100644 ISO27001effectiveness/R/graphs.R create mode 100644 ISO27001effectiveness/Report.html create mode 100644 ISO27001effectiveness/man/GetReportGraphs.Rd diff --git a/ISO27001effectiveness/Main.R b/ISO27001effectiveness/Main.R index cdf48b8..17d59cc 100644 --- a/ISO27001effectiveness/Main.R +++ b/ISO27001effectiveness/Main.R @@ -4,3 +4,5 @@ Sites_PerCountry <- ISO27001effectiveness::GetISOSurveySitesPerCountry() Cert_PerSector <- ISO27001effectiveness::GetISOSurveyCertsPerSector() Attacks <- ISO27001effectiveness::GetDefaultAttacksData() + +graphs <- ISO27001effectiveness::GetReportGraphs(Cert_PerCountry,Attacks) diff --git a/ISO27001effectiveness/NAMESPACE b/ISO27001effectiveness/NAMESPACE index 165f84c..ad59655 100644 --- a/ISO27001effectiveness/NAMESPACE +++ b/ISO27001effectiveness/NAMESPACE @@ -4,6 +4,7 @@ export(GetDefaultAttacksData) export(GetISOSurveyCertsPerCountry) export(GetISOSurveyCertsPerSector) export(GetISOSurveySitesPerCountry) +export(GetReportGraphs) export(ParseHMExcel) export(ParseHMFolder) export(ProccesISOSurveyByCountryRaw) diff --git a/ISO27001effectiveness/R/ReportGraphs.R b/ISO27001effectiveness/R/ReportGraphs.R new file mode 100644 index 0000000..2caab8a --- /dev/null +++ b/ISO27001effectiveness/R/ReportGraphs.R @@ -0,0 +1,125 @@ +#' Return every graph used in the report file +#' +#' @param Cert_PerCountry data.frame with the processed data of ISO 27001 certifications +#' @param Attacks data.frame with the processed data of cyberattacks +#' +#' @return data.frame +#' @export +GetReportGraphs <- function(Cert_PerCountry,Attacks) { + #2012 + graph1 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2012)", + x = reorder(country_short,X2012), + y = X2012, + xlab = "Country", + ylab = "Number of certifications", + data = Cert_PerCountry[Cert_PerCountry$X2012 > mean(Cert_PerCountry$X2012),]) + attacks2k12 <- Attacks[Attacks$Date < "2013-01-01" & Attacks$Date >= "2012-01-01",] + frameAttacks2k12 <- as.data.frame(table(attacks2k12$Country)) + colnames(frameAttacks2k12) <- c("Country","Attacks") + graph2 <- ggplot2::qplot(main = "Countries with above average number of cyberattacks (2012)", + x = reorder(Country,Attacks), + y = Attacks, + xlab = "Country", + ylab = "Number of attacks", + data = frameAttacks2k12[frameAttacks2k12$Attacks > mean(frameAttacks2k12$Attacks),]) + + Attacks2012ByMonth <- mutate(attacks2k12, month = format(attacks2k12$Date, "%m")) %>% group_by(month) + Attack2012FreqByMonth <- as.data.frame(table(Attacks2012ByMonth$month)) + colnames(Attack2012FreqByMonth) <- c("Month", "Attacks") + graph3 <- ggplot2::qplot(x = as.numeric(Month), + y = Attacks, + main = "Global cyberattack progression by month (2012)", + data = Attack2012FreqByMonth, + geom = c("point", "smooth"), + xlim = c(1,12), + xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) + + #2013 + graph4 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2013)", + x = reorder(country_short,X2013), + y = X2013, + xlab = "Country", + ylab = "Number of certifications", + data = Cert_PerCountry[Cert_PerCountry$X2013 > mean(Cert_PerCountry$X2013),]) + attacks2k13 <- Attacks[Attacks$Date < "2014-01-01" & Attacks$Date >= "2013-01-01",] + frameAttacks2k13 <- as.data.frame(table(attacks2k13$Country)) + colnames(frameAttacks2k13) <- c("Country","Attacks") + graph5 <- ggplot2::qplot(main = "Countries with above average number of cyberattacks (2013)", + x = reorder(Country,Attacks), + y = Attacks, + xlab = "Country", + ylab = "Number of attacks", + data = frameAttacks2k13[frameAttacks2k13$Attacks > mean(frameAttacks2k13$Attacks),]) + + Attacks2013ByMonth <- mutate(attacks2k13, month = format(attacks2k13$Date, "%m")) %>% group_by(month) + Attack2013FreqByMonth <- as.data.frame(table(Attacks2013ByMonth$month)) + colnames(Attack2013FreqByMonth) <- c("Month", "Attacks") + graph6 <- ggplot2::qplot(x = as.numeric(Month), + y = Attacks, + main = "Global cyberattack progression by month (2013)", + data = Attack2013FreqByMonth, + geom = c("point", "smooth"), + xlim = c(1,12), + xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) + + #2014 + graph7 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2014)", + x = reorder(country_short,X2014), + y = X2014, + xlab = "Country", + ylab = "Number of certifications", + data = Cert_PerCountry[Cert_PerCountry$X2014 > mean(Cert_PerCountry$X2014),]) + attacks2k14 <- Attacks[Attacks$Date < "2015-01-01" & Attacks$Date >= "2014-01-01",] + frameAttacks2k14 <- as.data.frame(table(attacks2k14$Country)) + colnames(frameAttacks2k14) <- c("Country","Attacks") + graph8 <- ggplot2::qplot(main = "Countries with above average number of cyberattacks (2014)", + x = reorder(Country,Attacks), + y = Attacks, + xlab = "Country", + ylab = "Number of attacks", + data = frameAttacks2k14[frameAttacks2k14$Attacks > mean(frameAttacks2k14$Attacks),]) + + Attacks2014ByMonth <- mutate(attacks2k14, month = format(attacks2k14$Date, "%m")) %>% group_by(month) + Attack2014FreqByMonth <- as.data.frame(table(Attacks2014ByMonth$month)) + colnames(Attack2014FreqByMonth) <- c("Month", "Attacks") + graph9 <- ggplot2::qplot(x = as.numeric(Month), + y = Attacks, + main = "Global cyberattack progression by month (2014)", + data = Attack2014FreqByMonth, + geom = c("point", "smooth"), + xlim = c(1,12), + xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) + + #2015 + graph10 <- ggplot2::qplot(main = "Countries with above average number of companies certified with ISO 27001 (2015)", + x = reorder(country_short,X2015), + y = X2015, + xlab = "Country", + ylab = "Number of certifications", + data = Cert_PerCountry[Cert_PerCountry$X2015 > mean(Cert_PerCountry$X2015),]) + attacks2k15 <- Attacks[Attacks$Date < "2016-01-01" & Attacks$Date >= "2015-01-01",] + frameAttacks2k15 <- as.data.frame(table(attacks2k15$Country)) + colnames(frameAttacks2k15) <- c("Country","Attacks") + graph11 <- ggplot2::qplot(main = "Countries with above average number of cyberattacks (2015)", + x = reorder(Country,Attacks), + y = Attacks, + xlab = "Country", + ylab = "Number of attacks", + data = frameAttacks2k15[frameAttacks2k15$Attacks > mean(frameAttacks2k15$Attacks),]) + + Attacks2015ByMonth <- mutate(attacks2k15, month = format(attacks2k15$Date, "%m")) %>% group_by(month) + Attack2015FreqByMonth <- as.data.frame(table(Attacks2015ByMonth$month)) + colnames(Attack2015FreqByMonth) <- c("Month", "Attacks") + graph12 <- ggplot2::qplot(x = as.numeric(Month), + y = Attacks, + main = "Global cyberattack progression by month (2015)", + data = Attack2015FreqByMonth, + geom = c("point", "smooth"), + xlim = c(1,12), + xlab = "Month") + ggplot2::scale_x_continuous(breaks = 1:12) + + + + + list(graph1,graph2,graph3,graph4,graph5,graph6,graph7,graph8,graph9,graph10,graph11,graph12) +} diff --git a/ISO27001effectiveness/R/graphs.R b/ISO27001effectiveness/R/graphs.R deleted file mode 100644 index 97734f9..0000000 --- a/ISO27001effectiveness/R/graphs.R +++ /dev/null @@ -1,118 +0,0 @@ -GetGraphs <- function(Cert_PerCountry,Attacks) { - #2012 - graph1 <- qplot(main = "Countries with above average number of companies certified with ISO 27001 (2012)", - x = reorder(country_short,X2012), - y = X2012, - xlab="Country", - ylab="Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2012 > mean(Cert_PerCountry$X2012),]) - attacks2k12 <- Attacks[Attacks$Date < "2013-01-01" & Attacks$Date >= "2012-01-01",] - frameAttacks2k12 <- as.data.frame(table(attacks2k12$Country)) - colnames(frameAttacks2k12) <- c("Country","Attacks") - graph2 <- qplot(main = "Countries with above average number of cyberattacks (2012)", - x = reorder(Country,Attacks), - y = Attacks, - xlab="Country", - ylab="Number of attacks", - data = frameAttacks2k12[frameAttacks2k12$Attacks > mean(frameAttacks2k12$Attacks),]) - - Attacks2012ByMonth <- mutate(attacks2k12, month = format(attacks2k12$Date, "%m")) %>% group_by(month) - Attack2012FreqByMonth <- as.data.frame(table(Attacks2012ByMonth$month)) - colnames(Attack2012FreqByMonth) <- c("Month", "Attacks") - graph3 <- qplot(x= as.numeric(Month), - y= Attacks, - main = "Global cyberattack progression by month (2012)", - data = Attack2012FreqByMonth, - geom = c("point", "smooth"), - xlim = c(1,12), - xlab="Month") + scale_x_continuous(breaks = 1:12) - - #2013 - graph4 <- qplot(main = "Countries with above average number of companies certified with ISO 27001 (2013)", - x = reorder(country_short,X2013), - y = X2013, - xlab="Country", - ylab="Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2013 > mean(Cert_PerCountry$X2013),]) - attacks2k13 <- Attacks[Attacks$Date < "2014-01-01" & Attacks$Date >= "2013-01-01",] - frameAttacks2k13 <- as.data.frame(table(attacks2k13$Country)) - colnames(frameAttacks2k13) <- c("Country","Attacks") - graph5 <- qplot(main = "Countries with above average number of cyberattacks (2013)", - x = reorder(Country,Attacks), - y = Attacks, - xlab="Country", - ylab="Number of attacks", - data = frameAttacks2k13[frameAttacks2k13$Attacks > mean(frameAttacks2k13$Attacks),]) - - Attacks2013ByMonth <- mutate(attacks2k13, month = format(attacks2k13$Date, "%m")) %>% group_by(month) - Attack2013FreqByMonth <- as.data.frame(table(Attacks2013ByMonth$month)) - colnames(Attack2013FreqByMonth) <- c("Month", "Attacks") - graph6 <- qplot(x= as.numeric(Month), - y= Attacks, - main = "Global cyberattack progression by month (2013)", - data = Attack2013FreqByMonth, - geom = c("point", "smooth"), - xlim = c(1,12), - xlab="Month") + scale_x_continuous(breaks = 1:12) - - #2014 - graph7 <- qplot(main = "Countries with above average number of companies certified with ISO 27001 (2014)", - x = reorder(country_short,X2014), - y = X2014, - xlab="Country", - ylab="Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2014 > mean(Cert_PerCountry$X2014),]) - attacks2k14 <- Attacks[Attacks$Date < "2015-01-01" & Attacks$Date >= "2014-01-01",] - frameAttacks2k14 <- as.data.frame(table(attacks2k14$Country)) - colnames(frameAttacks2k14) <- c("Country","Attacks") - graph8 <- qplot(main = "Countries with above average number of cyberattacks (2014)", - x = reorder(Country,Attacks), - y = Attacks, - xlab="Country", - ylab="Number of attacks", - data = frameAttacks2k14[frameAttacks2k14$Attacks > mean(frameAttacks2k14$Attacks),]) - - Attacks2014ByMonth <- mutate(attacks2k14, month = format(attacks2k14$Date, "%m")) %>% group_by(month) - Attack2014FreqByMonth <- as.data.frame(table(Attacks2014ByMonth$month)) - colnames(Attack2014FreqByMonth) <- c("Month", "Attacks") - graph9 <- qplot(x= as.numeric(Month), - y= Attacks, - main = "Global cyberattack progression by month (2014)", - data = Attack2014FreqByMonth, - geom = c("point", "smooth"), - xlim = c(1,12), - xlab="Month") + scale_x_continuous(breaks = 1:12) - - #2015 - graph10 <- qplot(main = "Countries with above average number of companies certified with ISO 27001 (2015)", - x = reorder(country_short,X2015), - y = X2015, - xlab="Country", - ylab="Number of certifications", - data = Cert_PerCountry[Cert_PerCountry$X2015 > mean(Cert_PerCountry$X2015),]) - attacks2k15 <- Attacks[Attacks$Date < "2016-01-01" & Attacks$Date >= "2015-01-01",] - frameAttacks2k15 <- as.data.frame(table(attacks2k15$Country)) - colnames(frameAttacks2k15) <- c("Country","Attacks") - graph11 <- qplot(main = "Countries with above average number of cyberattacks (2015)", - x = reorder(Country,Attacks), - y = Attacks, - xlab="Country", - ylab="Number of attacks", - data = frameAttacks2k15[frameAttacks2k15$Attacks > mean(frameAttacks2k15$Attacks),]) - - Attacks2015ByMonth <- mutate(attacks2k15, month = format(attacks2k15$Date, "%m")) %>% group_by(month) - Attack2015FreqByMonth <- as.data.frame(table(Attacks2015ByMonth$month)) - colnames(Attack2015FreqByMonth) <- c("Month", "Attacks") - graph12 <- qplot(x = as.numeric(Month), - y = Attacks, - main = "Global cyberattack progression by month (2015)", - data = Attack2015FreqByMonth, - geom = c("point", "smooth"), - xlim = c(1,12), - xlab="Month") + scale_x_continuous(breaks = 1:12) - - - - - list(graph1,graph2,graph3,graph4,graph5,graph6,graph7,graph8,graph9,graph10,graph11,graph12) -} diff --git a/ISO27001effectiveness/Report.Rmd b/ISO27001effectiveness/Report.Rmd index 75bb55a..0c7683e 100644 --- a/ISO27001effectiveness/Report.Rmd +++ b/ISO27001effectiveness/Report.Rmd @@ -5,13 +5,13 @@ output: html_document ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) +library(ISO27001effectiveness) library(xlsx) library(ggplot2) library(dplyr) +library(countrycode) -devtools::load_all(".") -source("Main.R") -graphs <- GetGraphs(Cert_PerCountry,Attacks) +source("./Main.R") ``` ## Abstract @@ -32,7 +32,7 @@ Los datos que se han recogido para este estudio son: El análisis se realizará desde 2012 hasta 2015 ## Análisis -Para minimizar los factores externos, se realizan dos tipos de análisis de los datos, contrastando los dos resultados y llegando a una conclusión si los resultados son congruentes o se halla una explación que determine las incongruencias. +Para minimizar los factores externos, se realizan dos tipos de análisis de los datos, contrastando los dos resultados y llegando a una conclusión si los resultados son congruentes o se halla una explacación que determine las incongruencias. A continuación se muestran para cada uno de los años del estudio, los países que obtuvieron de media más certificaciones y los que de media sufrieron más ataques: @@ -43,7 +43,6 @@ NOTA: Nos gustaría poner las figuras lado a lado, pero ocurría esto: Error in gList(list(list(data = list(Month = 1:12, Attacks = c(119L, 121L, : only 'grobs' allowed in "gList" -:( --> @@ -122,7 +121,7 @@ Por lo observado anteriormente, se puede concluir que: * La cantidad de ciberataques que recibe un país no se mitiga por el número de empresas que han obtenido la certificación ISO 270001 -Esto lleva a concluir que obtener la certificación ISO 27001 no es efectiva para reducir el número de ciberataques, sino que probablemente dependa de factores externos ajenos a este estudio +Esto no lleva a concluir que obtener la certificación ISO 27001 no es efectiva para reducir el número de ciberataques, sino que probablemente dependa de factores externos ajenos a este estudio ## Trabajo futuro Como trabajo futuro querríamos poder seguir en la línea de investigación acerca de los siguientes puntos: diff --git a/ISO27001effectiveness/Report.html b/ISO27001effectiveness/Report.html new file mode 100644 index 0000000..a57db60 --- /dev/null +++ b/ISO27001effectiveness/Report.html @@ -0,0 +1,264 @@ + + + + + + + + + + + + + +ISO 27001 Effectiveness + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+

Abstract

+

La creciente preocupación de muchas empresas con infraestructura IT crítica frente a ciberataques ha llevado a algunas de ellas a tomar medidas de seguridad como la creación de departamentos de Seguridad de la Información, llevar a cabo auditorías de seguridad y obtener certificaciones de seguridad entre otras.

+

El objetivo de este estudio es determinar, en la medida de lo posible, si conformar los sistemas de la empresa según la certificación ISO 27001 conlleva una merma en el número de ciberataques producidos.

+
+
+

Datos analizados

+

La primera barrera a superar en este estudio es la obtención de datos directos sobre ciberataques en empresas, ya que en muchos de los ciberataques producidos no se dan a conocer los nombres de todas las empresas a las que estos afectan. No obstante, hemos optado por obtener datos más generalizados que nos permitan hacer un análisis, si bien no por empresa sino por país o sector, de la cuestión que se plantea. Desafortunadamente, esto compromete el análisis, ya que al generalizar los datos son muchos más los efectos que alteran los resultados de los datos analizados, ya que se incluye mayor cantidad de factores externos que este estudio no cubre.

+

Los datos que se han recogido para este estudio son:

+ +

El análisis se realizará desde 2012 hasta 2015

+
+
+

Análisis

+

Para minimizar los factores externos, se realizan dos tipos de análisis de los datos, contrastando los dos resultados y llegando a una conclusión si los resultados son congruentes o se halla una explacación que determine las incongruencias.

+

A continuación se muestran para cada uno de los años del estudio, los países que obtuvieron de media más certificaciones y los que de media sufrieron más ataques:

+ +
+

2012

+
## [[1]]
+

+
## [[1]]
+

+
+
+

2013

+
## [[1]]
+

+
## [[1]]
+

+
+
+

2014

+
## [[1]]
+

+
## [[1]]
+

+
+
+

2015

+
## [[1]]
+

+
## [[1]]
+

+

De los datos mostrados se pueden hacer diferentes observaciones:

+
    +
  • De 2014 a 2015, USA pasa de tener 654 a 1247 empresas con certificación ISO 27001, sin embargo la cifra de ciberataques se mantiene constante de 383 a 386 ataques recibidos. De 2013 a 2014 por ejemplo, pasa de recibir 505 a 383 ataques pese a sólo haber pasado de 566 a 654 empresas con dicha certificación.
  • +
  • Japón tiene un número inusualmente alto de empresas con la ISO 27001, no obstante sufre una cantidad de ciberataques comparativa a la de Israel, que tiene muchas menos empresas con la certificación.
  • +
+

Ambas observaciones son de especial interés ya que ponen de relieve situaciones en las que de ser efectivo reformar los sistemas para cumplir la ISO 27001, debería poder apreciarse un efecto en la cantidad de ciberataques recibidos. En el caso de los USA, sólo podría explicarse mediante alguna de las siguientes hipótesis:

+
    +
  • Entre 2013 y 2014 se produjo un número especialmente alto de ciberataques a USA
  • +
  • Se crean más empresas de las que logran certificarse, y además, sufren ataques antes de obtenerla
  • +
+

La primera hipótesis puede ser comprobada con los datos que disponemos. A continuación se muestra una línea temporal de ciberataques globales entre los años 2012 y 2015.

+
+
+

2012

+
## [[1]]
+
## `geom_smooth()` using method = 'loess'
+

+
+
+

2013

+
## [[1]]
+
## `geom_smooth()` using method = 'loess'
+

+
+
+

2014

+
## [[1]]
+
## `geom_smooth()` using method = 'loess'
+

+
+
+

2015

+
## [[1]]
+
## `geom_smooth()` using method = 'loess'
+

+

Observamos que se produjo lo contrario, bajó el número de ciberataques.

+
+
+
+

Conclusiones

+

Por lo observado anteriormente, se puede concluir que:

+
    +
  • La cantidad de ciberataques que recibe un país no se mitiga por el número de empresas que han obtenido la certificación ISO 270001
  • +
+

Esto no lleva a concluir que obtener la certificación ISO 27001 no es efectiva para reducir el número de ciberataques, sino que probablemente dependa de factores externos ajenos a este estudio

+
+
+

Trabajo futuro

+

Como trabajo futuro querríamos poder seguir en la línea de investigación acerca de los siguientes puntos:

+
    +
  • ¿Qué factores producen un aumento o recesión en la cantidad de ciberataques recibidos?
  • +
  • ¿Qué sectores industriales reciben más ciberataques?
  • +
  • ¿Cuáles de esos sectores son los que más certificaciones obtienen?
  • +
+

Creemos que la investigación de estas cuestiones puede dar más robustez a las conclusiones expuestas en este estudio.

+
+ + + + +
+ + + + + + + + diff --git a/ISO27001effectiveness/man/GetReportGraphs.Rd b/ISO27001effectiveness/man/GetReportGraphs.Rd new file mode 100644 index 0000000..21ff52b --- /dev/null +++ b/ISO27001effectiveness/man/GetReportGraphs.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ReportGraphs.R +\name{GetReportGraphs} +\alias{GetReportGraphs} +\title{Return every graph used in the report file} +\usage{ +GetReportGraphs(Cert_PerCountry, Attacks) +} +\arguments{ +\item{Cert_PerCountry}{data.frame with the processed data of ISO 27001 certifications} + +\item{Attacks}{data.frame with the processed data of cyberattacks} +} +\value{ +data.frame +} +\description{ +Return every graph used in the report file +} + -- libgit2 0.22.2