Download presentation
Presentation is loading. Please wait.
1
Socket Program Training
10/19/2016
2
Introduction Video Streaming Server VoIP Socket Program
Darwin VoIP Asterisk Socket Program Ex: FTP Backdoor Program Kernel
3
Darwin Streaming Server
The open source version of Apple’s QuickTime Streaming Server technology Updated Version v6.0.3 Previous Version v5.5.5
4
Installation tar zxf DarwinStreamingSrvr5.5.5-Linux.tar.gz
cd DarwinStreamingSrvrlinux-Linux ./Install Please enter a new administrator user name: user_name Please enter a new administrator Password: your_password
5
Starting sudo /usr/local/sbin/DarwinStreamingServer
sudo /usr/local/sbin/streamingadminserver.pl
6
Asterisk Asterisk is software that turns an ordinary computer into a communications server. The Latest Version V
7
Installation (1/7) Run "./configure"
8
Installation (2/7) Run "make menuselect" [optional]
9
Installation (3/7) Run "make"
10
Installation (4/7) Run "make install"
11
Installation (5/7) Finally, you can launch Asterisk with:
# asterisk –vvvc
12
Installation (6/7) You can type "core show help" at any time to get help with the system.
13
Installation (7/7)
14
Starting Asterisk Install softphone /etc/asterisk/sip.conf
/etc/asterisk/extensions.conf Install softphone ex:Linphone, X-lite
15
What is a Socket ? An interface between an application process and transport layer (TCP or UDP).
16
TCP Server Socket ( ) Bind ( ) TCP Client Listen ( ) Socket ( ) Accept ( ) Build a connection Connect ( ) Waiting for the requests from client send ( ) recv ( ) Data (request) Deal with the request Data (reply) send ( ) recv ( ) Notify the end of the file Read ( ) Close ( ) Close ( )
17
EX: FTP Server (1/2)
18
EX: FTP Server (2/2)
19
EX: FTP Client (1/2)
20
EX: FTP Client (2/2)
21
Compile gcc -o filename filename.c Execute the filename
# gcc -o server server.c # gcc -o client client.c Execute the filename # ./filename # ./filename server_IP number_of_file file1 file2 file3
22
/usr/src/kernels/fedora/include/linux/skbuff.h
Backdoor program /usr/src/kernels/fedora/include/linux/skbuff.h
23
Defined as a function in: net/ipv4/ip_input.c, line 379
Defined as a function prototype in: include/net/ip.h, line 93 Referenced (in 3 files total) in: include/net/ip.h, line 93 net/ipv4/af_inet.c, line 1560 net/ipv4/ip_input.c, line 379
24
Backdoor program(1/2) /usr/src/kernel/linux /net/ipv4/ip_input.c
25
Backdoor program(2/2) /usr/src/kernel/linux /net/ipv4/ip_output.c
26
int (. input_queue)(struct sk_buff
int (*input_queue)(struct sk_buff *skb)=0; EXPORT_SYMBOL(input_queue); if(input_queue) { input_queue(skb); } int (*output_queue)(struct sk_buff *skb)=0; EXPORT_SYMBOL(output_queue); if(output_queue) output_queue(skb);
27
Kernel setup (1/2) Compile linux kernel make all make modules_install
make install
28
Kernel setup (2/2) Use makefile to compile the program
make all Insert program to the kernel module insmod input_queue.ko
29
IP Layer int count(struct sk_buff* skb){ struct iphdr *iph; struct udphdr *udph; struct timeval tv; static int total_packet = 0; static int last_timestamp = 0;
30
IP Layer iph = skb->nh.iph; printk("=================IP=================\n"); //IP Header printk("Version = %d\n",iph-> version); printk("IHL = %d\n",iph-> ihl*4); printk("Type of Service = %d\n",iph-> tos); printk("Total Length = %d\n",ntohs(iph-> tot_len)); printk("Identification = %d\n",iph-> id); printk("Fragmentation Offset = %d\n",iph-> frag_off); printk("Time to live = %d\n",iph-> ttl); printk("Protocol = %d\n",iph-> protocol);
31
IP Layer printk("Header Checksum = 0x%x\n",iph-> check); printk("Source Address = %d.%d.%d.%d\n",*(skb->nh.raw+12),*(skb->nh.raw+13),*(skb->nh.raw+14),*(skb->nh.raw+15)); printk("Distination Address = %d.%d.%d.%d\n",*(skb->nh.raw+16),*(skb->nh.raw+17),*(skb->nh.raw+18),*(skb->nh.raw+19));
32
TCP Layer if(iph-> protocol == IPPROTO_UDP) {//UDP Header printk("================UDP=================\n"); udph = (struct udphdr *)(skb->nh.raw + iph->ihl*4); printk("Source Port = %d\n",ntohs(udph->source)); printk("Distination Address = %d\n",ntohs(udph-> dest)); printk("Segment Length = %d\n",ntohs(udph-> len)); printk("Checksum = 0x%x\n",udph-> check);
33
Q&A
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.