CC-Lab Programs
CC-Lab Programs
NO: 1
DATE: 03/07/2023
AIM:
Demonstration of RPC protocol to communicate in a Decentralized LAN.
PROCEDURE:
CODE:
# Server Program
from jsonrpclib.SimpleJSONRPCServer
import SimpleJSONRPCServer
def findsum(num1,num2):
res=num1+num2
return res
def main():
server = SimpleJSONRPCServer(('localhost',1006))
server.register_function(findsum)
print("Start server")
server.serve_forever()
if __name__ == '__main__':
main()
# Call by Client
from jsonrpclib import Server
def main():
conn = Server('http://localhost:1006')
print(conn.findsum(100,200))
if __name__ == '__main__':
main()
OUTPUT :
SERVER PROGRAM :
CLIENT PROGRAM
RESULT:
Thus, the program of the Bully Algorithm using python is executed successfully and the output is
verified.
EX.NO: 2
DATE: 10/07/2023
AIM:
To avoid deadlock and allocate resources safely to each process in the computer system.
PROCEDURES:
1. Create a class “BankersAlgorithm” and create a constructor to initialize the required variable.
2. Create a function to check the Safe State using a for loop to iterate through each process.
3. If the resources are available to execute the process then add the process into the safe sequence
list.
4. After complete iteration of all the processes, if the sequence of processes is safe to execute it will
return True otherwise False.
CODE:
class BankersAlgorithm:
def __init__(self, allocation, max_resources, available_resources):
self.allocation = allocation # Allocation matrix (process x resource)
self.max_resources = max_resources # Max resources needed matrix
(process x resource)
self.available_resources = available_resources # Available
resources vector (resource)
self.num_processes = len(allocation)
self.num_resources = len(available_resources)
def is_safe_state(self):
# Initialize work and finish vectors
work = self.available_resources.copy()
finish = [False] * self.num_processes
# Initialize a sequence to store safe sequence
safe_sequence = []
# Loop through all processes
for _ in range(self.num_processes):
# Find a process that can be executed
for process in range(self.num_processes):
if not finish[process]:
# Check if resources are available for this process
if all(work[i] >= self.max_resources[process][i] -
self.allocation[process][i] for i in range(self.num_resources)):
# Add the process to the safe sequence
safe_sequence.append(process)
# Release allocated resources
work = [work[i] + self.allocation[process][i] for i in
range(self.num_resources)]
finish[process] = True
break
# If all processes are in the safe sequence, return True
if all(finish):
print("Safe Sequence:", safe_sequence)
return True
else:
print("Unsafe State")
return False
# Example usage:
allocation_matrix = [
[0, 1, 0],
[2, 0, 0],
[3, 0, 2],
[2, 1, 1],
[0, 0, 2]
]
max_matrix = [
[7, 5, 3],
[3, 2, 2],
[9, 0, 2],
[2, 2, 2],
[4, 3, 3]
]
available_resources_vector = [3, 3, 2]
banker = BankersAlgorithm(allocation_matrix, max_matrix,
available_resources_vector)
banker.is_safe_state()
OUTPUT:
RESULT:
Thus, the program of the Banker’s Algorithm using python is executed successfully and the output is
verified.
EX.NO: 3
DATE: 18/07/2023
AIM:
To elect a coordinator or leader from a group of distributed systems.
PROCEDURES:
1. Create class “bully” and a function getval() to get user input of ‘status of system’ and ‘priority of
the system’
2. Create a function elect() to compare the priority of the system and return the Active system with
highest priority.
3. Create a function startelect() to get the process number which initiates the election and print the
final coordinator system by calling the elect function.
4. Create the object of bully class to call the function getval() and startelect().
CODE:
class bully:
st = []
prio=[]
co=0
# number of elements as input
n = int(input("Enter number of elements : "))
def elect(self,ele):
ele=ele-1
self.co=ele+1
for i in range(0, self.n):
if(self.prio[ele]<self.prio[i]):
print("Election message is sent from ",(ele+1)," to ",(i+1),)
if(self.st[i]==1):
self.elect(i+1)
return self.co
def startelect(self):
ele=int(input("Which process will initiate election?"))
print("Final coordinator is ",self.elect(ele))
obj=bully()
obj.getval()
obj.startelect()
OUTPUT:
RESULT:
Thus, the program of the Bully Algorithm using python is executed successfully and the
output is verified.
EX.NO: 4
DATE: 24/07/2023
RING ALGORITHM
AIM:
To elect a coordinator or leader from a group of distributed systems.
PROCEDURES:
Step 1: Create a list of processes, each with a unique identifier (pid), a boolean flag is_leader (initially
set to False), and a lock to ensure safe message passing.
Step 2: Start a thread for each process to run the following steps concurrently:
a. Simulate some work (to mimic real-world processing delays).
b. Pass a message to the next process in the ring by acquiring the lock of the next process to ensure
safe message passing. If a process receives a message and is not the leader, it checks the next step.
c. Check if the process has the highest identifier (pid) among all processes it knows about (including
itself). If it does, set its is_leader flag to True, indicating it has become the leader.
Step 3: After all threads have completed, the leader is the process with is_leader set to True.
CODE:
import random
import time
from threading import Thread, Lock
class Process:
def __init__(self, pid):
self.pid = pid
self.is_leader = False
self.lock = Lock()
def run(self):
# Simulate some work
time.sleep(random.uniform(0.1, 0.5))
OUTPUT:
RESULT:
Thus, the program of the Ring Algorithm using python is executed successfully and
the output is verified.
EX.NO: 5
DATE: 25/07/2023
3.The Rename dialog box will appear. Type a name for your file, then click OK.
4. Your file will be renamed. You can access the file at any time from your Google Drive, where it will be
saved automatically. Simply double-click to open the file again.
You may notice that there is no Save button for your files. This is because Google Drive uses autosave,
which automatically and immediately saves your files as you edit them.
Google Docs:
Google Slides:
Google Sheets:
Google forms:
EX.NO: 6
DATE: 31/07/2023
With the public cloud raging the market, virtual hardware is shared by many companies. The multi-
employer environment makes it easy to differentiate infrastructure costs for multiple users. Due to cost
benefits and payment model, the public cloud is suitable for small and medium-sized businesses. In general,
sensitive, community-oriented web applications that can receive unexpected traffic can increase the cloud
mass very well.
While defining the cloud strategy for their business, enterprises can choose between a public cloud, a
private cloud or a hybrid cloud for efficient scaling. The choice depends on several factors such as the type
of business application, the costs involved, the technical specifications, and other business requirements. In
this blog, we will take a closer look at the social cloud and its benefits for businesses.
The public cloud is the most popular computer model. In this case, cloud service providers use the
Internet and make services such as infrastructure, storage, servers etc. available for businesses. Third-party
providers own and use shared physical hardware and provide that to companies according to their needs.
Amazon Elastic Compute Cloud (EC2), IBM Blue Cloud, Google App Engine, Sun Cloud, Microsoft Azure
are some of the most popular cloud providers in the community.
● Popularly known as AWS, Amazon Web Services is the leading cloud service provider with a
33%
market share.
● AWS assists firms by providing quality services and supporting their businesses. One can run their
businees on a mobile phone or desktop. In addition, the user should focus only on crating the code
and ignoring other features.
Here are some examples of how AWS services can be used to build real-world applications:
● A company can use Amazon EC2 to run its web application and Amazon S3 to store its static and
dynamic content.
● A startup can use Amazon RDS to host its database and Amazon CloudFront to deliver its content to
users around the world.
● A research institution can use Amazon SageMaker to build and train machine learning models, and
then use Amazon EKS to deploy those models to production.
● A city can use Amazon IoT Core to connect and manage its smart city devices, and then use Amazon
Kinesis to stream the data from those devices to Amazon Elasticsearch Service for analysis.
AWS is a powerful and flexible platform that can be used to build a wide variety of applications. Whether
you are a startup, a large enterprise, or a government agency, AWS can help you to achieve your goals.
Microsoft Azure:
● Back in 2017, Gartner called Azure a top leader in the Cloud Infrastructure as a service space.
● Globally, 90% of Fortune 500 companies use Microsoft Azure to run their business.
● Using the deeply integrated Azure cloud services, businesses can quickly build, deploy and
manage simple and complex systems with ease.
● Azure supports multiple programming languages, frameworks, operating systems, information,
and devices, allowing businesses to use the tools and technologies they rely on.
There are over 200 services available in Microsoft Azure, covering a wide range of categories, including:
● Compute: Virtual machines, containers, serverless computing, Batch, HDInsight, Databricks, and
more.
● Storage: Blob storage, disk storage, file storage, Archive storage, and more.
● Databases: Relational databases, NoSQL databases, in-memory databases, and more.
● Networking: Virtual networks, load balancers, firewalls, VPNs, and more.
● Analytics: Azure Synapse Analytics, Azure Databricks, Azure HDInsight, Azure Stream Analytics,
Azure Machine Learning, and more.
● AI and machine learning: Azure Machine Learning Studio, Azure Cognitive Services, Azure Bot
Service, and more.
● Internet of Things (IoT): Azure IoT Hub, Azure IoT Edge, Azure IoT Central, and more.
● Developer tools: Azure DevOps, Visual Studio, Visual Studio Code, Azure Kubernetes Service, and
more.
● Hybrid and multicloud: Azure Arc, Azure Stack HCI, Azure VMware Solution by CloudSimple, and
more.
● Identity: Azure Active Directory, Azure AD B2C, Azure AD Privileged Identity Management, and
more.
● Security: Azure Security Center, Azure Defender, Azure Sentinel, Azure Key Vault, and more.
● Management and governance: Azure Cost Management + Billing, Azure Policy, Azure Monitor, and
more.
● Media: Azure Media Services, Azure Video Indexer, and more.
● Migration: Azure Migrate, Azure Database Migration Service, and more.
● Mixed reality: Azure Mixed Reality, Azure Spatial Anchors, and more.
● Mobile: Azure App Service, Azure Functions, Azure Notification Hubs, and more.
● Web: Azure App Service, Azure Front Door, Azure CDN, and more.
● Virtual desktop infrastructure: Azure Virtual Desktop, Windows 365, and more.
This is just a small sample of the many services available in Microsoft Azure.
Google Cloud Platform:
● With precise looks, low cost, attractive features and flexible computer options, GCP is an
attractive option for both AWS and Azure. It uses complete encryption for all data and
communication channels including traffic between data centres.
● Some of the areas where Google Cloud competes fiercely with AWS include model setting and
payment, privacy and traffic security, cost-effectiveness, and machine learning.
● While all three cloud providers offer up to 75% discounts on a one- to three-year commitment,
Google Cloud additionally offers up to 30% continuous user discount on each model that works for
more than 25% per month.
● Google Cloud offers several in-house APIs related to computer viewing, native language
processing and translation. Machine learning engineers can create models based on the Cloud
Machine Learning Engine open-source TensorFlow open-source
learning.
Conclusion:
Focusing your IT team on projects that can bring in more revenue rather than working furiously to
manage on-premises systems is a predominant priority to most IT companies. With finite resources,
companies are looking to adopt cloud models that can cater to their multiple IT requirements. Cloud-
native technologies empower organizations to build and run scalable SRP-based microservers-based
applications in modern, dynamic environments.
EX.NO: 7
DATE: 01/08/2023
INTRODUCTION:
There are many modules or frameworks which allow building your webpage using python like a
bottle, Django, flask, etc. But the really popular ones are Flask and Django. Django is easy to use as
compared to Flask but Flask provides you the versatility to program with. To understand what Flask is you
have to understand a few general terms.
1.WSGI Web Server Gateway Interface (WSGI) has been adopted as a standard for Python web
application development. WSGI is a specification for a universal interface between the web server and the
web applications.
2.Werkzeug It is a WSGI toolkit, which implements requests, response objects, and other utility functions.
This enables building a web framework on top of it. The Flask framework uses Werkzeug as one of its
bases.
3.jinja2 jinja2 is a popular templating engine for Python. A web templating system combines a template
with a certain data source to render dynamic web pages.
Flask: Flask is a web application framework written in Python. Flask is based on the Werkzeug WSGI
toolkit and Jinja2 template engine. Both are Pocco projects.
Installation: We will require two packages to set up your environment. virtualenv for a user to create
multiple Python environments side-by-side. Thereby, it can avoid compatibility issues between the different
versions of the libraries and the next will be Flask itself.
AIM:
Create a simple Web app in Python using Flask.
PROCEDURE:
PROGRAM:
OUTPUT:
RESULT:
Thus, the program of the Flask app using python is executed successfully and the output is
verified.
EX.NO: 8
DATE: 14/08/2023
AIM:
To create a simple web application to implement REST Protocol
PROCEDURE:
1. Import “Flask” and “josonify” Library.
2. Create a Flask application object.
3. Use route() function to call the URL ‘/’ which is bound to ‘get_books()’ function
4. Again use route() function to call the URL ‘/’ which is bound to ‘get_book(book_id)’ function
5. In main function use ‘app.run()’ to launch the application
CODE:
# Sample data
books = [
{"id": 1, "title": "Book 1", "author": "Author 1"},
{"id": 2, "title": "Book 2", "author": "Author 2"},
]
@app.route('/', methods=['GET'])
def get_books():
return jsonify({"books": books})
@app.route('/books/<int:book_id>', methods=['GET'])
def get_book(book_id):
book = next((book for book in books if book['id'] == book_id), None)
if book is None:
return jsonify({"error": "Book not found"}), 404
return jsonify({"book": book})
if __name__ == '__main__':
app.run(debug=True)
OUTPUT:
RESULT:
Thus, the web application to implement REST protocol is created successfully and the output is
verified.
EX.NO: 9
DATE: 16/08/2023
LOGIN PAGE USING PYTHON FLASK
AIM:
To create a login page using flask
PROCEDURE:
1. Create a Flask application object
2. Create a HTML file for the login page.
3. Add fields for username and password and a submit button
4. Create a route to render the HTML login page
5. Check the entered username and password for authentication
6. If authentication is successful, return “Login Successful” and if it fails return “Login
Failed”
7. Use myapp.run(debug=True) to run the Flask application.
CODE:
def index():
return render_template('login.html')
@myapp.route('/login', methods=['POST'])
def login():
username = request.form['username']
password = request.form['password']
if username in users and users[username] == password:
return "Login successful!"
else:
return "Login failed. Check your username and password."
@myapp.route('/register', methods=['POST'])
def register():
new_username = request.form['new_username']
new_password = request.form['new_password']
if new_username in users:
return "Username already exists. Choose a different one."
else:
users[new_username] = new_password
return "Registration successful!"
if __name__ == '__main__':
myapp.run(debug=True)
login.html
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form method="POST" action="/login">
<label for="username">Username:</label>
<input type="text" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" name="password" required><br><br>
<input type="submit" value="Login">
</form>
<h2>Register</h2>
<form method="POST" action="/register">
<label for="new_username">New Username:</label>
<input type="text" name="new_username" required><br><br>
<label for="new_password">New Password:</label>
<input type="password" name="new_password" required><br><br>
<input type="submit" value="Register">
</form>
</body>
</html>
OUTPUT SCREENSHOTS:
RESULT:
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home
use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it
is also the only professional solution that is freely available as Open Source Software under the terms of the
GNU General Public License (GPL) version 2.
Presently, VirtualBox runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number
of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista,
Windows 7, Windows 8, Windows 10), DOS/Windows 3.x, Linux (2.4, 2.6, 3.x and 4.x), Solaris and
OpenSolaris, OS/2, and OpenBSD. VirtualBox is being actively developed with frequent releases and has an
ever growing list of features, supported guest operating systems and platforms it runs on. VirtualBox is a
community effort backed by a dedicated company: everyone is encouraged to contribute while Oracle
ensures the product always meets professional quality criteria. Prerequisites This lab is the first in a series of
labs for Oracle Solaris 11. All of the labs in the series have these prerequisites in common:
As per Redhat, Virtualization is a technology that allows you to create multiple simulated
environments or dedicated resources from a single, physical hardware system. There are many software
available like,
1. VMWare
2. Oracle VirtualBox
3. QEMU
4. Microsoft Hyper-V
5. KVM
This article mainly focuses on VirtualBox and explains how to download and install it on Windows 10 64
bit.
VirtualBox, in brief
Oracle VirtualBox is an x86 and AMD64/Intel64 virtualization cross-platform tool. It is feature-rich, high
performance, free and open source. You can download and use it without paying any fee and also contribute
to its development. It is a community-developed tool and supported by Oracle Corporation.
It is the operating system of the computer on which you are going to install VirtualBox. Oracle Virtualbox
supports most of the commercially available OS. Below is the list,
It is the operating system that you install/import in VirtualBox. Below is the complete list of Guest OS
support. It also supports Microsoft Windows, Linux, FreeBSD, and DOS flavors of OS.
Refer to this official page to check all supporting OS with the version number.
Download VirtualBox
Virtualbox is free and open-source. This software is released under GPL version 2. You can download
VirtualBox latest version from this official page. Choose the proper version as per your Operating system 32
bit or 64 bit. These are ready to install binary or exe files for the Windows, OSX, Linux, and Solaris
platforms. You just need to download it and install it as per the respective operating system method.
● Windows hosts
● OS X hosts
● Linux distributions
● Solaris hosts
This is an extension package, it adds additional functionality like USB, RDP support. It is released under the
VirtualBox Personal Use and Evaluation License (PUEL).
Note: Extension pack and VirtualBox Version numbers should be the same. This SDK for Virtualbox and
you can download it from here. Oracle provides pre-build Pre-Built Developer VMs which you can
download and use Oracle Database, Linux, SOA, APEX, etc
Click on the exe file to start the installation. It is a wizard-driven install, you just need to click on Next to
continue and Cancel to exit the setup wizard. Below are the complete step-by-step instructions, 1.Welcome
– Oracle VM Virtualbox Setup Wizard This is the welcome screen. Click the Next button to start the
installation or the Cancel button to stop installation and exit. 2. Select the way features to be installed Here,
select the way you want features to be installed. You can install features or remove those from the
installation option. Do not change anything here. Let it be the default.
Select unselect the checkbox depending on the preference. If you unselect that option will not be installed. I
would suggest going with the default option so that it creates a start menu entry, shortcut on the desktop,
add a shortcut in the quick launch bar, and register file association.
6. Warning: Network Interface You will get a warning as “Installing the Oracle VM VirtualBox 5.28.
Networking features will reset your network connection and temporarily disconnect you from the
network. Proceed with installation now”
This is fine. Just click on Yes.
6. Start Installation After all pre-requisite checks, your installation will start. Click the Install button.
Installation starts, you can see the below screen with the progress bar.
It installs Oracle Corporation Universal Serial Bus and Network adapters. You will get a warning
as shown below. Just click on install.
Click Finish Button and you can see Oracle VM VirtualBox Manager running.
Summary:
Oracle Virtualbox is a free virtualization product that can help to install multiple operating systems on
the same hardware.
EX.NO: 11
DATE: 29/08/2023
AWS-ELASTIC COMPUTE CLOUD (EC2)
AIM:
To create an EC2 (Elastic Compute Cloud) instance in AWS, you'll need an AWS account and access to
the AWS Management Console. Here's a step-by-step procedure to create an EC2 instance:
Step 1: Log in to AWS Console
Open a web browser and go to the AWS Management Console: https://aws.amazon.com/.
Sign in with your AWS account credentials.
Step 2: Navigate to the EC2 Dashboard
Once logged in, you'll be on the AWS Management Console homepage. You can either search for
"EC2" in the AWS services search box or select "Services" and then choose "EC2" under the
Compute category.
Step 3: Launch an EC2 Instance
In the EC2 Dashboard, click the "Launch Instance" button to start the instance creation process.
Step 4: Choose an Amazon Machine Image (AMI)
Select an AMI that suits your needs. AWS provides a variety of pre-configured images, including
different operating systems and software configurations.
Click the "Select" button for your chosen AMI.
Step 5: Choose an Instance Type
Choose the instance type that matches your performance and capacity requirements. You can see details
about each instance type to help you decide.
Click the "Next: Configure Instance Details" button.
Step 6: Configure Instance Details
Configure options like the number of instances, network settings, and IAM roles, if necessary. You can
leave most settings at their default values.
Click the "Next: Add Storage" button.
Step 7: Add Storage
Configure the storage for your instance. You can add or modify the size and type of the root volume
(usually the primary disk).
Click the "Next: Add Tags" button.
Step 8: Add Tags (Optional)
Add tags to your instance to help you manage and identify it. Tags are key-value pairs.
Click the "Next: Configure Security Group" button.
Step 9: Configure Security Group
Create or select an existing security group. A security group acts as a virtual firewall to control incoming
and outgoing traffic to your instance.
Define the inbound rules (which ports and IP addresses are allowed access).
Click the "Review and Launch" button.
Step 10: Review and Launch
Review your instance's configuration to ensure everything is set up as intended.
Click the "Launch" button.
Step 11: Create a Key Pair
If you don't already have a key pair, you'll be prompted to create one. A key pair is required to connect
to your instance securely.
Choose "Create a new key pair," give it a name, and download the key pair file (e.g., .pem).
Store the key pair file in a secure location because you'll need it to access your instance.
Step 12: Launch the Instance
After downloading the key pair, click the "Launch Instances" button.
Step 13: View the Launch Status
You'll be directed to a page showing the launch status of your instance.
Click the "View Instances" button to see a list of your running instances.
Step 14: Access Your Instance
SCREENSHOT:
RESULT:
Once your instance is running, you can access it using SSH (for Linux instances) or RDP (for Windows
instances) by specifying the key pair you created during the launch process.
That's it! You have successfully created an EC2 instance in AWS. You can now start using it for various
computing tasks.
EX.NO: 12
DATE: 05/09/2023
INSTALL AND CONFIGURE OPENSTACK
OpenStack is a cloud operating system that controls large pools of compute, storage, and networking
resources throughout a datacenter, all managed and provisioned through APIs with common authentication
mechanisms.
A dashboard is also available, giving administrators control while empowering their users to provision
resources through a web interface.
OpenStack is broken up into services to allow you to plug and play components depending on your needs.
The openstack map gives you an “at a glance” view of the openstack landscape to see where those services
fit and how they can work together.
To gain experience with the installation and deployment process, most users start by installing OpenStack
on their laptop or desktop computer. Mirantis recommends automated installation using OpenStack Fuel and
VirtualBox, and following this series of steps
Prerequisites:
A 64-bit host OS with at least 8 GB RAM and 300 GB of free space. Virtualization must be enabled
in the BIOS. If you use Microsoft Windows, use Cygwin.
Step-By-Step
1. Install VirtualBox.
7. Wait for the script to completely finish. When it’s completed, you’ll have a Fuel VM and
3 additional VMs running in VirtualBox.
Once you’ve logged into the Fuel UI, you’re ready to use OpenStack Fuel to deploy your cloud and begin
exploring OpenStack.
EX.NO: 13
DATE: 13/09/2023
If you do not need to have the system disk bigger than the size defined in a chosen flavor, we
recommend setting "Create New Volume" feature to "No" state.
Choose Flavor (eg. eo1.xsmall).
Click "Networks" and then choose desired networks.
Open "Security Groups" After that, choose "allow_ping_ssh_rdp" and "default".
Choose or generate SSH keypair (HOW TO CREATE KEY-PAIR IN OPENSSTACK
DASHBOARD?) for your VM. Next, launch your instance by clicking on blue button.
You will see "Instances" menu with your newly created VM.
Open the drop-down menu and choose "Console".
Click on the black terminal area (to activate access to the console). Type: eoconsole and hit Enter.
Insert and retype new password.
Now you can type commands.
After you finish, type "exit".
This will close the session.
EX.NO: 14
DATE: 21/09/2023
SOCKET PROGRAMMING TO CHAT FROM CLIENT
package clientsockpkg;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
try {
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
while (!(line.equals("Done"))) {
try {
line = input.readLine();
output.writeUTF(line);
} catch (IOException e) {
e.printStackTrace();
try {
input.close();
output.close();
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
Server Program:
package serverscokpkg;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
try {
System.out.println("Server started::");
socket = server.accept();
System.out.println("Client accepted.");
new BufferedInputStream(socket.getInputStream()));
while (!line.equals("Done")) {
try {
line = in.readUTF();
System.out.println(line);
} catch (IOException i) {
System.out.println(i);
System.out.println("Closing connection");
// close connection
socket.close();
in.close();
} catch (IOException i) {
System.out.println(i);
}
EX.NO: 15
DATE: 03/10/2023
PROCEDURE:
Organizations need a Web application scanning solution that can scan for security loopholes in Web-
based applications to prevent would-be hackers from gaining unauthorized access to corporate information
and data. Web applications are proving to be the weakest link in overall corporate security, even though
companies have left no stone unturned in installing the better-known network security and anti-virus
solutions. Quick to take advantage of this vulnerability, hackers have now begun to use Web applications as
a platform for gaining access to corporate data; consequently, the regular use of a web application scanner is
essential.
Web Application
● A Web application is an application that resides on a company’s Web server, which any authorized
user can access over a network, such as the World Wide Web or an Intranet.
● A Web application is a three-layered application. Normally, the first layer would be a Web browser,
the second would be a content generation technology tool such as Java servlets or ASP (Active
Server Pages), and the third layer would be the company database.
● The Web browser makes the initial request to the middle layer, which, in turn, accesses the database
to perform the requested task, either by retrieving information from the database, or by updating it.
● Since Web applications reside on a server, they can be updated and modified at any time without any
distribution or installation of software on the client’s machines – the main reason for the widespread
adoption of Web applications in today’s organizations.
● Examples of Web applications include shopping carts, forms, login pages, dynamic content,
discussion boards and blogs.
🔍 Authorization to Scan
After configuring your Targets, you are ready to launch Scans and start identifying any vulnerabilities that
exist in the web applications. There are multiple ways to start a Scan, which include:
● From the Targets list, select the Targets to scan, and click the Scan button
● From within the Scanning Options dialog, configure the options to be used for the scan, then
click the "Create Scan" button
● Scan Type - Choose between Full Scan or a scanning profile which will scan for
specific vulnerabilities, such as High Risk Vulnerabilities only. You can read more
about Scan Profiles here.
● Report - You can request that a report is automatically generated after the scan is
completed. Here is a description of all the Reports
● Schedule - Select if the scan should start instantly, or if the scan should be scheduled
for a future date / time. You can also configure recurrent scans.
● Click the "Create Scan" button to launch the scan.
The LSR will open up, and will automatically perform all the recorded actions until the required Manual
Intervention. Now you can perform the necessary actions which the LSR requires human interaction for, and
click on the "Close" button at the bottom of the LSR window.
The LSR will continue to execute the remaining login actions, and the remainder of the scan can proceed
automatically.