Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Information Security Networking 1.

Similar presentations


Presentation on theme: "Introduction to Information Security Networking 1."— Presentation transcript:

1 Introduction to Information Security Networking 1

2 DISCLAIMER Networking, in 1 hour. I'll be oversimplifying. 2

3 The Physical Layer Physical 3

4 The Data Link Layer HW1 HW2HW3HW4HW5HW6 HW7 Physical Data Link 4

5 The Network Layer HW1 HW2HW3HW4HW5HW6 HW7 HW1 HW2HW3HW4HW5HW6 HW7 router Physical Data Link Network (IP) My Home WiFi (802.11) Google Ethernet 1.1.1.1 1.1.1.2 1.1.1.31.1.1.41.1.1.51.1.1.6 1.1.1.72.2.2.1 2.2.2.22.2.2.32.2.2.42.2.2.52.2.2.6 2.2.2.7 5

6 Special Cases - NATs HW1 HW2HW3HW4HW5HW6 HW7 HW1 HW2HW3HW4HW5HW6 HW7 gateway Physical Data Link Network (IP) My Home WiFi (802.11) Google Ethernet 10.0.0.1 10.0.0.210.0.0.310.0.0.410.0.0.5 10.0.0.138 1.1.1.12.2.2.2 192.168.0.1 192.168.0.11 192.168.0.12192.168.0.13192.168.0.14192.168.0.15 192.168.0.16 6

7 Special Cases - Localhost HW1 HW2HW3HW4HW5HW6 HW7 HW1 HW2HW3HW4HW5HW6 HW7 gateway Physical Data Link Network (IP) My Home WiFi (802.11) Google Ethernet 10.0.0.1 10.0.0.210.0.0.310.0.0.410.0.0.5 10.0.0.138 1.1.1.12.2.2.2 192.168.0.1 192.168.0.11 192.168.0.12192.168.0.13192.168.0.14192.168.0.15 192.168.0.16 127.0.0.1 7

8 The Transport Layer HW1 HW2HW3HW4HW5HW6 HW7 HW1 HW2HW3HW4HW5HW6 HW7 router Physical Data Link Network (IP) My Home WiFi (802.11) Google Ethernet 1.1.1.1 1.1.1.2 1.1.1.31.1.1.41.1.1.51.1.1.6 1.1.1.72.2.2.1 2.2.2.22.2.2.32.2.2.42.2.2.52.2.2.6 2.2.2.7 Transport (TCP) 1234 2345 3456 8

9 The Rest HW1 HW2HW3HW4HW5HW6 HW7 HW1 HW2HW3HW4HW5HW6 HW7 router Physical Data Link Network (IP) My Home WiFi (802.11) Google Ethernet 1.1.1.1 1.1.1.2 1.1.1.31.1.1.41.1.1.51.1.1.6 1.1.1.72.2.2.1 2.2.2.22.2.2.32.2.2.42.2.2.52.2.2.6 2.2.2.7 Transport (TCP) 1234 2345 3456 Session Presentation Application OSI Model Physical Application TCP/IP Network (IP) Transport (TCP) HTTP(S) DNS 9

10 Abstraction ( IP A, port A, IP B, port B ) 10

11 Sockets Client Server listener = socket.socket() listener.bind(('127.0.0.1', 8000)) listener.listen(5) conn, addr = listener.accept() while True: data = conn.recv(4096) conn.send(data) conn = socket.socket() conn.connect(('127.0.0.1', 8000)) while True: data = input() conn.send(data) print conn.recv(4096) 11

12 Socket Patterns listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) listener.bind(('', 8000)) data = conn.recv(4096) if not data: break 12

13 Summary The server: Creates a socket Bind it to some IP address and some port Starts listening for connection (allocates a queue with backlog slots) Accepts a connection from the queue and handles it The client: Creates a socket Connects to some IP address and some port Both Send data Receive data 13

14 And Now In C! int listener, conn, addrlen; struct sockaddr_in listener_addr, conn_addr; char buff[1024]; listener = socket(AF_INET, SOCK_STREAM, 0)); listener_addr.sin_family = AF_INET; listener_addr.sin_port = htons(8000); listener_addr.sin_addr.s_addr = INADDR_ANY; bind(listener, (struct sockaddr*) &listener_addr, sizeof(listener_addr)); listen(listener, 5); addrlen = sizeof(conn_addr); conn = accept(listener, (struct sockaddr*) &conn_addr, &addrlen); while (1) { recv(conn, buff, 1024, 0); send(conn, buff, 1024, 0); } 14

15 And Now In C! int conn; struct sockaddr_in addr; char buff[1024]; conn = socket(AF_INET, SOCK_STREAM, 0)); addr.sin_family = AF_INET; addr.sin_port = htons(8000); addr.sin_addr.s_addr = inet_addr("127.0.0.1"); connect(conn, (struct sockaddr*) &addr, sizeof(addr)); while (1) { fgets(buff, 1024, stdout); send(conn, buff, 1024, 0); recv(conn, buff, 1024, 0); printf("%s\n", buff); } 15

16 And Now in netcat ! 16


Download ppt "Introduction to Information Security Networking 1."

Similar presentations


Ads by Google