Google
Web GovernmentSecurity.org
hacking
compliance articles
Upgrade Backup Exec
information security consultant

Database Security (Common-sense Principles)
Places that viruses and trojans hide on start up
Step-by-Step Guide to Using the Security Configuration Tool Set
Improving the Security of Your Site by Breaking Into it
Domain Name Robbery
XDCC - An .EDU Admin's Nightmare
Database Security
Database Security
Is Database Security an Oxymoron?
Database security: protecting sensitive and critical information
The database security blanket
Database security in your Web-enabled apps
Making Your Network Safe for Databases
SQL Injection: Modes of Attack, Defence, and Why It Matters
Database Security in High Risk Environments
Linksys Router Information (A collection)
Common Ports
Protection of the Administrator Account in the Offline SAM
Windows 2000 Security
The dangers of ftp conversions on misconfigured systems
Win98.BlackBat
AnnaKournikova worm decrypted
C/C++ made easy with GoGooSE 1.0
UNIX Bourne Shell Programming
BATCH ProgramminG
Assembly for nerds using linux
THE LATEST IN DENIAL OF SERVICE ATTACKS: "SMURFING"
The Ingredients to ARP Poison
Outlook 2002: can't send .exe file with Email
Windows 9x/Me Security and System Restrictions
Exploiting The IPC Share
Local Windows hacking
Windows Cryptic Error Messages
Windows NT Registry Tutorial
catch a macro virus
Protecting Files with Windows NTXP
Microsoft Baseline Security Analyzer V1.1
A Beginners Guide To Wireless Security
Default Logins and Passwords for Networked Devices
How To Eliminate The Ten Most Critical Internet Security Threats
About computer crime
System Backdoor Information
System Backdoors Explained
Introduction to Buffer Overflow
Donald Pipkin's Security Tips for the Week of December 23rd
Getting IP data from numerous sources
Rainbow Series Library [The One The Only]
Honeypots (Definitions and Value of Honeypots)
General Attack Descriptions
Wireless Taping
CYBERTERRORISM
Security from a different angle
 

 

C/C++ made easy with GoGooSE 1.0
By GoGooSE

Introducing to C/C++ with GoGooSE

CONTENT

1.0 BASICS

1.1 Whats C/C++??

1.2 How to make proggies out of source code??


2.0 QUICKSTART

2.1 Take a Quickstart:

2.2.1 So lets begin...

2.2.2 The Hello World Proggie

2.2.3 Hello C

2.2.4 Hello C++

2.2 What does that mean??


3.0 A CLOSER LOOK:

3.1 Overview

3.2 Includes:

3.3 Defines:

3.4 Variables:

3.5 Functions:

3.6 Table of possible function assignments


4.0 LIBRARY SURFIN:

4.1 C

4.1.1 Output

4.1.3 Returning

4.2 C++

4.3 Tables

4.4 Standard


5.0 OPERATORS:

5.1 Basic

5.2 Mathematical

5.3 Logical

5.4 Relational

6.0 LOOPS

6.1 Basics

6.2 IF

6.3 FOR

6.4 WHILE

6.5 SWITCH

One of the early Turorials by GoGooSE. please mail, if links are broken,
or with any open Questions


1.0 BASICS

1.1 What´s C/C++??

If somebody is really interested in how C/C++ could get so damn popular, read
the links below.

I´m not in the mood to list the whole History.

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

http://www.hitmill.com/programming/cpp/cppHistory.asp


1.2 How to make proggies of out source code??

Well, on Unix the solve of this Problem isn´t far off. You simply type

cc -o [input file] [output file]

With Windows, you will get the Problem, that C Compiling isn´t implemented by Microsoft.
So you need to do that work for yourself...

Go on Google and type in something like "C+Compiler" or "compile C code".

Or just try these links; case they´re working:

http://www.borland.com/products/downloads/download_cbuilder.html
http://www.c-compiler.com/
http://sdcc.sourceforge.net/

2.0 QUICKSTART

2.1 Take a Quickstart:

Instead of writing to you the whole stdlib of C, I will still give you a glance on it,
and focus the Syntax. I think the understanding of the Syntax is much more usefull
than stupidly learn some words. or am i wrong??

2.1.1 So lets begin...

C/C++ isn´t that dificult as it may be suggested by some "Hardcore Programming-freaks".
Lets start with a simple "Hello World Programm, wich is the most known, and
easiest to proram Example

C-Source

#include <stdio.h>

void main(void) {
printf("Hello World, thats me");
return;
}


C++-Source

#include <iostream.h>

int main(void);

int main(void) {
cout<<"Hello World, thats me";
return 0;
}

2.2 What does that mean??

Now we will discuss every single step of the two sources:

#include <included library> --> You use this to define standard library´s, used in your Program: These
Library´s are full of useable function´s wich will make your work with
C/C++ very handy.

In our two example-sources, we used <stdio.h> (including the printf() funtion)
<iostream.h> (including definitions for >> and << Operators)

void main(void) --> definition of main function. This "main" function is needed by every programm as default function

printf("string") --> This function is used to write characters to stdout.

cout<<"string" --> The C++ Version of printf()

return --> Return from a function (Can also give back values, but later on..)

3.0 A CLOSER LOOK:

3.1 Overview

A C-Source is splited in several parts. Some of them are optional.

1. The "Includes Section", where header files are defined.
i.e.: #include <stdio.h> (Would define the stdio header file to be included)

2. The "Defines Section", where defines where made
i.e.: #define RAND_MAX 200 (Would define the Constant RAND_MAX to be 200)

3. The "Variabs Section" here you,ll define global Variabs, structs or classes

4. The "Function Section" Here is the part of your Program, where you define, what to execute.
i.e.: void main(void) {} // int here(char c) {}

Now lets take every single Section:

3.2 Includes:

The string "#include" starts the definition of a header files. Read the documentation of your
C/C++ Compiler to get Information about, what´s in your Header Files. You can easily extend
your compiler, by adding new librarys, i.e. from the net

3.3 Defines:

To understand this you need a basic Knowledge of Variables. Just remember, that you can define a Constant
with the string "#define [CONST-NAME] [CONST-VALUE]"

3.4 Variables:

Variables are one of the basic features of every programming language. You can easily save and retrieve
Information, by giving it a name and a adress on the heap.

In C/C++ you need to define every Variable type-specific. That means, that the compiler needs to know
wich type of Information you put into a variable. Following types are present.

int /* simple integer type */
long int /* long integer type */
short int /* short integer type */
unsigned int /* unsigned integer type */
char /* character type */
float /* floating point type */
double /* double precision floating point */

char 1 -128 to 127
signed char 1 -128 to 127
unsigned char 1 0 to 255

int 2 -32,768 to 32,767
unsigned int 2 0 to 65,535

short int 2 -32,768 to 32,767
unsigned short int 2 0 to 65,535

long int 4 -2,147,483,648 to
2,147,483,647
unsigned long 4 0 to 4,294,967,295

float 4 3.4E-38 to 3.4E+38

double 8 1.7E-308 to 1.7E+308

long double 10 1.2E-4932 to 1.2E+4932




You can assign a Variable like this:

type | name | (optional)= | (optional)value ;
------------------------------------------------
int number = 30 ;

char abc = 'abc' ;

Now you´ll also understand the misterious defines.

3.5 Functions:

This is the most important part. It will include every thing, your program does.

To define a new function you must specify some things:

1. The "Return-type" i.e. The function rand() returns a random integer. it would be defined as follows:

int rand(void)

2. The Name and ..

3. The "Call-type" i.e. The function printf(variab) needs to know what to put out. So you will tell it the value of
your Message or the variab, teh mess is saved in, by doing this:

printf("string(Your message)") or printf("var_type", variab_with_mess_in_it)


3.6 Table of possible function assignments

This table shows how to do this

return type name call type

int main void main function, wich returns with integer value

int check char a gets a character and returns witch value

void find int index gets integer value and returns without anything


"VOID" means nothing more than "nothing" you use it to tell the compiler, that you dont need a variable.


4.0 LIBRARY SURFIN

In the end i will give you definitions of some usefull basic functions to try programming.

4.1 C

4.1.1 Output

C gives you several tools to do Output to the system

Basically use the printf() function. Here a list:

NAME SYNTAX DESCRIPTION

printf() printf("string" or variable) view list of var_types
printf("var_type", variable)

putchar() var[x]=putchar() Puts single char


4.1.2 Input

NAME SYNTAX DESCRIPTION

scanf() scanf("var_type", variable) view list of var_types

getchar() var[x]=getchar()


4.1.3 Returning (C/C++)

NAME SYNTAX DESCRIPTION

exit() exit(code) returns completly from a program

return rerturn code returns from a function, or if used in main() from the program
4.2 C++

4.2.1 Output

NAME SYNTAX DESCRIPTION

cout cout<<"string" put string to stdout
cout<<var put var to stdout

4.2.2 Input

NAME SYNTAX DESCRIPTION

cin cin>>var get var from stdin

4.3 Tables

printf "var-type" Table

name variab-type

%d Integer
%f Float
%c char
%s string


4.4 Standard

NAME SYNTAX DESCRIPTION INCLUDE

rand() var=rand() gets random number math.h






5.0 OPERATORS:

5.1 Basic

Table of Basic C/C++ Operators

= is (asign value to variab) [var]=[value]
; defines end of codeline
* value of (i.e. to a pointer)
& adress of -""-

5.2 Mathematical

Table of Mathematical C/C++ Operators

+ addition
++ increment
- unary minus and subtraction
-- decrement
* multiplication
/ division
% remainder (modules operator)

5.3 Logical

| or (a | b) == a or b
&& and (a && b) == a && b
! not (a ! b) == a not b


5.4 Relational

Table of Relational C/C++ Operators

== equal; compare Operator i.e. a==b;; is value a = value b??
< smaller
<= smaller or equal
> greater
>= greater or equal
!= not is

6.0 LOOPS

6.1 Basics

Loops help you doing many Operations with only a
few lines of code. I.e., we want to put out the numbers
from 1 to 100. We could easily do that by typing cout<<"1"<<"2"<<"3"...
But that would take very much typingtime. You would use a for or a while
loop instead. 3 lines code!!

6.2 IF

With the if statement, you can perform a test on a peace of information (the statement).
It looks like this

this is the statement
|
V
if([info1]relational_operator[info2]) {
}
else {
}

[info1], [info2] points to a variable, string, number, etc...
relational_operator is !=, ==, <=...
the else part shows the program wich code to execute, if the statement is false.
the brackets are only needed if you process more than on line with your if
statement; otherwise you would use if(xxx) exit(0);

IF performs the requested operation only if the statement in brackets is true.

6.3 FOR

with FOR you can perform repeated operations. FOR repeats the operations in {} brackets
until the statement in () Brackets is false.

for(int a=0; a<=100; a++) {
cout<<a;
}

this would print out the numbers 0-100 to stdout.

for( ..... initializes the FOR loop
int a=0; ..... gives a the value 0 at first time running; Note that C only allow variable
declarations at the beginning of a function(local), or in front of the main
function (global) the upper statement int a=0; would lead to an error, because
need to be defined in the beginning of the function. In C++ this is legal.

a<=100; ..... as long as a is smaller or equal to 100
a++; ..... increment a at every loop

6.4 WHILE

with WHILE you can perform repeated operations. WHILE repeats the operations in {} brackets
until the statement in () Brackets is true.

do {
a++;
} while(a!=100);

or

while(a<=100) {
a++;
}

do {, while { ..... initializes the WHILE loop
a!=100 ..... while a not is 100
a++
..... increment a
6.5 SWITCH

the SWITCH loop lets you define multiple operation for multiple values.

int a;
cout<<"\nWhat you wana do?";
cin>>a;
switch(a){
case 1: makeone();
c++;
cout<<"\nNice day huh??";
break;

case 2: maketwo();
break;

default: cout<<"\nwhat??"
break;
}

switch(var) { ..... opens SWITCH on variable a
case 1: ..... like if but without {} brackets, use 'x' to check for chars
break ..... breaks out of the case. (needed to start new case)
default: ..... what to do if none of the cases is true??