Mirai is a type of malware that creates a botnet of internet-connected devices, which can later be used to infect other devices or servers. This paper aims to analyze and explain the Mirai code and create a low-cost simulation environment to aid in the dynamic analysis of Mirai. Further, we perform controlled Denial-of-Service attacks while measuring resource consumption on resource-constrained compromised and victim Internet-of-Things (IoT) devices, such as energy consumption, CPU utilization, memory utilization, Ethernet input/output performance, and Secure Digital card usage. The experimental setup shows that when a compromised device sends a User Datagram Protocol (UDP) flood, it consumes 38.44% more energy than its regular usage. In the case of Secure Digital usage, the victim, when flooded with Transmission Control Protocol (TCP) messages, uses 64.6% more storage for reading and 55.45% more for writing. The significant extra resource consumption caused by Mirai attacks on resource-constrained IoT devices can severely threaten such devices' wide adoption and raises great challenges for the security designs in the resource-constrained IoT environment.