Build a Java-Based Network Scanner: A Step-by-Step Guide for Ethical Hackers

  Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡



















πŸ“„ Features

  • Introduction: Importance of network scanning in cybersecurity.

  • Prerequisites: Basic knowledge of Java and networking concepts.

  • Step-by-Step Guide: Detailed explanation of the Java code provided.

  • Code Explanation: Breakdown of each part of the code for better understanding.

  • Execution Instructions: How to compile and run the Java program.

  • Use Cases: Real-world applications of network scanning.

  • Conclusion: Recap and encouragement to explore further.


πŸ“ Folder Structure

NetworkScanner/
├── src/
│   └── NetworkScanner.java

Code :


import java.io.IOException;

import java.net.InetAddress;


public class NetworkScanner {


    public static void main(String[] args) {

        String subnet = "192.168.1."; // Replace with your local network's subnet

        int timeout = 1000; // Timeout in milliseconds (1 second)

        System.out.println("Starting network scan...");


        for (int i = 1; i < 255; i++) {

            String ip = subnet + i;

            try {

                InetAddress inet = InetAddress.getByName(ip);

                if (inet.isReachable(timeout)) {

                    System.out.println(ip + " is online");

                } else {

                    System.out.println(ip + " is offline");

                }

            } catch (IOException e) {

                System.out.println("Error checking IP: " + ip);

            }

        }

    }

}

Comments

Popular posts from this blog

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±

πŸš€ Create a Python Screen Recorder with Audio (Complete Code)

Python IP Tracker App with GUI | Track IP Location Real-Time! (Working Project)