Exp No: Page No:
Date:
Experiment-12
Aim: Algorithm to implement Broadcast tree by taking subnet of hosts
Program:
#include<stdio.h>
#include<conio.h>
struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];
void main()
{
int dmat[20][20];
int n,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&n);
printf("Enter the cost matrix :\n");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&dmat[i][j]);
dmat[i][i]=0;
rt[i].dist[j]=dmat[i][j];
rt[i].from[j]=j;
}
}
do
{
count=0;
for(i=0;i<n;i++){
for(j=0;j<n;j++) {
for(k=0;k<n;k++) {
if(rt[i].dist[j]>dmat[i][k]+rt[k].dist[j]) {
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591
Exp No: Page No:
Date:
rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j];
rt[i].from[j]=k;
count++;
}
}
}
}
}while(count!=0);
for(i=0;i<n;i++) {
printf("\nState value for router %d is \n",i+1);
for(j=0;j<n;j++) {
printf("\nnode %d via %d Distance%d",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n");
}
Output:
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591
Exp No: Page No:
Date:
Augmented Experiments
Experiment-13
Aim: How to run Nmap scan
Step 1 below.
1. Download the Nmap installer. This can be found for free from the developer’s
website. It is highly recommended that you download directly from the developer
to avoid any potential viruses or fake files. Downloading the Nmap installer
includes Zenmap, the graphical interface for Nmap which makes it easy for
newcomers to perform scans without having to learn command lines.
2. Install Nmap. Run the installer once it is finished downloading. You will be asked
which components you would like to install. In order to get the full benefit of
Nmap, keep all of these checked. Nmap will not install any adware or spyware.
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591
Exp No: Page No:
Date:
3. Run the “Nmap – Zenmap” GUI program. If you left your settings at
default during installation, you should be able to see an icon for it on your
desktop. If not, look in your Start menu. Opening Zenmap will start the
program.
4. Enter in the target for your scan. The Zenmap program makes scanning a fairly
simple process. The first step to running a scan is choosing your target. You can
enter a domain (example.com), an IP address (127.0.0.1), a network
(192.168.1.0/24), or a combination of those.
5. Choose your Profile. Profiles are preset groupings of modifiers that change what
is scanned. The profiles allow you to quickly select different types of scans without
having to type in the modifiers on the command line. Choose the profile that best
fits your needs
6. Click Scan to start scanning. The active results of the scan will be displayed in
the Nmap Output tab. The time the scan takes will depend on the scan profile you
chose, the physical distance to the target, and the target’s network configuration.
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591
Exp No: Page No:
Date:
7. Read your results. Once the scan is finished, you’ll see the message “Nmap done”
at the bottom of the Nmap Output tab. You can now check your results, depending
on the type of scan you performed. All of the results will be listed in the main
Nmap Output tab, but you can use the other tabs to get a better look at specific
data.[2]
Ports/Hosts - This tab will show the results of your port scan, including the
services for those ports.
Topology - This shows the traceroute for the scan you performed. You can see how
many hops your data goes through to reach the target.
Host Details - This shows a summary of your target learned through scans, such as
the number of ports, IP addresses, hostnames, operating systems,
and more.
Scans - This tab stores the commands of your previously-run scans. This allows
you to quickly re-scan with a specific set of parameters.
•
•
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591
Exp No: Page No:
Date:
Experiment-14
Aim: Operating System Detection using Nmap
Program:
# nmap -O -v scanme.nmap.org
Starting Nmap ( https://nmap.org )
Nmap scan report for scanme.nmap.org (74.207.244.221)
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
646/tcp filtered ldp
1720/tcp filtered H.323/Q.931
9929/tcp open nping-echo
31337/tcp open Elite
Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:linux_kernel:2.6.39
OS details: Linux 2.6.39
Uptime guess: 1.674 days (since Fri Sep 9 12:03:04 2011)
Network Distance: 10 hops
TCP Sequence Prediction: Difficulty=205 (Good luck!)
IP ID Sequence Generation: All zeros
Read data files from: /usr/local/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 5.58 seconds
Raw packets sent: 1063 (47.432KB) | Rcvd: 1031 (41.664KB)
ADITYA ENGINEERING COLLEGE (A) Roll No: 22A91A0591