This Final Dissertation focuses on detecting through a Machine Learning algorithm when a Deny of Service (DoS) or Distributed Deny of Service (DDoS) attack is taking place. Between all the possibilities we have chosen the random forest algorithm, due to its great performance and simplicity.