Packet Capture & Analyze

Slides:



Advertisements
Similar presentations
Florida State UniversityCOP Advanced Unix Programming Raw Sockets Datalink Access Chapters 25, 26.
Advertisements

Taekyung Kim 0x410 ~ 0x International Standards Organization (ISO) is a multinational body dedicated to worldwide agreement on international.
Internet Control Protocols Savera Tanwir. Internet Control Protocols ICMP ARP RARP DHCP.
Basic IP Traffic Management with Access Lists
Packet Injection 101 Vivek Ramachandran. What is packet injection ? Please go through the raw socket tutorial before going further. Simply put packet.
BOOTP and DHCP Shivkumar Kalyanaraman Rensselaer Polytechnic Institute
Introduction. 2 What Is SmartFlow? SmartFlow is the first application to test QoS and analyze the performance and behavior of the new breed of policy-based.
ICMP: Ping and Trace CCNA 1 version 3.0 Rick Graziani Spring 2005.
CIS 193A – Lesson12 Monitoring Tools. CIS 193A – Lesson12 Focus Question What are the common ways of specifying network packets used in tcpdump, wireshark,
TCP/IP Tools Lesson 5. Objectives Skills/ConceptsObjective Domain Description Objective Domain Number Using basic TCP/IP commands Understanding TCP/IP3.6.
Linux Networking Commands
1 Lab 3 Transport Layer T.A. Youngjoo Han. 2 Transport Layer  Providing logical communication b/w application processes running on different hosts 
Module 10. Internet Protocol (IP) is the routed protocol of the Internet. IP addressing enables packets to be routed from source to destination using.
Internet Control Message Protocol ICMP. ICMP has two major purposes: –To report erroneous conditions –To diagnose network problems ICMP has two major.
1 Introduction to Raw Sockets 2 IP address Port address MAC address TCP/IP Stack 67 Bootp DHCP OSPF protocol frame type UDP Port # TCP Port.
1 Networking (Stack and Sockets API). 2 Topic Overview Introduction –Protocol Models –Linux Kernel Support TCP/IP Sockets –Usage –Attributes –Example.
CSCD433 Advanced Networks Fall 2011 Raw vs. Cooked Sockets.
Connecting Networks © 2004 Cisco Systems, Inc. All rights reserved. Exploring How IP Address Protocols Work INTRO v2.0—4-1.
TCOM 515 IP Routing Lab Lecture 1. Class information Instructor: Wei Wu –Lecture and Lab session 2 – Instructor:
Examining TCP/IP.
LWIP TCP/IP Stack 김백규.
IT COOKBOOK Windows Network Programming. Chapter 01. Intro. to Network and Socket Programming.
IP Forwarding.
Chap 9 TCP/IP Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
CDPA 網管訓練 駭客任務 2 Ethernet Switching ARP, IP, LAN, Subnet IP Header, Routing ICMP
© 2007 Cisco Systems, Inc. All rights reserved.ICND1 v1.0—2-1 Ethernet LANs Exploring the Packet Delivery Process.
Raw Sockets Vivek Ramachandran. A day in the life of Network Packet.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Chapter 81 Internet Protocol (IP) Our greatest glory is not in never failing, but in rising up every time we fail. - Ralph Waldo Emerson.
CS4550 Computer Networks II IP : internet protocol, part 2 : packet formats, routing, routing tables, ICMP read feit chapter 6.
Networks and Protocols CE Week 7b. Routing an Overview.
DoS Suite and Raw Socket Programming Group 16 Thomas Losier Paul Obame Group 16 Thomas Losier Paul Obame.
Internet Protocol Formats. IP (V4) Packet byte 0 byte1 byte 2 byte 3 data... – up to 65 K including heading info Version IHL Serv. Type Total Length Identifcation.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network, Enhanced Chapter 3: TCP/IP Architecture.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco PublicITE I Chapter 6 1 Basic Switch Configurations.
Sniffer, tcpdump, Ethereal, ntop
TELE 402 Lecture 12: Signal-Driven I/O & Raw Socket 1 Overview Last Lecture –Advanced UDP sockets and threads –Source: Chapters 22&26 of Stevens’ book.
Network Analyzer :- Introduction to Wireshark. What is Wireshark ? Ethereal Formerly known as Ethereal GUINetwork Protocol Analyzer Wireshark is a GUI.
Monitoring Troubleshooting TCP/IP Chapter 3. Objectives for this Chapter Troubleshoot TCP/IP addressing Diagnose and resolve issues related to incorrect.
1 Microsoft Windows 2000 Network Infrastructure Administration Chapter 4 Monitoring Network Activity.
Linux Operations and Administration Chapter Eight Network Communications.
Slide #1 CIT 380: Securing Computer Systems TCP/IP.
PLUS 내부 세미나 1/22 The Libnet Library 이병영 2004/05/06.
A network primer (or refresher) Henning Schulzrinne (based on slides from Kurose/Ross)
WIRESHARK Lab#3. Computer Network Monitoring  Port Scanning  Keystroke Monitoring  Packet sniffers  takes advantage of “friendly” nature of net. 
PORT CONNECTION STATUS CT Lab#4. TCP packet UDP packet Ports Background.
Packet Switch Network Server client IP Ether IPTCPData.
Cisco I Introduction to Networks Semester 1 Chapter 3 JEOPADY.
Lecture 3: Stateless Packet Filtering. 2 Agenda 1 1 Linux file system - networking sk_buff 2 2 Stateless packet filtering 3 3 About next assignment 4.
© 2003, Cisco Systems, Inc. All rights reserved.
FIREWALL configuration in linux
Lab 2: Packet Capture & Traffic Analysis with Wireshark
Port Connection Status
A Quick Guide to Ethereal/Wireshark
ICMP Message Processing
Wireshark Lab#3.
Network Administration Homework1 Perl Programming Exercises
Byungchul Park ICMP & ICMPv DPNM Lab. Byungchul Park
Chapter 4: Access Control Lists (ACLs)
UNIX Sockets Outline Homework #1 posted by end of day
Setting Up Firewall using Netfilter and Iptables
Wireshark CSC8510 David Sivieri.
What does this packet do?
ICMP Message Processing
Network Analyzer :- Introduction to Wireshark
Network Analyzer :- Introduction to Wireshark
46 to 1500 bytes TYPE CODE CHECKSUM IDENTIFIER SEQUENCE NUMBER OPTIONAL DATA ICMP Echo message.
16EC Computer networks unit II Mr.M.Jagadesh
Packet Sniffing and Spoofing
Presentation transcript:

Packet Capture & Analyze Homework Assignment #1 Packet Capture & Analyze

Homework Assignment #1: Packet Capture and Analyze Lots of tools or libraries exist for packet capture & analyze Sniffer, Pcap,… However, in this homework, you are required to directly utilize the operating system services Use ioctl function to change a NIC’s flag Capture all packets passing the NIC Use raw socket to obtain layer 2 & layer 3 information Analyze all captured packets Environment Linux

About ioctl A system call used by a process to access features of a device that aren’t supported by the standard system calls like read, write… int ioctl(int fd, unsigned long com, char *argp) Command Third argument Description SIOCGIFCONF struct ifconf * Retrieve list of interface configuration SIOCGIFFLAGS struct ifreq * Get interface flags SIOCGIFMETRIC Get interface metric SIOCSIFFLAGS Set interface flags SIOCSIFMETRIC Set interface metric

Flowchart Start Setup interface Establish socket Get interface flag struct ifreq ethreq; //ifreq in <net/if.h> char interface[16]; memset(interface,0x00,sizeof(interface)); main function’s parameter argv[1]=‘eth0’ Setup interface Header: #include <sys/types.h> #include <sys/socket.h> Define: int socket(int domain,int type,int protocol) You need defining a Raw Socket to get L2,L3 information. Establish socket Header: #include <sys/ioctl.h> Define: int ioctl(int fd, unsigned long com, char *argp) Using command SIOCGIFFLAGS to get the original flag Get interface flag

Flowchart (cont.) IP ARP Others …. TCP UDP ICMP …. Receive packets Define in header file “if.h” #define IFF_PROMISC 0x100 /*receive all packets */ You need to set NIC’s flag to IFF_PROMISC Set promiscuous mode Receive packets IP ARP Others …. Analyzing & Filtering TCP UDP ICMP …. Loop receive

Data Structure Define structure #include <linux/if_ether.h> //for ethernet header struct ethhdr { unsigned char h_dest[ETH_ALEN]; unsigned char h_source[ETH_ALEN]; unsigned short h_proto; } #include <linux/ip.h> //for ip header struct iphdr {  unsigned int version:4;  unsigned int h_len:4;  unsigned char tos;  unsigned short total_len;  unsigned short ident;  unsigned short frag_and_flags;  unsigned char ttl;  unsigned char proto;  unsigned short checksum;  unsigned int sourceIP;  unsigned int destIP;

RAW Socket RAW socket enable you to establish the protocol what you need Advantages: When you using RAW socket, the packets you receiving are not modified Constrain No port number : system forward raw packets to suitable raw socket. In linux , raw socket can only be used by root.

Executable Command Format: capture [options][filter] Default: no option and filter Capture 100 packets and print out a summary of the packets #capture ------statistics------ IP :75 ARP :3 RARP :3 TCP :6 UDP :60 ICMP :0 IGMP :0 -----finish-----

Option -n <maxcount> -v The number of packets to be captured Print out the information for each captured packet Format: Source MAC address: 00:0E:6A:D3:B3:1E Destination MAC address: 00:E0:18:ED:D7:13 IP->protocol = TCP IP->src_ip = 220.130.208.127 IP->dst_ip = 220.130.208.129 Src_port =2345 Dst_port=64

Filter srcmac <MAC_ADDR> destmac <MAC_ADDR> Specify the source MAC address destmac <MAC_ADDR> Specify the destination MAC address srcip <IP_ADDR> Specify the source IP address destip <IP_ADDR> Specify the destination IP address srcport <PORT_NUM> Specify the source port number destport <PORT_NUM> Specify the destination port number tcp Specify the layer 4 protocol as TCP udp Specify the layer 4 protocol as UDP

Filter (Cont) Example 1 Example 2 Finding out 10 UDP packets belongs to you and printing out the information of packets (use v option) #capture –n 10 –v upd destip 140.120.15.1 Example 2 Finding out 10 TCP packets with source IP = 140.120.15.1 and destination MAC address = 4578CD4E and printing out the information of packets (use v option) #capture –n 10 –v tcp srcip 140.120.15.1 destmac 4578CD4E

Turn In Source code Executing result (snapshot)

Turn In (cont.) Deadline Ftp Filename If you want to update 23:59, Nov 24, 2005 Ftp IP:140.120.15.123 2222 Username/Password: comm94/comm94 Filename HW1_ID.doc eg.HW1_79356001.doc If you want to update HW1_ID_new1.doc, HW1_ID_new2.doc …etc

Turn In (cont.) No late work is acceptable No cheat work is acceptable You get zero if you miss the due day No cheat work is acceptable You get zero if you copy other people’s version

Reference TCP/IP Illustrated,Volume 2,Wright Stevens, Addison Wesley Linux C/C++ 網路程式設計,金禾 Linux C 函式庫參考手冊,旗標 Linux Socket Programming,碁峰