Find all the practical at one place of Gujarat Technological University(GTU) With Solutions.
Sunday, June 30, 2019
TCP / UDP connectivity using Netcat
What is Netcat
Netcat (nc) is a computer networking service for reading from and writing to network connections using TCP or UDP.
it is a feature-rich network debugging and investigation tool
it is a feature-rich network debugging and investigation tool
- Its list of features includes
- port scanning
- port binding
- transferring files
- port listening
- it can be used as a backdoor
- Ability to use any local source port
Netcat Command Flags
Command Flags | Description |
---|---|
-u | UDP (User Datagram Protocol) |
-z | Don't send any Data, just emit a packet without payload(scanning) |
-v | be verbose : print out messages on standard information |
-n | do not perform DNS lookup on name of system on the other side |
-l | Listen mode |
-L | Listen harder |
How To Use Netcat for Port Scanning
Here, we can scan all ports up to 1000 by issuing this command:
netcat -z -v targetdomain.com 1-1000
OutputScan will go much faster if you know the IP address that you need.
netcat -z -n -v 127.0.0.1 1-1000
output
How To Communicate through Netcat
Netcat is not restricted to sending TCP and UDP packets. It also can listen on a port for connections and packets. This gives us the opportunity to connect two instances of netcat in a client-server relationship. one system, you can tell netcat to listen to a specific port for connections.
netcat -l 1234
This will tell netcat to listen for TCP connections on port 1234 second server, we can connect to the first machine on the port number we choose
netcat targetdomain.com 1234
Type a message and press ENTER. It will appear on both the local and remote screen. This works in the opposite direction as well. When you are finished passing messages, you can press CTRL-D to close the TCP connectionPort scanning using NMAP
What is Nmap
- Nmap (Network Mapper) is a free and open source (license) utility.
- Nmap can network discovery and security auditing.
- Many systems and network administrators also find it useful for tasks such as
- network inventory
- managing service upgrade schedules
- monitoring host
- service uptime
- Nmap uses raw IP packets in novel ways to determine
- what hosts are available on the network
- what services (application name and version) those hosts are offering
- what operating systems (and OS versions) they are running
- what type of packet firewall are in use
- and dozens of other characteristics
What is TCP Scanning
- The two basic scan types used most in Nmap are
- TCP connect scanning
- TCP SYN scanning
- sockets programming uses a system call named connect to begin a TCP connection to a remote site. If connect succeeds, a connection was made.This allows a basic type of port scan, which attempts to connect to every port in turn, and notes whether or not the connection succeeded. Once the scan is completed, ports to which a connection could be established are listed as open, the rest are said to be closed.
- When a TCP connection is made between two systems, a process known as a "three way handshake" occurs. This involves the exchange of three packets, and synchronises the systems with each other.
Nmap Practical using Nmap tools
Step 1 : Open Zenmap in your computer
Step 2 : In Target Filed Write IP Address or Website (Target System) and click on scan button
In Following Image we include UDP port scan
Step 3 : You can find open port list if they are otherwise u cant get any open port
Step 4 : You can find Traceroute path on Topology tab
Step 5 : You can find all the host details in Host Details tab
How to Install Nmap(zenmap) in Windows and Linux
Download the Software Form this source:Nmap
How to Install Nmap(zenmap) in Linux RPM
TCP scanning using NMAP
What is Nmap
- Nmap (Network Mapper) is a free and open source (license) utility.
- Nmap can network discovery and security auditing.
- Many systems and network administrators also find it useful for tasks such as
- network inventory
- managing service upgrade schedules
- monitoring host
- service uptime
- Nmap uses raw IP packets in novel ways to determine
- what hosts are available on the network
- what services (application name and version) those hosts are offering
- what operating systems (and OS versions) they are running
- what type of packet firewall are in use
- and dozens of other characteristics
What is TCP Scanning
- The two basic scan types used most in Nmap are
- TCP connect scanning
- TCP SYN scanning
- sockets programming uses a system call named connect to begin a TCP connection to a remote site. If connect succeeds, a connection was made.This allows a basic type of port scan, which attempts to connect to every port in turn, and notes whether or not the connection succeeded. Once the scan is completed, ports to which a connection could be established are listed as open, the rest are said to be closed.
- When a TCP connection is made between two systems, a process known as a "three way handshake" occurs. This involves the exchange of three packets, and synchronises the systems with each other.
Nmap Practical using Nmap tools
Step 1 : Open Zenmap in your computer
Step 2 : In Target Filed Write IP Address or Website (Target System) and click on scan button
Step 3 : You can find open port list if they are otherwise u can't get any open port
Step 4 : You can find Traceroute path on Topology tab
Step 5 : You can find all the host details in Host Details tab
How to Install Nmap(zenmap) in Windows and Linux
Download the Software Form this source:Nmap
How to Install Nmap(zenmap) in Linux RPM
Prepare an activity diagram for computing a restaurant bill, there should be charge for each delivered item. The total amount should be subject to tax and service charge of 18% for group of six and more. For smaller groups there should be a blank entry. Any coupons or gift certificates submitted by the customer should be subtracted
Categorize the following relationships into generalization, aggregation or association
A country has a capital city
A dining philosopher uses a fork
A file is an ordinary file or a directory file
Files contains records
A polygon is composed of an ordered set of points
A drawing object is text, a geometrical object, or a group
A person uses a computer language on a object
Modems and keyboards are input/output devices
Classes may have several attributes
A person plays for a team in a certain year
A route connects two cities
A student takes a course from a professor
Refine the student manager program to manipulate the student information from files by using the DataInputStream and DataOutputStream. Assume suitable data
import java.io.*;
public class Dataio {
public static void main(String args[]) throws IOException {
DataInputStream dataIS = new DataInputStream(new FileInputStream("stdinfo.txt"));
DataOutputStream dataOS = new DataOutputStream(new FileOutputStream("newstdinfo.txt"));
// manipulate the student information from files
String str;
while ((str = dataIS.readLine()) != null) {
String upper = str.toUpperCase();
System.out.println(upper);
dataOS.writeBytes(upper + " ,");
}
dataIS.close();
dataOS.close();
}
}
Refine the student manager program to manipulate the student information from files by using the BufferedReader and BufferedWriter
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class Student {
public static void main(String[] argv) throws Exception {
BufferedReader bufRead = new BufferedReader(new FileReader("stdinfo.txt"));
BufferedWriter bufWrite = new BufferedWriter(new FileWriter("newstdinfo.txt"));
int i;
// manipulate the student information from files
do {
i = bufRead.read();
if (i != -1) {
if (Character.isUpperCase((char) i)) {
bufWrite.write(Character.toLowerCase((char) i));
} else {
bufWrite.write((char) i);
}
}
} while (i != -1);
bufRead.close();
bufWrite.close();
}
}
Create a class called Student. Write a student manager program to manipulate the student information from files by using FileInputStream and FileOutputStream
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Student {
public static void main(String[] args) {
System.out.println("-------Writing Data in File-------");
try {
FileOutputStream fout = new FileOutputStream("stdinfo.txt");
String str = "Nmae : Sachin, Stream : Computer Engineering, Sem : 5th Sem";
byte b[] = str.getBytes();
fout.write(b);
fout.close();
System.out.println("successful write.");
} catch (Exception e) {
System.out.println(e);
}
System.out.println("-------Retrive Data From File-------");
try {
FileInputStream fin = new FileInputStream("stdinfo.txt");
int i = 0;
while ((i = fin.read()) != -1) {
System.out.print((char) i);
}
fin.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
Write an interactive program to print a diamond shape. For example, if user enters the number 3
import java.util.Scanner;
public class demo {
public static void main(String[] args) {
int i, j, k;
Scanner scan = new Scanner(System.in);
int no = scan.nextInt();
for (i = 0; i < no; i++) {
for (j = (no / 2) + 1; j >= i; j--) {
System.out.print(" ");
}
for (k = 0; k <= i; k++) {
System.out.print("* ");
}
System.out.println();
}
for (i = 0; i < no; i++) {
System.out.print(" ");
for (j = 0; j <= i; j++) {
System.out.print(" ");
}
for (k = no - 1; k > i; k--) {
System.out.print("* ");
}
System.out.println();
}
}
}
Subscribe to:
Posts (Atom)
-
A country has a capital city A dining philosopher uses a fork A file is an ordinary file or a directory file Files cont...
-
import java.io.*; public class Dataio { public static void main(String args[]) throws IOException { DataInputStr...