Hands-On Ethical Hacking and Network Defense

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

Introducing JavaScript
Introduction to JavaScript
 2005 Pearson Education, Inc. All rights reserved Introduction.
Introduction to C Programming CE Lecture 1 Introduction to C.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
Computers: Tools for an Information Age
Guide To UNIX Using Linux Third Edition
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
Java Programming, 3e Concepts and Techniques Chapter 2 - Part 2 Creating a Java Application and Applet.
CIS Computer Programming Logic
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Chapter 1 CSIS-120: Java Intro. What is Programming?  A: It is what makes computer so useful.  The flexibility of a computer is amazing  Write a term.
Programming With C.
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
Programming For Security Professionals March 23, 2010 MIS 4600 – MBA © Abdou Illia.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
C Language: Introduction
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
I Power Higher Computing Software Development Development Languages and Environments.
XP Tutorial 8 Adding Interactivity with ActionScript.
Agenda Computer Languages How to Write a Simple C Program
Creating a Java Application and Applet
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
Hands-On Ethical Hacking and Network Defense 2 nd edition Chapter 7 Programming for Security Professionals Last modified
Controlling Computers with Programs When you create a computer program you are creating a set of instructions that tell the computer exactly and completely.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
ITP 109 Week 2 Trina Gregory Introduction to Java.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
CITA 352 Chapter 7 Programming for Security Professionals.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
Hands-On Ethical Hacking and Network Defense Chapter 7 Programming for Security Professionals Modified 4/10/ Justin Wagner.
Chapter 5: Preparing C Programs
Introduction to C Topics Compilation Using the gcc Compiler
Last week: We talked about: History of C Compiler for C programming
Computer Science 210 Computer Organization
“Under the hood”: Angry Birds Maze
CSCI-235 Micro-Computer Applications
C Programming Hardik H. Maheta.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
Java programming lecture one
Introduction to C Topics Compilation Using the gcc Compiler
Programming Concepts and Languages
Introduction to C Programming Language
PHP Introduction.
Chapter 12 Programming Concepts and Languages.
Computer Science 210 Computer Organization
PHP.
Introduction to C Topics Compilation Using the gcc Compiler
A programming language
Introduction to C Topics Compilation Using the gcc Compiler
An Introduction to Programming with C++ Fifth Edition
An Overview of C.
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

Hands-On Ethical Hacking and Network Defense Chapter 7 Programming for Security Professionals

Objectives Explain basic programming concepts Write a simple C program Explain how Web pages are created with HTML Describe and create basic Perl programs Explain basic object-oriented programming concepts

Introduction to Computer Programming Computer programmers must understand the rules of programming languages Programmers deal with syntax errors One minor mistake and the program will not run Or worse, it will produce unpredictable results Being a good programmer takes time and patience

Computer Programming Fundamentals Fundamental concepts Branching, Looping, and Testing (BLT) Documentation Function Mini program within a main program that carries out a task

Branching, Looping, and Testing (BLT) Takes you from one area of the program to another area Looping Act of performing a task over and over Testing Verifies some condition and returns true or false

A C Program Filename ends in .c It's hard to read at first A single missing semicolon can ruin a program

Comments Comments make code easier to read

Branching and Testing Diagram of branches See links Ch 7b, 7c main() printf() scanf() Diagram of branches See links Ch 7b, 7c

Looping

Branching, Looping, and Testing (BLT) Algorithm Defines steps for performing a task Keep it as simple as possible Bug An error that causes unpredictable results Pseudocode English-like language used to create the structure of a program

Pseudocode For Shopping PurchaseIngredients Function Call GetCar Function Call DriveToStore Function Purchase Bacon, Bread, Tomatoes, Lettuce, and Mayonnaise End PurchaseIngredients Function

Documentation Documenting your work is essential Add comments to your programs Comments should explain what you are doing Many programmers find it time consuming and tedious Helps others understand your work

Bugs Industry standard Windows 2000 contains almost 50 million lines 20 to 30 bugs for every 1000 lines of code (link Ch 7f) Textbook claims a much smaller number without a source Windows 2000 contains almost 50 million lines And fewer than 60,000 bugs (about 1 per 1000 lines) See link Ch 7e for comments in the leaked Win 2000 source code Linux has 0.17 bugs per 1000 lines of code (Link Ch 7f)

Learning the C Language Developed by Dennis Ritchie at Bell Laboratories in 1972 Powerful and concise language UNIX was first written in assembly language and later rewritten in C C++ is an enhancement of the C language C is powerful but dangerous Bugs can crash computers, and it's easy to leave security holes in the code

Assembly Language The binary language hard-wired into the processor is machine language Assembly Language uses a combination of hexadecimal numbers and expressions Very powerful but hard to use (Link Ch 7g)

Compiling C in Ubuntu Linux Compiler Converts a text-based program (source code) into executable or binary code To prepare Ubuntu Linux for C programming, use this command: sudo apt-get install build-essential Then you compile a file named "program.c" with this command: gcc program.c –o program.exe

Anatomy of a C Program The first computer program a C student learns "Hello, World!"

Comments Use /* and */ to comment large portions of text Use // for one-line comments

Include #include statement Loads libraries that hold the commands and functions used in your program

Functions A Function Name is always followed by parentheses ( ) Curly Braces { } shows where a function begins and ends main() function Every C program requires a main() function main() is where processing starts

Functions Functions can call other functions \n represents a line feed Parameters or arguments are optional \n represents a line feed

Declaring Variables A variable represents a numeric or string value You must declare a variable before using it

Variable Types in C

Mathematical Operators The i++ in the example below adds one to the variable i

Mathematical Operators

Logical Operators The i<11 in the example below compares the variable i to 11

Logical Operators

Demonstration: Buffer Overflow

Understanding HTML Basics HTML is a language used to create Web pages HTML files are text files Security professionals often need to examine Web pages Be able to recognize when something looks suspicious

Creating a Web Page Using HTML Create HTML Web page in Notepad View HTML Web page in a Web browser HTML does not use branching, looping, or testing HTML is a static formatting language Rather than a programming language < and > symbols denote HTML tags Each tag has a matching closing tag <HTML> and </HTML>

Understanding Practical Extraction and Report Language (Perl) Powerful scripting language Used to write scripts and programs for security professionals

Background on Perl Developed by Larry Wall in 1987 Can run on almost any platform *NIX-base OSs already have Perl installed Perl syntax is similar to C Hackers use Perl to write malware Security professionals use Perl to perform repetitive tasks and conduct security monitoring

Understanding the Basics of Perl perl –h command Gives you a list of parameters used with perl

Understanding the BLT of Perl Some syntax rules Keyword “sub” is used in front of function names Variables begin with the $ character Comment lines begin with the # character The & character is used when calling a function

Branching in Perl &speak; sub speak Calls the subroutine Defines the subroutine

For Loop in Perl For loop

Testing Conditions in Perl

Understanding Object-Oriented Programming Concepts New programming paradigm There are several languages that support object-oriented programming C++ C# Java Perl 6.0 Object Cobol

Components of Object-Oriented Programming Classes Structures that hold pieces of data and functions The :: symbol Used to separate the name of a class from a member function Example: Employee::GetEmp()

Example of a Class in C++ class Employee { public: char firstname[25]; char lastname[25]; char PlaceOfBirth[30]; [code continues] }; void GetEmp() // Perform tasks to get employee info [program code goes here] }

Error in textbook C example on page 138 should be this instead