GithubHelp home page GithubHelp logo

network-automation-tool's Introduction

Network Tool

Overview

network_tool.py is a Python script for automating common network management tasks on a Linux system. It provides functionality for managing IP addresses, configuring firewall rules, and monitoring network performance.

Dependencies

  • Python 3
  • psutil library

Installation

  1. Clone the repository (or save the script to your local machine):

    git clone <repository_url>
    cd <repository_directory>
  2. Install psutil:

    pip3 install psutil
  3. Ensure the script is executable:

    chmod +x network_tool.py

Usage

Run the script using Python 3 and sudo for necessary privileges. Below are the commands and their descriptions:

IP Address Management

Add an IP Address

sudo python3 network_tool.py ip add <interface> <ip_address>
sudo python3 network_tool.py ip add eth0 192.168.1.10/24

Delete an IP Address

sudo python3 network_tool.py ip delete <interface> <ip_address
sudo python3 network_tool.py ip delete eth0 192.168.1.10/24

Show IP Addresses

python3 network_tool.py ip show

Firewall Management

Add a Firewall Rule

sudo python3 network_tool.py firewall add "<rule>"
sudo python3 network_tool.py firewall add "-A INPUT -p tcp --dport 22 -j ACCEPT"

Delete a Firewall Rule

sudo python3 network_tool.py firewall delete "<rule>"
sudo python3 network_tool.py firewall delete "-D INPUT -p tcp --dport 22 -j ACCEPT"

List Firewall Rules

sudo python3 network_tool.py firewall list

Network Performance Monitoring

python3 network_tool.py monitor

Allow Incoming SSH Connections

sudo python3 network_tool.py firewall add "-A INPUT -p tcp --dport 22 -j ACCEPT"

Block Incoming HTTP Connections

sudo python3 network_tool.py firewall add "-A INPUT -p tcp --dport 80 -j DROP"

Allow Outgoing DNS Requests

sudo python3 network_tool.py firewall add "-A OUTPUT -p udp --dport 53 -j ACCEPT"

Monitor Network Performance

python3 network_tool.py monitor

Logging

The script logs its actions to a file named network_tool.log in the same directory. You can check this file to review the execution logs.

network-automation-tool's People

Contributors

rahulbansod519 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.