Coder Social home page Coder Social logo

surajr / machine-learning-approach-for-malware-detection Goto Github PK

View Code? Open in Web Editor NEW
73.0 4.0 47.0 11.58 MB

A Machine Learning approach for classifying a file as Malicious or Legitimate

Jupyter Notebook 100.00%
machine-learning malware-detection security-scanner security-tools pefile

machine-learning-approach-for-malware-detection's Introduction

Machine-Learning-approach-for-Malware-Detection

A Machine Learning approach for classifying a file as Malicious or Legitimate.

This approach tries out 6 different classification algorithms before deciding which one to use for prediction by comparing their results. Different Machine Learning models tried are, Linear Regression, RandomForest, DecisionTree, Adaboost, Gaussian, Gradient Boosting.

In order to test the model on an unseen file, it's required to extract the characteristics of the given file. Python's pefile.PE library is used to construct and build the feature vector and a ML model is used to predict the class for the given file based on the already trained model.

Dependencies

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

machine-learning-approach-for-malware-detection's People

Contributors

surajr 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

Watchers

 avatar  avatar  avatar  avatar

machine-learning-approach-for-malware-detection's Issues

False Positive Rate

FPR should be the fraction of false positive divided by the number of non malicious files. Therefore it should be mt[0][1] / float (sum (mt[1]) * 100)

Correct me if I am wrong?

Obtaining incorrect results on changing the train test split ratio

If the test ratio is changed to 0.3, it shows all the files as benign, if changed to 0.2, it shows all to be malicious. Can you please suggest to improve the same?? I am selecting the following features using extratrees classifier with n_estimator value = 100

['DllCharacteristics', 'Machine', 'Characteristics', 'SectionsMaxEntropy', 'VersionInformationSize', 'ImageBase', 'Subsystem', 'MajorSubsystemVersion', 'ResourcesMinEntropy', 'SizeOfOptionalHeader', 'ResourcesMaxEntropy', 'MajorOperatingSystemVersion', 'SectionsMinEntropy', 'SectionsMeanEntropy']

Error in detection

When I run your code it shows wrong result. I have tested with skype.exe it shows as malicious but actually skype is not malicious. Kindly upload the correct code.

malware_test.py not running properly

it says:

FileNotFoundError Traceback (most recent call last)
in ()
185 clf = joblib.load('classifier/classifier.pkl')
186 features = pickle.loads(open(os.path.join('classifier/features.pkl'),'rb').read())
--> 187 data = extract_infos(sys.argv[1])
188 pe_features = map(lambda x:data[x], features)
189

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.