Write a C program that can transparently authenticate all IP packets from/to specified IP address with given key.
program.c such that program (e.g., program 192.124.5.5 secret) will intercept packets
for any outgoing packet to the specified , transparently change the original payload X (the bytes after the IP header) by concatenating the original payload X with 16 bytes of md5(X|key), and adjust the IP header accordingly (e.g., increase the packet total length, re-calculate the checksum) so that the outgoing packet will have payloadX|md5(X|key)to
for any incoming packet from specified , check the packet payload for the md5 authentication with the given . Specifically, divide the packet payload (those bytes after the IP header) as two parts X, Y where Y is the last 16 bytes of the packet payload and X is the rest. If ( md5(X|key) == Y), change the payload of the incoming packet from X|Y to X, and adjust the IP header accordingly (e.g., decrease the packet total length, re-calculate the checksum) so that the incoming packet will be restored to its original form without keyed md5 authentication before sent to the receiving process. Otherwise, print out error message of failed authentication and drop the incoming packet.
Once you have developed such program, you need to run two instances of VM1 & VM2 and to make VM1 & VM2 have two different IP addresses (e.g., ip1, ip2). They should be able to ping to each other. On VM1, set up appropriate ipfw rules to divert incoming/outgoing traffic from/to VM2 to <divert port>. Similarly, on VM2, set up appropriate ipfw rules to divert incoming/outgoing traffic from/to VM1 to <divert port>
Please include output of the code of experiments:
a) At VM1, run ./program secretKey
At VM2, run./ip_authAll secretKey
ping from VM1 to VM2
ping from VM2 to VM1
C Program to display hostname and IP address
There are many ways to find Hostname and IP address of a local machine. Here is a simple method to find hostname and IP address using C program.
We will be using the following functions :-
gethostname() : The gethostname function retrieves the standard host name for the local computer.
gethostbyname() : The gethostbyname function retrieves host information corresponding to a host name from a host database.
inet_ntoa() : The inet_ntoa function converts an (Ipv4) Internet network address into an ASCII string in Internet standard dotted-decimal format.
// C program to display hostname
// and IP address
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
// Returns hostname for the local computer
void checkHostName(int hostname)
{
if (hostname == -1)
{
perror("gethostname");
exit(1);
}
}
// Returns host information corresponding to host name
void checkHostEntry(struct hostent * hostentry)
{
if (hostentry == NULL)
{
perror("gethostbyname");
exit(1);
}
}
// Converts space-delimited IPv4 addresses
// to dotted-decimal format
void checkIPbuffer(char *IPbuffer)
{
if (NULL == IPbuffer)
{
perror("inet_ntoa");
exit(1);
}
}
// Driver code
int main()
{
char hostbuffer[256];
char *IPbuffer;
struct hostent *host_entry;
int hostname;
// To retrieve hostname
hostname = gethostname(hostbuffer,
sizeof(hostbuffer));
checkHostName(hostname);
// To retrieve host information
host_entry = gethostbyname(hostbuffer);
checkHostEntry(host_entry);
// To convert an Internet network
// address into ASCII string
IPbuffer = inet_ntoa(*((struct in_addr*)
host_entry->h_addr_list[0]));
printf("Hostname: %s\n", hostbuffer);
printf("Host IP: %s", IPbuffer);
return 0;
}
Write a C program that can transparently authenticate all IP packets from/to specified IP address with...
1. To which of the following subnets does IP address 225.3.2.22 belong? 225.3.2.0/24 225.3.2.22/24 225.2.3.0/24 225.0.0.0/24 none of the above Question 2 On which of the following devices does the transport layer NOT run? laptop router cellphone A, B and C none of the above Question 3 What is the source address contained in the discover message sent by a host that is wanting to obtain an IP address? 255.255.255.255 0.0.0.0 the IP address of the server the last IP...
1. Let’s consider the network shown in Figure 1 where Snort is
deployed.
1.1: In Figure 1, why is Snort deployed in the DMZ instead of
the Internal Network? (9 points)
1.2: In Figure 1, say True or False to the following statement:
“Snort can see both incoming packets from the left firewall and
outgoing packets from the right firewall”. (5 points)
1.3: In Figure 1, assume a packet P matches the following Snort
rule when the packet is analyzed...
. each of the following, write ONE of the letters AB to indicate your answer If the receiver R of an ARP packet p sent by S does not have S's binding in its cache, which is a true? A. Only I B. Only II C. Only III D.Only I and II E. Only I and III F. Only II and GIII and I IR caches S's binding if p is a broadcast and R is the target II. R...
Using python 3 to create the UDP Ping Clien and server. Using UDP sockets, you will write a client and server program that enables the client to determine the round-trip time (RTT) to the server. To determine the RTT delay, the client records the time on sending a ping request to the server, and then records the time on receiving a ping response from the server. The difference in the two times is the RTT. The ping message contains 2...
I need help with this assignment, please; Programming Assignment 3: UDP Pinger Lab In this lab, you will study a simple Internet ping server written in the Java language, and implement a corresponding client. The functionality provided by these programs is similar to the standard ping programs available in modern operating systems, except that they use UDP rather than Internet Control Message Protocol (ICMP) to communicate with each other. (Java does not provide a straightforward means to interact with ICMP.)...
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined functions arrays, and a random number generator. Upon program execution, the screen will be cleared and the menu shown below will appear at the top of the screen and centered. The menu items are explained below. Help Smallest Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user...
PART A 21 MARKS
SHORT ANSWER QUESTIONS Answer ALL questions from this part. Write
your answers in the Examination Answer Booklet. Each question is
worth 1.5 marks (14 x 1.5 = 21 marks).
Question 1
An organisation has been granted a block of addresses with the mask
/22. If the organisation creates 8 equal-sized subnets, how many
addresses (including the special addresses) are available in each
subnet? Show your calculations.
Question 2
Give an example of a valid classful address...
Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...