Final Manual For CN Lab - CSE (AIML)
Final Manual For CN Lab - CSE (AIML)
Wireshark, a network analysis tool formerly known as Ethereal, captures packets in real time and display them in
human-readable format. Wireshark includes filters, color coding, and other features that let you dig deep into
network traffic and inspect individual packets.
Capturing Packets
After downloading and installing Wireshark, you can launch it and double-click the name of a network interface
under Capture to start capturing packets on that interface. For example, if you want to capture traffic on your
wireless network, click your wireless interface. You can configure advanced features by clicking Capture >
Options, but this isn’t necessary for now.
ADVERTISEMENT
As soon as you click the interface’s name, you’ll see the packets start to appear in real time. Wireshark captures
each packet sent to or from your system.
Click the red “Stop” button near the top left corner of the window when you want to stop capturing traffic.
Color Coding
Wireshark uses colors to help you identify the types of traffic at a glance. By default, light purple is TCP traffic,
light blue is UDP traffic, and black identifies packets with errors—for example, they could have been delivered out
of order.
To view exactly what the color codes mean, click View > Coloring Rules. You can also customize and modify the
coloring rules from here, if you like.
Sample Captures
If there’s nothing interesting on your own network to inspect, Wireshark’s wiki has you covered. The wiki contains
a page of sample capture files that you can load and inspect. Click File > Open in Wireshark and browse for your
downloaded file to open one.
also save your own captures in Wireshark and open them later. Click File > Save to save your captured packets.
Filtering Packets
You can also click Analyze > Display Filters to choose a filter from among the default filters included in
Wireshark. From here, you can add your own custom filters and save them to easily access them in the future.
For more information on Wireshark’s display filtering language, read the Building display filter expressions page
in the official Wireshark documentation.
Another interesting thing you can do is right-click a packet and select Follow > TCP Stream.
Close the window and you’ll find a filter has been applied automatically. Wireshark is showing you the packets
that make up the conversation.
Inspecting Packets
Click a packet to select it and you can dig down to view its details.
You can also create filters from here — just right-click one of the details and use the Apply as Filter submenu to
create a filter based on it.
Wireshark is an extremely powerful tool, and this tutorial is just scratching the surface of what you can do with it.
Professionals use it to debug network protocol implementations, examine security problems and inspect network
protocol internals.
14. How to Run a Simple Nmap Scan
Step 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.
The Zenmap program is available for Windows, Linux, and Mac OS X. You can find the installation files
for all operating systems on the Nmap website.
Step 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.
Step 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.
Step 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.
Depending on the intensity and target of your scan, running an Nmap scan may be against the terms of your
internet service provider, and may land you in hot water. Always check your local laws and your ISP contract
before performing Nmap scans on targets other than your own network.
Step 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:[1]
Intense scan - A comprehensive scan. Contains Operating System (OS) detection, version detection, script
scanning, traceroute, and has aggressive scan timing. This is considered an intrusive scan.
Ping scan - This scan simply detects if the targets are online, it does not scan any ports.
Quick scan - This is quicker than a regular scan due to aggressive timing and only scanning select ports.
Regular scan - This is the standard Nmap scan without any modifiers. It will return ping and return open
ports on the target.
Step 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.
Step 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.
15. Operating System Detecting using Nmap
Service and OS detection
Nmap is one of the most popular tools used for the enumeration of a targeted host. Nmap can use scans that
provide the OS, version, and service detection for individual or multiple devices. Detection scans are critical to the
enumeration process when conducting penetration testing of a network. It is important to know where vulnerable
machines are located on the network so they can be fixed or replaced before they are attacked. Many attackers will
use these scans to figure out what payloads would be most effective on a victim's device. The OS scan works by
using the TCP/IP stack fingerprinting method. The services scan works by using the Nmap-service-probes database
to enumerate details of services running on a targeted host.
Detect OS and services
This is the command to scan and search for the OS (and the OS version) on a host. This command will provide
valuable information for the enumeration phase of your network security assessment (if you only want to detect the
operating system, type nmap -O 192.168.0.9):
nmap -A 192.168.0.9
sniffers-12.jpg
Service and OS detection depend on different techniques to determine the operating system or service running on a
certain port. A more aggressive service detection is useful if there are services running on unexpected ports,
although the lighter version of the service will be much faster and leave less of a footprint. The lighter scan does
not attempt to detect the service; it simply grabs the banner of the open service to determine what is running.
Nmap output formats
Save default output to file
This command saves the output of a scan. With Nmap, you can save the scan output in different formats:
nmap -oN outputfile.txt 192.168.0.12
sniffers-16.jpg
NS2 provides users with an executable command ns which takes on input argument, the name of a Tcl simulation
scripting file. Users are feeding the name of a Tcl simulation script (which sets up a simulation) as an input
argument of an NS2 executable command ns.
In most cases, a simulation trace file is created, and is used to plot graph and/or to create animation. NS2 consists
of two key languages: C++ and Object-oriented Tool Command Language (OTcl). While the C++ defines the
internal mechanism (i.e., a backend) of the simulation objects, the OTcl sets up simulation by assembling and
configuring the objects as well as scheduling discrete events (i.e., a frontend).
Tcl scripting
Basics of TCL
Hello World!
NS Simulator Preliminaries.
Which is thus the first line in the tcl script. This line declares a new variable as using the set command, you can
call this variable as you wish, In general people declares it as ns because it is an instance of the Simulator
class, so an object the code[new Simulator] is indeed the installation of the class Simulator using the reserved
word new.
In order to have output files with data on the simulation (trace files) or files used for visualization (nam files),
we need to create the files using ―open command:
#Open the Trace file
set tracefile1 [open out.tr w]
$ns trace-all $tracefile1
Once we define several nodes, we can define the links that connect them. An example of a
definitionof a link is:
Which means that $n0 and $n2 are connected using a bi-directional link that has 10ms of
propagationdelay and a capacity of 10Mb per sec for each direction.
To define a directional link instead of a bi-directional one, we should replace ―duplex-link by
―simplex-link.
In ns, an output queue of a node is implemented as a part of each link whose input is that node.
Weshould also define the buffer capacity of the queue related to each link. An example would be:
The command $ns attach-agent $n0 $tcp defines the source node of the tcp connection.
The command set sink [new Agent /TCPSink] Defines the behavior of the destination node of
TCPand assigns to it a pointer called sink.
#Setup a UDP
connection set
udp [new
Agent/UDP]
$ns attach-agent
$n1 $udp set null
[new Agent/Null]
TCP has many parameters with initial fixed defaults values that can be changed if mentioned explicitly.
For example, the default TCP packet size has a size of 1000bytes.This can be changed to another value,
say 552bytes, using the command $tcp set packetSize_ 552.