Abstract
Ransomware remains one of the most disruptive forms of malware; it blocks access to important data and demands a ransom payment for decryption. This is highly disruptive and results in victims losing access to their data while also being pressured into paying the ransom. Attackers usually demand ransom to be paid using cryptocurrency; many cybersecurity professionals advise victims against this, as there is no actual guarantee of decryption. Ransomware attacks can also be a distraction to an even more disruptive and calculated attack, therefore making their early-stage detection crucial. Our study proposes a static machine-learning approach for detecting ransomware in Windows PE32 files. This method uses API call sequences and opcode information extracted from a dataset of 440 ransomware and 498 benign PE32 executables. Both feature sets were extracted from disassembled files and processed with TF-IDF n-gram encoding. They were further trained using separate Random Forest models. Their outputs were combined through a weighted ensemble to improve reliability. On a stratified test set, the ensemble reached an accuracy of 95%, this indicates that both feature sets used together show better performance than using API or opcode features alone. In addition to classification, the system includes a component that generates text-based mitigation guidance using a large language model. The results proved that combining static analysis with ensemble learning provides an effective and more practical approach for early ransomware detection and response.