Professional Documents
Culture Documents
MyServer.java file:-
import java.io.*;
import java.net.*;
public class MyServer{
public static void main(String[] args){
try
{
ServerSocket ss=new ServerSocket(6666);
Socket s=ss.accept();//establishes connection
DataInputStream dis=new
DataInputStream(s.getInputStream());
String str=(String)dis.readUTF();
System.out.println("message= "+str);
ss.close();
}
catch(Exception e){System.out.println(e);}
}
}
MyClient.java file:
import java.io.*;
import java.net.*;
public class MyClient
{
public static void main(String[] args)
{
try
{
Socket s=new Socket("localhost",6666);
DataOutputStream dout=new
DataOutputStream(s.getOutputStream());
dout.writeUTF("Hello Server");
dout.flush();
dout.close();
s.close();
}catch(Exception e){System.out.println(e);}
}
}
Output:
To execute this program open two command prompts
and execute each program at each command prompt.
1]
javac MyServer.java
java MyServer
2]
javac MyClient.java
java MyClient
Nmap commands
Steps:-
1. Execute the Nmap-Zenmap GUI tool from
Program Menu or Desktop Icon
2. Type the Target Machine IP Address(ie.Guest OS
or any website Address)
3. Select ‘intense scan’ in profile .
4. Type the following command in the command
box.
• nmap 192.168.56.101
• nmap -O 192.168.56.101
• nmap -sV 192.168.56.101
• nmap -T4 -A -v 192.168.56.101
Explaination:-
1. For target specifications: nmap <target‘s URL or IP
with spaces between them>
2. For OS detection: nmap -O <target-host's URL or
IP>
3. For version detection: nmap -sV <target-host's URL
or IP>
4. ‘nmap -T4 -A -v 192.168.56.101’ :- "-T4": This is an
option specifying the timing template for the
scan.”-A”:- This is another option, a shorthand for
enabling several advanced scan options
Extras(Incase Prachi maam betrays us):-
A]
Adding route:
sudo route add -net 192.168.3.0 gw 192.168.1.1
netmask 255.255.255.0 dev eth0
Deleting route:
sudo route del -net 192.168.3.0 gw 192.168.1.1
netmask 255.255.255.0 dev eth0