Download presentation
Presentation is loading. Please wait.
1
Training 2018/10/11
2
Scenario
3
Router Crossover IP forward Route Backdoor 鳥哥的 Linux 私房菜
Route d.php#route Backdoor
4
第1題 As shown in the above figure, set up a 2-port Linux PC Router and install Linux open source VoIP (Asterisk or Linphone) and video streaming server (Darwin or VLC) on PC1 and PC2. Use microphones and MPEG-4 clips to examine whether you have installed Asterisk/Linphone and Darwin/VLC successfully. <Note>: you need two Ethernet cards and two crossover UTP cables to form a router network.
5
Application VOIP Asterisk Video streaming Darwin TCP Socket
6
VOIP Installation (1/7) Run "./configure"
7
Installation (2/7) Run "make menuselect" [optional]
8
Installation (3/7) Run "make"
9
Installation (4/7) Run "make install"
10
Installation (5/7) Finally, you can launch Asterisk with:
# asterisk –vvvc
11
Installation (6/7) You can type "core show help" at any time to get help with the system.
12
Installation (7/7)
13
Starting Asterisk Install softphone /etc/asterisk/sip.conf
/etc/asterisk/extensions.conf Install softphone ex:Linphone, X-lite
14
VOD Server : Darwin (5.5.5) Client : VLC player
MP4Box : Mp4 hint track rtsp:// /example.mp4
15
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
16
Starting sudo /usr/local/sbin/DarwinStreamingServer
sudo /usr/local/sbin/streamingadminserver.pl
17
第2題 Write down client/server programs by using TCP socket. Your client/server programs must work with Asterisk/Linphone (VoIP) and Darwin/VLC (VoD) and it must allow two users to send and receive English/Chinese text messages (ASCII code) to each other.
18
TCP socket
19
TCP socket server
20
TCP socket client
21
module Use makefile to compile the program
make all Insert program to the kernel module insmod input_queue.ko rmmod input_queue lsmod
22
IP header
23
TCP/ UDP header
24
RTP Header
25
IP Layer int count(struct sk_buff* skb){ struct iphdr *iph; struct tcphdr *tcph; struct udphdr *udph; struct timeval tv; static int total_packet = 0; static int last_timestamp = 0;
26
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);
27
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));
28
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);
29
第3題 On Linux router (1) Write down a backdoor program on the router to measure the average packet forwarding delay for Darwin/VLC video streaming. Packet forwarding delay is defined from the time when sk_buff is constructed for the packet untill the time when the packet is removed from sk_buff.
30
第3題 On PC-1/PC-2 (2) Write down a backdoor program on PC-1/PC-2 to measure average throughput for Asterisk/Linphone and Darwin/VLC, respectively. Compare their differences. (3) Intercept IP packets on client/server and count how many packets generated for different sizes of text messages (e.g., 10, 50, 100 English/Chinese words).
31
/usr/src/kernels/fedora/include/linux/skbuff.h
Backdoor program /usr/src/kernels/fedora/include/linux/skbuff.h
32
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
33
Backdoor program(1/2) /usr/src/kernel/linux /net/ipv4/ip_input.c
34
Backdoor program(2/2) /usr/src/kernel/linux /net/ipv4/ip_output.c
35
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);
36
Kernel setup Compile linux kernel make all make modules_install
make install
37
AWK
38
Due Day Demo (three in a team) on Nov 7-10, 2018.
Report (individual, 15 pages) due before 9:00pm on Nov 12, 2018.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.