Fbot | A Chat bot that teaches Security

Fbot | A Chat bot that teaches Security


I have been reading a lot about Chat bots and how they are the next big thing. Each day, there are articles about how chatbots can be of huge advantage to a lot of companies. For the past couple of days, I have been thinking of some ideas where we can apply machine learning, data science and hacking together to build a cool thing. The outcome is described in this post.

Fbot | A Chat bot that utilizes Machine Learning and Data Science to teach stuff about Hacking and Security

Data Collection:

Lets start. The first part as usual was collecting data. To be honest, I did not have enough data and I am hoping that someone else will make this tool even better. This is just a presentation of the idea and a little demo.

The data was collected from the public dataset of security.stackexchange.com available on the internet. I pruned the data to have only those questions which have any accepted answers. There were around 15,000 such questions. The data is given on the github link.

Chat bot:

The chatbot is retrieval based since generative chatbots are still an active area of research. Moreover, giving long answers is not possible even with generative chatbots, so I had to go with retrieval based methods.

How it Works?

The bot keeps a database of questions, question descriptions and answers. When a user types a question, it semantically matches whether the question or a related question is present in its database. If it is, it shows you the accepted answer of the question. It only shows you the answer if user’s question matches more than 70% to the original question in the database.


Lets stop talking and get into the code.

Lets import the data.

Now, lets store the questions and answers respectively in their lists.

All we have to do now is make a while loop and keep asking questions.

That’s it. We have our chatbot. See? Such little code.

NOTE: This was just an idea presented to you. Don’t go very hard on me for its accuracy. The chatbot is not very accurate because I did not have much data. Though, it gives some good answers like those given in the main image of this webpage, “Can a neural network crack hashes?”, “What is sql injection”, “What is cross site scripting” etc. The semantic similarity can also be improved much using hacking ontology. I hope someone improves it and works on it further but this could be a great thing. Given enough data, this can come out to be an amazing project for people who want to know stuff about hacking and security.

Your comments are most welcome. I hope everyone likes the post.

The github link is: https://github.com/faizann24/fbot-bot-that-teaches-hacking-and-security/



Add yours

+ Leave a Comment