Last active
August 28, 2019 18:20
-
-
Save drcircuit/81c83c165c8de7d4407e7c4770be7c1c to your computer and use it in GitHub Desktop.
SourceCode for the Bank Terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <stdbool.h> | |
| struct account | |
| { | |
| char name[16]; | |
| int balance; | |
| bool is_gold_customer; | |
| } __attribute__((packed)); | |
| int main() | |
| { | |
| struct account customer; | |
| customer.is_gold_customer = 0; | |
| customer.balance = 1000; | |
| setvbuf(stdout, NULL, _IONBF, 0); | |
| printf("Welcome to DNB. Introduce yourself!Enter name: \n"); | |
| read(STDIN_FILENO, customer.name, 81); | |
| if (customer.balance > 0 && customer.is_gold_customer == 1) | |
| { | |
| printf("You are a gold customer, here is your bank shell:\n"); | |
| system("/bin/sh"); | |
| } | |
| else | |
| { | |
| printf("Sorry, this service is for gold customers only..\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment