Giter Site home page Giter Site logo

nashid / code2image Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arcelikacikkaynak/code2image

0.0 0.0 0.0 1.23 MB

Intelligent Code Analysis by Computer Vision Techniques and Application to Vulnerability Prediction

License: GNU General Public License v3.0

Python 99.28% Shell 0.60% C 0.11%

code2image's Introduction

Code2Image: Intelligent Code Analysis by Computer Vision Techniques and Application to Vulnerability Prediction

Paper: https://arxiv.org/abs/2105.03131

Source Code Representation

  • demo.py: Demonstration of AST-based image representation of source code with a sample C file (main.c)
  • nodeencoding.py: Encodes AST tokens to RGB values
  • treetraversal.py: Tree traversal over AST
  • image_representation.py: Generates image representation of source code in numpy matrice format

Vulnerability Prediction

  • readdraper.py: Read data (i.e. function source codes from the Draper dataset (https://osf.io/d45bw/)), generate image representation, rename and put them either in folder 0 (i.e. non-vulnerable) or in folder 1 (i.e. vulnerable) for each vulnerability type.
  • copyfiles.sh: Creates multiple copies of samples for oversampling to deal with data imbalance
  • FCNdense.py: Convolutional neural network (CNN) architecture
  • generator.py: Generator for loading and processing images
  • train.py: Script for training the model
  • plotPR.py: Plots precision-recall curve and calculates several performance metrics

The Pretrained_Models folder contains a pretrained model for each vulnerability type

code2image's People

Contributors

zekidsp avatar

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.