Docuument Networking
Docuument Networking
Submitted by
Submitted to
Dr. D Saravanan
April, 2023
Table of Contents
Experiment No. 1
1) arp
Name: Bhavesh Kushwaha
DATE of Submission: 11/04/2023
Registration no: 22MCA10023
In a local area network (LAN), the Address Resolution Protocol (ARP) process maps a dynamic address to a
permanent physical machine address. A media access control (MAC) address is another name for the actual machine
address.
2) hostname
The hostname command shows the host system's name. The host name can only be changed by someone
with root user authority.
3) ipconfig
displays all of the TCP/IP network configuration values that are currently in effect and updates the DHCP
and DNS settings. Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet masks, and default
gatewayare shown for all adapters when ipconfig is used without any options.
4) ipconfig /all
Ipconfig /all shows full configuration details for each TCP/IP-connected adapter.
6) ipconfig /release :
Ipconfig/release notifies a DHCP server that you no longer want the address it gave you the last
time you asked for it. If you no longer require the address, this is probably a very courteous
thing to do.
A fresh IP address is requested via Ipconfig/renew from the DHCP server.
7)ipconfig /flushdns :
8) netstat –a :
For each protocol, the netstat -s command displays statistics (while the netstat -p command shows the
statistics for the specified protocol). Just the following protocols' statistics are shown by the netstat -s
command: UDP, TCP.
9) nbtstat –a
shows statistics for the NetBIOS over TCP/IP (NetBT) protocol, as well as the NetBIOS name cache and local and
remote NetBIOS name tables. Moreover, this operation enables the NetBIOS name cache and Windows Internet
10) nslookup :
The application known as "nslookup" enables any computer user or Internet server
administrator to enter a host name (for instance, "whatis.com") and discover the related IP
address or domain name system (DNS) record.
11) ping :
The Internet Control Message Protocol (ICMP), which is part of TCP/internet IP's layer, is used by the ping
application. The simplest application of it is to validate network connectivity between two hosts. Ping
transmits an ICMP echo request, and it waits for a response in the form of an ICMP echo reply.
12) pathping :
The results of this command are computed based on the packets returned from each router after several
echo Request messages have been sent to each router between a source and a destination over a period
of time.
13) route :
You can manually add entries to the network routing tables using the route command. The network address
of the Destination variable, which can be supplied either by symbolic name or numeric address, is how the
route command differentiates between routes to hosts and routes to networks.
14) tracert :
By delivering Internet Control Message Protocol (ICMP) echo packets to a target, the TRACERT diagnostic
tool ascertains the path to the location. TRACERT employs various IP Time-To-Live (TTL) values in these
packets.
Experiment No. 2
import java.io.*;
import java.net.*;
public class MyServer{
public static void main(String[] args) throws IOException{
try{
ServerSocket ss=new ServerSocket(port:6666);
Socket s=ss.accept();
DataInputStream dis=new DataInputStream(s.getInputStream());
String str=(String)dis.readUTF();
System.out.println(x:"Waiting for the Client");
System.out.println("message= "+str);
ss.close();
}catch(Exception e){
System.out.println(e);
}
}
}
OUTPUT:
Experiment No. 3
By sending the client's IP address to the server and displaying it inside the server's facilities,
the connection is also ensured.
Aim :
Write a Socket Program for Server and Client to print IP address and Name that details sent
by client
Procedure :
2) A socket connection indicates that the two devices are aware of each other's network
position.
4) Use the Socket object and its getRemoteSocketAddress function to determine the
current system's IP address ()
Communication :
Data input and output are done via streams for communication across a socket connection.
Once the message to the server is sent, the socket connection is explicitly closed.
import javax.sound.sampled.Port;
public class MyServer{
public static void main(String[] args) throws IOException{
try{
ServerSocket ss=new ServerSocket(6666);
Socket s=ss.accept();
DataInputStream dis=new DataInputStream(s.getInputStream());
String str=(String)dis.readUTF();
System.out.println("Waiting for the Client");
System.out.println("message= "+str);
ss.close();
}catch(Exception e){
System.out.println(e);
}
}
}
String m1=s.getRemoteSocketAddress().toString();
System.out.println("Enter name ");
String m2=sc.next();
dout.writeUTF("Hello Server"+" Number "+m1+" And Name is "+m2);
//dout.flush();
dout.close();
s.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Output :
Experiment No. 4
AIM
To implement Remote Command Execution(RCE).
ALGORITHM-
CLIENT SIDE:
Connecting the Client and Server is step one. new Socket("127.0.0.1",6555); socket client
2. Construct streams of instances for the input and output.
3. BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in)); Print Stream ps=new Print
Stream(client.getOutputStream());
4. In the Client Window, type the command. Deliver a message to the output using these commands:
str=br.readLine(); ps.println(str);
SERVER SIDE:
1. Accept the connection request by the client. ServerSocket server=new ServerSocket(6555);
Sockets=server.accept();
2. Getthe IPaddressfromitsinputstream.
BufferedReaderbr1=newBufferedReader(newInputStreamReader(s.getInputStream())); ip=br1.readLine();
3. During runtime execute the process Runtime r=Runtime.getRuntime(); Process p=r.exec(str);
CODE :
CLIENT PROGRAM:
import java.io.*; import java.net.*; class clientRCE
{
SERVER PROGRAM:
import java.io.*; import java.net.*; class serverRCE
{
public static void main(String args[]) throws IOException
{
try
{
String str;
ServerSocket server=new ServerSocket(6555); Socket s=server.accept();
BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream())); str=br.readLine();
Runtime r=Runtime.getRuntime(); Process p=r.exec(str);
}
catch(IOException e)
{
System.out.println("Error"+e);
OUTPUT
C:\Users\user\Documents\DCN>java serverRCE.java
C:\Users\user\Documents\DCN>java clientRCE.java
CLIENT WINDOW
Enter TheCommand:
NOTEPAD:
RESULT:
Thus the implementation RCE is done & executed successfully.
Experiment No. 5
Aim:
To implement Arp Spoofing in terminal
Algorithm:
1) Open terminal as administrator
2) Enter arp/a interminal
3) Enter arp -s “System IP address”,”random mac address”
4) Click Enter
Code:
Arp -s 172.25.43.197 01-00-5e-00-00-fb
Output:
Result:
Hence the ARP Spoofing is done