<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: anoshay ambar</title>
    <description>The latest articles on DEV Community by anoshay ambar (@anoshay_ambar).</description>
    <link>https://dev.to/anoshay_ambar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4196797%2Fa0201096-ec0b-41ea-ac52-46400bd6f4f9.png</url>
      <title>DEV Community: anoshay ambar</title>
      <link>https://dev.to/anoshay_ambar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anoshay_ambar"/>
    <language>en</language>
    <item>
      <title>Building a Ransomware Detection System with Blockchain Logging</title>
      <dc:creator>anoshay ambar</dc:creator>
      <pubDate>Tue, 20 Oct 2026 20:15:15 +0000</pubDate>
      <link>https://dev.to/anoshay_ambar/building-a-ransomware-detection-system-with-blockchain-logging-13ep</link>
      <guid>https://dev.to/anoshay_ambar/building-a-ransomware-detection-system-with-blockchain-logging-13ep</guid>
      <description>&lt;h1&gt;
  
  
  Developing Ransomware Detection System Using Blockchain Logging - My FYP Project
&lt;/h1&gt;

&lt;p&gt;Being a Computer Science student from COMSATS University Islamabad, I always wanted my final year project to address a practical issue. We thought of developing a system that detects ransomware as well as maintains the logs using blockchain.&lt;/p&gt;

&lt;p&gt;Here’s how I developed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❌The Problem
&lt;/h2&gt;

&lt;p&gt;A common drawback of traditional anti-virus systems is that their functionality is based on the signature which can be bypassed by the ransomware very easily. In addition, after attacking any system, attackers can remove/delete/modify the system logs.&lt;/p&gt;

&lt;p&gt;So, our project was about solving these two issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detect ransomware behavior using Machine Learning&lt;/li&gt;
&lt;li&gt;Ensure that the logging is secure and tamper proof&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🔧Tech Stack Used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; Flutter&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Python Flask/FastAPI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; SQLite&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine Learning Model:&lt;/strong&gt; Random Forest Classifier&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blockchain Logging:&lt;/strong&gt; Custom blockchain based on SHA-256 hashing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API:&lt;/strong&gt; REST APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🏗️ How It Works - Architecture
&lt;/h2&gt;

&lt;p&gt;It is pretty straightforward yet highly effective:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Data Collection &amp;amp; Feature Extraction:&lt;/strong&gt;&lt;br&gt;
We analyze activity in the file system such as fast file encryption, extension change (.encrypted, .locked), entropy, etc., and also suspicious API calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. ML Detection (Random Forest):&lt;/strong&gt;&lt;br&gt;
Random Forest machine learning was trained based on two classes – benign programs and ransomware. This particular algorithm was chosen because its accuracy equals 95%, has a few false positives and works fine with tabular data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Alerting System:&lt;/strong&gt;&lt;br&gt;
In case ransomware was detected the following actions are taken:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The process is stopped.&lt;/li&gt;
&lt;li&gt;Alert is delivered to the Flutter application.&lt;/li&gt;
&lt;li&gt;Log is created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Blockchain Logging:&lt;/strong&gt;&lt;br&gt;
This is the best part. In contrast to storing logs in the common database we use hashing of the log files with SHA-256 algorithm with linking to the previous log's hash.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Block = { data, timestamp, previous_hash, current_hash }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Any attempt to change the previous block will cause breaking the hash chain. Hence, logs are immutable.&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 A Quick Code Snippet (Blockchain Log)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import hashlib
import time

def generate_hash(message, previousHash):
    block_string = f"{message}{time.time()}{previousHash}"
    return hashlib.sha256(block_string.encode()).hexdigest()

# Generating a safe log
log_message = "Ransomware detected: PID 4042"
previous_hash = "0000abc..."
safe_hash = generate_hash(log_message, previous_hash)
print(f"Safe Log: {safe_hash}")

🎯 Achievements 
1.Accuracy in Detection: ≈94-96% on test data
2.Alerting Real-time alerts within &amp;lt;2 secs
3.Logs are completely tamper proof and are verifiable


Challenges | Faced
1.Finding a pure dataset of ransomware behavior was difficult.
2.Find a balance between false positives and alerts.
3.To make blockchain lightweight to not affect performance.

Conclusion
Through this project, I have realized that Cybersecurity is not only about coding but about thinking like a hacker as well. The combination of AI + Blockchain provided me with a different viewpoint.

If you are working on a similar Final Year Project or looking for the GitHub Code, then let’s connect!

*About the Author*

My name is Anoshay Ambar. I have graduated in Computer Science from COMSATS University Islamabad. I love cybersecurity, AI, and health tech.

Let’s get connected through: [LinkedIn](https://www.linkedin.com/in/anoshay-ambar-174011397) | Email: anoshayambar@gmail.com



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>blockchain</category>
      <category>cybersecurity</category>
    </item>
  </channel>
</rss>
