Giter Club home page Giter Club logo

antivirus_demo's Introduction

Antivirus Demo

Overview

This project helps train a classifier to be able to detect PE files as either malicious or legitimate. It tries out 6 different classification algorithms before deciding which one to use for prediction by comparing their results. This is the code for 'Build an Antivirus in 5 Min' on Youtube.

Dependencies

  • pandas pip install pandas
  • numpy pip install numpy
  • pickle pip install pickle
  • scipy pip install scipy
  • scikit pip install -U scikit-learn

Use pip to install any missing dependencies

Basic Usage

  1. Run python learning.py to train the model. It will train on the dataset included called 'data.csv'.

  2. Once trained you can test the model via python checkpe.py YOUR_PE_FILE. It will output either malicious or legitimate!

That's it!

Credits

Credit for the vast majority of code here goes to Te-k. I've merely created a wrapper around all of the important functions to get people started.

antivirus_demo's People

Contributors

llsourcell avatar testbounty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

antivirus_demo's Issues

Syntax Error

When I run checkpe.py I get the syntax error
File "checkpe.py", line 188, in <module> data = extract_infos(args.FILE) File "checkpe.py", line 108, in extract_infos res['SectionsMeanEntropy'] = sum(entropy)/float(len(entropy)) TypeError: object of type 'map' has no len()

I am a noob, so can someone help me fix this. Oh yeah and entropy = map(lambda x:x.get_entropy(), pe.sections)

Pass Cylance's 100 test

Cylance is proud of what they call the "AV 100" test.
In order to be considered an AntiVirus, this must pass the "AV 100" test.

The test works as follows:

  1. Download 100 random samples from VT.
  2. Scan 100 samples downloaded.
  3. Detect 100 samples scanned.
  4. PROFIT.

Now, CAN YOU PASS THE AV 100 TEST?

Get into VT you leeching sc*mbag!

There are two types of "AV vendors" nowadays: One is a decent contributing to society type of company, who puts the community over greed, the other is a Leeching money-hungry scum that only cares about making profit of off the work done by decent AV firms.

Which one are you? Well right now you're the bad kind, because YOU'RE NOT IN VIRUS TOTAL.

I suggest you JOIN VIRUS TOTAL TODAY before anyone denounces you for who you seem to be.

Results are non deterministic

Is there a reason the results are non deterministic?
If I re-run the training I get different accuracy each time and therefore the detection on exe files will vary between malicious and safe randomly.

How do I get .pe file

How do I give the classifier portable executable? How do I extract .pe from a file?

Syntax errors

I am getting so much syntax errors... Most of them are no problem, but I am stuck at checkpe.py <line 187>:
It's giving me a syntax error at the 'data' variable. I don't know what could be wrong.

Any help appreciated!

TypeError: write() argument must be str, not bytes

C:\Users\Electron\Desktop\wd\antivirus_demo>python learning.py
sys:1: DtypeWarning: Columns (13) have mixed types. Specify dtype option on import or set low_memory=False.
Researching important feature based on 54 total features

13 features identified as important:
1. feature DllCharacteristics (0.281040)
2. feature Machine (0.086104)
3. feature Characteristics (0.069102)
4. feature VersionInformationSize (0.064456)
5. feature SizeOfOptionalHeader (0.047274)
6. feature MajorSubsystemVersion (0.046663)
7. feature ResourcesMinSize (0.038094)
8. feature SectionsMaxEntropy (0.028874)
9. feature Subsystem (0.027956)
10. feature ResourcesMaxEntropy (0.027327)
11. feature SectionsMinEntropy (0.025751)
12. feature MinorOperatingSystemVersion (0.021324)
13. feature ExportNb (0.021009)

Now testing algorithms
DecisionTree : 98.804781 %
AdaBoost : 98.504165 %
GradientBoosting : 98.533140 %
GNB : 96.041289 %
RandomForest : 99.304600 %

Winner algorithm is RandomForest with a 99.304600 % success
Saving algorithm and feature list in classifier directory...
Traceback (most recent call last):
  File "learning.py", line 61, in <module>
    open('classifier/features.pkl', 'w').write(pickle.dumps(features))
TypeError: write() argument must be str, not bytes
C:\Users\Electron\Desktop\wd\antivirus_demo>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.