This research presents a simulation focusing on the integration of a dynamic and robust cybersecurity framework into a manufacturing execution system (MES). MES systems use IoT and IIoT technologies to collect real-time data from sensors and connected devices on machines. This integration enables the simple achievement of remote monitoring, optimization of manufacturing processes, predictive analytics, and enhanced visibility. There are many protocols that MES systems can connect to, such as RS232, IPV4, IPV6, PROFIBUS, and MODBUS. They can also connect to programmable logic controllers, supervisory control, data acquisition systems, and distributed control systems. Using these systems in networks and corporate networks can lead to vulnerabilities in cyber security. This research proposes that simple processes and mathematical models can enhance cyber security, despite the existence of various procedures. We propose mathematical models that establish functional relationships to forecast computer behavior, enhance performance, and underscore the crucial role of standardized communication protocols. We develop and investigate a mathematical model. We develop and investigate a mathematical model that takes into account the presence of various security devices, including firewall configurations, encryption systems, and access control systems. We design and propose a mathematical model and a dynamic system dynamics equation that align with the real-time conditions of the MES. This dynamic system dynamics equation figures out a security metric that is weighed by certain parameters. When the base threshold is passed, the transaction deletion logic is set off, revealing the proactive event for security breaches. This research suggests designing and exploring MES automation with the goal of ensuring seamless service, implementing cyber security response mechanisms swiftly, and minimizing response time.