CN Project Report Format
CN Project Report Format
Computer Networking
(CSE3034)
Java-based Vulnerability
Scanner Tool
Submitted by
CS VIVEK ROUT Reg. No.: 2141018150
KUMAR SAHIL Reg. No.: 2141019018
MITESHMAN SAHOO Reg. No.: 2141019077
SURAJ KUMAR SAHU Reg. No.: 2141019150
BISHNUPADA SAHU Reg. No.: 2141019151
BISHNUPADA SAHU
DATE:
PLACE:
ii
Abstract
The NetworkScanner class is responsible for conducting detailed scans of specified hosts
and web applications. It checks for open ports on network hosts and evaluates web
applications for common vulnerabilities such as outdated JavaScript libraries, missing
security headers, and insecure direct object references. The VulnerabilityScanner class
integrates with NetworkScanner to perform in-depth vulnerability assessments, collating
data on potential security risks.
iii
Contents
Serial Chapter Title of the Chapter Page
No. No. No.
1. 1 Introduction
2. 2 Problem Statement
3. 3 Methodology
4. 4 Implementation
6. 6 Conclusion
7. References
iv
1. Introduction
Cybersecurity is a growing concern as businesses and individuals rely more on technology
for their daily operations. Vulnerabilities within networked systems and web applications
can expose them to a wide range of threats. To combat these vulnerabilities, there are
various tools available in the market. In this project, we will explore the landscape of
vulnerability scanning tools, focusing on tools like NMAP and Nessus, to understand their
functionalities, options, and report generation capabilities.
1
4. User Interface:
By exploring these aspects and developing a Java-based tool, this project will contribute to a
better understanding of vulnerability scanning, report generation, and the importance of
securing LAN-connected systems and web applications. Ultimately, it will empower
individuals and organizations to take proactive steps towards enhancing their digital
security.
2
2. Problem Statement
3
3. Methodology
A. Research Phase
a. Study NMAP and Acunetix to understand their functionalities and reporting capabilities.
b. Define essential features for a basic Java-based vulnerability scanning tool.
B. Design Phase
a. Architect a modular tool structure with components for scanning, reporting, and user interface.
b. Choose Java frameworks and tools suitable for network operations and GUI development.
C. Development Phase
a. Set up Java development environment and version control.
b. Develop core functionalities, i.e. LAN scanning, vulnerability detection, Web Server Scanning, and
report generation.
c. Build GUI using Java Swing or JavaFX, integrating it with the backend logic.
Algorithms Used:
A. Network Scanning Algorithm
a. Discover active hosts on the LAN.
b. Identify open ports on these hosts.
c. Algorithm:
5
4. Implementation
1. Main.java –
a. This class contains the main method, which is the starting point of any Java application.
b. It uses SwingUtilities.invokeLater to ensure that the GUI creation is handled in the Event Dispatch
Thread, which is the proper way to start a Swing application.
c. It simply creates an instance of VulnerabilityScannerGUI, initializing the graphical user interface of
the application.
d. Program -
public class Main {
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(VulnerabilityScannerGUI::new);
}
}
2. NetworkScanner.java –
a. This class is responsible for scanning network hosts to identify open ports and detect service versions
running on these ports.
b. It includes methods for setting a range of ports to scan and a method (scanHost) for performing the
actual scan on a given host.
c. The scanPorts method within this class tries to connect to each port within the specified range and
records open ports.
d. It also attempts to identify the service (like HTTP, FTP) running on the open ports.
e. Additionally, it contains a simple web crawler method (crawlWebApplication) to fetch the content of
web applications.
f. Program -
import java.util.List;
import java.io.*;
import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
import java.net.HttpURLConnection;
out.println("GET / HTTP/1.1");
out.println("Host: " + socket.getInetAddress().getHostAddress());
out.println("Connection: close");
out.println();
String line;
while ((line = in.readLine()) != null) {
if (line.startsWith("Server:")) {
return line;
}
}
return "HTTP service, version unknown";
}
3. VulnerabilityScanner.java –
a. This class maintains a database of known vulnerabilities associated with specific network services
and their versions.
b. It has methods to scan for vulnerabilities based on the results of network scans (open ports and
service versions) provided by NetworkScanner.
c. The initializeVulnerabilityDatabase method populates the database with known vulnerabilities,
mapping services (and optionally their versions) to their respective security issues.
d. The scanForServiceVulnerabilities method is used to analyze the scan results (from NetworkScanner)
against the vulnerability database and identify any potential vulnerabilities.
e. Program -
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public VulnerabilityScanner() {
vulnerabilityDatabase = new HashMap<>();
initializeVulnerabilityDatabase();
}
4. VulnerabilityScannerGUI.java –
a. This class creates and manages the GUI for the application, allowing users to interact with the
network scanning and vulnerability assessment functionalities.
b. It includes text fields for input (like host IP and web URL), buttons for initiating scans and saving
reports, and a text area for displaying the results.
c. The class uses SwingWorker for performing network scans in the background without freezing the
GUI.
d. It includes action listeners for buttons to handle user actions like starting a scan, saving a report, and
changing settings
e. Program -
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
9
import java.util.concurrent.ExecutionException;
public VulnerabilityScannerGUI() {
networkScanner = new NetworkScanner();
vulnerabilityScanner = new VulnerabilityScanner();
SwingUtilities.invokeLater(this::createAndShowGUI);
}
createControlButtons();
createTextArea();
createStatusLabel();
frame.pack();
frame.setLocationRelativeTo(null); // Center on screen
frame.setVisible(true);
}
frame.add(buttonPanel, BorderLayout.CENTER);
}
@Override
protected void done() {
try {
List<String> openPorts = get();
if (openPorts.isEmpty()) {
textArea.setText("No open ports found for host: " + hostField.getText());
} else {
1
1
textArea.setText("Host: " + hostField.getText() + "\n");
textArea.append("Open Ports:\n");
for (String port : openPorts) {
textArea.append(port + "\n");
if (vulnerabilityScanner.isPortVulnerable(Integer.parseInt(port.split(":")[1]))) {
textArea.append(" [Security Tip: " + vulnerabilityScanner.getVulnerabilityTip(Integer.parseInt(port.split(":")[1])) + "]\n");
}
}
}
statusLabel.setText("Status: Scan Complete");
} catch (InterruptedException | ExecutionException ex) {
textArea.setText("Error during scan: " + ex.getMessage());
statusLabel.setText("Status: Error");
} finally {
scanButton.setEnabled(true);
}
}
};
worker.execute();
}
private void performWebScan(ActionEvent e) {
statusLabel.setText("Status: Scanning Web Application...");
webScanButton.setEnabled(false);
@Override
protected void done() {
try {
String webContent = get();
textArea.setText("Web Application Content:\n" + webContent);
statusLabel.setText("Status: Web Scan Complete");
} catch (InterruptedException | ExecutionException ex) {
textArea.setText("Error during web scan: " + ex.getMessage());
statusLabel.setText("Status: Error");
} finally {
webScanButton.setEnabled(true);
}
}
};
worker.execute();
}
if (userSelection == JFileChooser.APPROVE_OPTION) {
File fileToSave = fileChooser.getSelectedFile();
try (FileWriter writer = new FileWriter(fileToSave)) {
writer.write(textArea.getText());
JOptionPane.showMessageDialog(frame, "Report saved to " + fileToSave.getAbsolutePath(), "Report Saved",
JOptionPane.INFORMATION_MESSAGE);
} catch (IOException ex) {
JOptionPane.showMessageDialog(frame, "Error saving report: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
settingsDialog.add(saveSettingsButton);
settingsDialog.setVisible(true);
}
1
3
5. Results & Interpretation
1. Initializing Host Scan:
a. Screenshot -
1
5
b. Explanation - For user customization and control over the scanning
process, the "Settings" option allows individuals to tailor their
network scans. Users can define a specific range of ports to scan,
granting them the ability to customize the scope of their network
scans. The settings dialog presents input fields for configuring the
desired port range, enhancing user control over scan parameters
and ensuring that scans align with their specific requirements.
1
6
6. Conclusion
The development of the vulnerability scanner tool marks a significant achievement in the
realm of cybersecurity tools, providing a robust and user-friendly solution for identifying
and analyzing security vulnerabilities in network hosts and web applications. By seamlessly
integrating the NetworkScanner and VulnerabilityScanner classes, the tool offers
comprehensive scanning capabilities, from detecting open network ports to identifying
common web application vulnerabilities.
The graphical user interface enhances the tool's accessibility, making it suitable for both
professional and novice users in cybersecurity. The successful implementation of this
project demonstrates the effectiveness of combining detailed scanning algorithms with a
practical and intuitive user interface. Future enhancements, such as the incorporation of
more advanced scanning techniques and broader vulnerability databases, could further
elevate its utility. This project serves as a valuable asset for proactive security analysis,
emphasizing the importance of regular vulnerability assessments in maintaining robust
cybersecurity defenses.
1
References
(as per the IEEE recommendations)
[3] https://nmap.org/docs.html
[4] https://www.acunetix.com/support/docs/introduction/