One of the most important aspects of ethical hacking is being aware of the different attacks that can be launched against a computer system.
One of the most common types of attacks is known as a SQL injection attack, which is where malicious code is injected into a web form so that the attacker can access or change data in a database.
Another common type of attack is known as a Cross-Site Scripting attack, which is where malicious code is injected into a web page so that the attacker can execute commands on the computer of the user who is visiting the page.
One of the most important skills that a hacker must have is the ability to Code.
Ethical hackers should study programming and learn as much about the subject as possible in order to find vulnerabilities in programs and get them fixed before unethical hackers take advantage of them.
There are many hackers who say that they don't know a programming language and are earning quite well with the help of their cracked software. But, to be honest, most of these people don't tell the truth.
This may be true for a shorter time but if you take a closer look they also learn programming language to be in the hacking game for a long time.
In this crash course for learning the basics of programming, you will learn about the C programming language and its basics.
Intro to C
C is the most important programming language ever created in the history of computing because it is the language of the Unix operating system.
C was created in the early 1970s by Dennis Ritchie at Bell Labs. In today's world a large number of applications such as Microsoft Office Suite, Adobe Reader, and browsers, are written in combinations of C, C++, Objective-C, assembly, and a couple of other lower-level languages.
Why learn C?
You must be thinking that there are so many languages that are way more powerful than C so why should we learn C?
Ok, I got it and you are right but there are some reasons for that.
We assume that you have no experience in coding so this will be your great start then you can move to other languages.
C programming language is a versatile language means it can be used everywhere like on a computer, mobile phone, or tablet we use C code written all over every portion of the transmission of this text from start to finish. It is used everywhere
Most operating systems and their respective headers are written in C, and most scripting and other high-level languages integrate incredibly well with the language.
The majority of the world’s operating systems, including Windows, Mac OS X, and Linux, are written in C. Furthermore, many scripting languages like Ruby and Python are designed to be easier to integrate with C-programs than traditional high-level languages like Java.
Take, for example, what happens when you try to integrate your web application with a database. Certain low-level database routines are written in C, and many others integrate incredibly well with it.
C++ is a very versatile programming language that is also in high demand, and a precious language to know. C++ is good for many things besides just building web pages and getting jobs with big companies. And if you want to learn c++ then you will need that you should learn c first to grasp some basic syntax.
And C is the fastest high-level language.
There are many reasons why you want to learn C. Primarily, it's a programming language with a ton of standards and libraries that other languages built on top of it. And while there are plenty of examples online of programming in C, I've found very few tutorials or courses on teaching C itself.
Basic Structure of C:-
As we all know that each programming language is unique but there are some common structures
main() - The main function serves as the starting point for program execution.
functions - A function is a block of code that only runs when it is called. these are self-contained bundles of code that can be called for execution by main() or other functions. They can be called as many times as needed which prevents to repeat same code throughout a program . The first line of the function is called signature
Variables - containers for storing data values. Common variable types are
int which stores a signed integer value like 1 or -1 and its size is 8 bytes for 64-bit machines, 4 bytes for 32-bit machines, and 2 bytes for 16-bit machines
float which stores a signed floating point number like -1.324 and its size is 4 bytes
double which store a large floating point number and its size are 8 bytes
char which stores a single character like "a" or "b" or "z" and its size is 1 byte
printf - it is used to print output to the screen. it has many formats and will be used
printf(format);
its formats are:-
%n which means print nothing
%d which means decimal value
%s which means string value
%x which means hex value
%f which means float value
scanf - it is used to get input from the user
loops - loops are used to perform repeatedly through a series of commands multiple times
for loop in c - for loops start counting at a beginning value, test the value for some condition, execute the statement, and increment the value for the next iteration.
For example
for(i=0; I<10; i++)
{
printf("%d", i);
}
will print numbers 0 to 9 on the same line like - 0123456789
While loop in c - it is used to perform repeatedly through a series of statements until a condition is met.
For example
#include <stdio.h>
int main(void) {
int x = 0;
while (x<10) {
printf("x = %d\n", x);
x++;
}
return 0;
}
will print numbers 0 to 9 like
x = 0
x = 1
x = 2
x = 3
x = 4
x = 5
x = 6
x = 7
x = 8
x = 9
if/else - The if/else construct is used to execute a series of statements if a certain condition is met; otherwise, the optional else block of statements is executed. if there is no else block of
statements, the flow of the program will continue after the end of the closing of the block
bracket (}).
comments - comments are added so that others who see the code can understand what this code will do.
Conclusion
Hackers are smart people that find exploits in software, system, and networks.
They can also be people who can use their knowledge to search for security holes in programming and coding.
Anyone can be a hacker, you just have to know how and when to use your skills.
It is this kind of code-reading experience that will help you unlock the programming world.
The great thing about C is that once you know how it works and how to structure a program, you develop an
intuition for how the other languages work as well.
For Learn, more about C click here
So that is it for today guys I hope you enjoyed it.
If so please comment down below.
I'll meet you in another write-up another day.
Thanks for reading.
Comments