Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

711 B
Raw Blame
#include <stdlib.h>
#include <stdio.h>

int bof() {
    char buffer[8]; /* an 8 byte character buffer */
    FILE *badfile;

    /* Open "badfile" for reading */
    badfile = fopen("badfile", "r");

    /* This is where the overflow happens. Reading 1024 bytes into an 8-byte buffer is a "bad thing" */
    fread(buffer, sizeof(char), 1024, badfile);

    /* Close the file */
    fclose(badfile);

    /* Return value */
    return 1;
}

int main(int argc, char **argv) {
    bof(); /* Call our function, causing the buffer overflow */

    /* Print a message, in case of an overflow execution will not reach this point */
    printf("Not gonna do it!\n");

    /* Leaves the main function */
    return 1;
}