-
+

Platform Supported

+

Generic badge

+

Python

+

Deployments

+

pypi +pages-build-deployment

+

Pypi-format +Pypi-status

+

NetSec (Network Security)

NetSec is a tool to analyze devices connecting to the router and alert accordingly when a new device is connected.

This app can display and store intruders’ IP address, MAC address, and Block the device.

Blocking device feature is currently available only for Netgear router users.

+
+

Kick off

+

Install

+
python3 -m pip install NetSec
+
+
+

Initiate

from netsec import network_monitor, SupportedModules
 
 if __name__ == '__main__':
+    # SupportedModules.att  # for AT&T users
+    # SupportedModules.netgear  # for any network using Netgear router
     network_monitor(module=SupportedModules.att, init=True)  # Create snapshot
-    network_monitor(module=SupportedModules.att, init=False)  # Run the scan
+    network_monitor(module=SupportedModules.att, init=False)  # Scan for threats and alert
 
+
+

Notifications will not repeat within an hour.

+
+
+
+

ENV Variables

+

Environment variables are loaded from a .env file.

+
    +
  • ROUTER_PASS - Router password. Only for Netgear users.

  • +
  • GMAIL_USER - Gmail account username to send and email.

  • +
  • GMAIL_PASS - Gmail account password to send and email.

  • +
  • RECIPIENT - Email address to which NetSec alerts should be sent.

  • +
  • PHONE - To send an SMS notification - Example: 1234567890

  • +
+

Coding Standards

Docstring format: Google
@@ -86,6 +118,11 @@

Linting +

Pypi Package

+

pypi-module

+

https://pypi.org/project/NetSec/

+

Runbook

made-with-sphinx-doc

@@ -104,9 +141,12 @@

RunbookTable of Contents

  • NetSec (Network Security)
  • diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index 8104e37..4d60609 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -1,3 +1,17 @@ +**Platform Supported** + +![Generic badge](https://img.shields.io/badge/Platform-Linux|MacOS|Windows-1f425f.svg) + +![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue) + +**Deployments** + +[![pypi](https://github.com/thevickypedia/NetSec/actions/workflows/python-publish.yml/badge.svg)](https://github.com/thevickypedia/NetSec/actions/workflows/python-publish.yml) +[![pages-build-deployment](https://github.com/thevickypedia/NetSec/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/thevickypedia/NetSec/actions/workflows/pages/pages-build-deployment) + +[![Pypi-format](https://img.shields.io/pypi/format/NetSec)](https://pypi.org/project/NetSec/#files) +[![Pypi-status](https://img.shields.io/pypi/status/NetSec)](https://pypi.org/project/NetSec) + # NetSec (Network Security) NetSec is a tool to analyze devices connecting to the router and alert accordingly when a new device is connected. @@ -5,14 +19,35 @@ This app can display and store intruders' IP address, MAC address, and Block the > Blocking device feature is currently available only for `Netgear` router users. +## Kick off + +**Install** +```shell +python3 -m pip install NetSec +``` + +**Initiate** ```python from netsec import network_monitor, SupportedModules if __name__ == '__main__': + # SupportedModules.att # for AT&T users + # SupportedModules.netgear # for any network using Netgear router network_monitor(module=SupportedModules.att, init=True) # Create snapshot - network_monitor(module=SupportedModules.att, init=False) # Run the scan + network_monitor(module=SupportedModules.att, init=False) # Scan for threats and alert ``` +> Notifications will not repeat within an hour. + +## ENV Variables +Environment variables are loaded from a `.env` file. + +- **ROUTER_PASS** - Router password. _Only for `Netgear` users._ +- **GMAIL_USER** - Gmail account username to send and email. +- **GMAIL_PASS** - Gmail account password to send and email. +- **RECIPIENT** - Email address to which `NetSec` alerts should be sent. +- **PHONE** - To send an SMS notification - Example: `1234567890` + ## Coding Standards Docstring format: [`Google`](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
    Styling conventions: [`PEP 8`](https://www.python.org/dev/peps/pep-0008/)
    @@ -43,6 +78,11 @@ pip install sphinx==5.1.1 pre-commit recommonmark pre-commit run --all-files ``` +## Pypi Package +[![pypi-module](https://img.shields.io/badge/Software%20Repository-pypi-1f425f.svg)](https://packaging.python.org/tutorials/packaging-projects/) + +[https://pypi.org/project/NetSec/](https://pypi.org/project/NetSec/) + ## Runbook [![made-with-sphinx-doc](https://img.shields.io/badge/Code%20Docs-Sphinx-1f425f.svg)](https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html) diff --git a/docs/genindex.html b/docs/genindex.html index 8420bce..079f88b 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -196,8 +196,6 @@

    N

  • module
- -
  • netsec.modules.models @@ -205,6 +203,8 @@

    N

  • module
+ +
  • netsec.modules.netgear @@ -220,6 +220,8 @@

    N

  • network_monitor() (in module netsec.analyzer) +
  • +
  • notification (netsec.modules.settings.Config attribute)
  • notify() (in module netsec.modules.helper)
  • diff --git a/docs/index.html b/docs/index.html index 04f0d10..09114b3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -48,9 +48,12 @@

    Welcome to NetSec’s documentation!Read Me:

    • NetSec (Network Security)
    • @@ -61,13 +64,14 @@

      Welcome to NetSec’s documentation!

      NetSec

      -netsec.analyzer.network_monitor(module: SupportedModules, init: bool = True) NoReturn
      +netsec.analyzer.network_monitor(module: SupportedModules, init: bool = True, block: bool = False) NoReturn

      Monitor devices connected to the network.

      Parameters:
      • module – Module to scan. Currently, supports any network on a Netgear router or At&t networks.

      • init – Takes a boolean value to create a snapshot file or actually monitor the network.

      • +
      • block – Takes a boolean value whether to block the intrusive device.

      @@ -276,6 +280,11 @@

      Welcome to NetSec’s documentation!gmail_user: AnyStr = None

      +
      +
      +notification: PathLike = 'fileio/last_notify'
      +
      +
      phone: AnyStr = None
      diff --git a/docs/objects.inv b/docs/objects.inv index d7209e4627702b07f6e860442ac528207755ac2f..dd5eafd989a2027342d9c6e7d51ad90430651cc8 100644 GIT binary patch delta 517 zcmV+g0{Z>y1oH%tcz>HP5J2zw3Rmr+J;dr>_f~cHuu^vwl|zqcVh>=&*vKB5(o=t< zzt=CR!K6!~Xp3P_1l#WojK>oUl1IV8fbM>xV@-EkTiI%4ADJ=|fAETG{Wgwm-?8n+ zoD)3UAFVs&wKa2X-{E&9uzzQT2Jhzt;=&;i=H5W# zD@&;l$_wjip!|ScGFqZR*9VtCP&lY@fr9dI1yP~Qz3SXCJTwSInWU4c1hZI8Vo zXXu_vz|c2WnVQNPT&Hj-RHM+)N{tPadxa!VEByt_*M9p?caQhXlf0Eyuz zgp{FR@1Noa5DPc0Q`CLfguna2G>{thsC)J_8tI4r=jM6Y7+|vE8){+0mjc-_)Sq9! zJqzpFI%IO#*f*Q-hF3y0-S#vQU9tC$K_|2S!FF9Z!{(g!;k=9L9E@X;$>RJDO5FSf HxYxM=;))1` delta 509 zcmV1nUHlcz@d<5J2zw3aa+d9)h~py;a>ktkhja^`S>=0%IEmg9YQJ?y0}g z-|LqY8>j0;(bm{|atypTW*8s_$)n(4KzBdUv8KDNt!y>2k4zbfKX^s8ejD4i@7Q)@ z&IumgkJcUX+8RZ6Fchs3q^w~#Q^y33I?sVw`-mC>+$dKtXwUf~ZjDa+tnfBvB1W>CmUst~E(ag}O;8 zsdJ7SOR7lAb$Fuo=@BD0R#iqot)E|8S6~iW+heZ?d2?#t5-!s0wH1d&nyhUa>j>pz zY)_ufrQozzSATy=e_)gdE=@Lp(w24v`4=ldKkPCAW_~WNz|TutBUM%|bR41c`D>{D zmBx3$ zPg7Zg>l6-!Y7`n;sj-1_uaKH)eZFA%djIL}@t%2-w|3GBw!LAoWf;MpkTMkP{Zstg z!oo}I6m=gq;gTLq1F2z;x@S+Vk$&iZZk~sY0VX59p%ymW?_|eNe}4V;ER1XGkV)vT zu{WDA!z-bhZhPv8u6SaOK_|Wc!FFBPdFGtP9E@#|$zuNwO5FSfSXG_grGfr1 diff --git a/docs/searchindex.js b/docs/searchindex.js index fe4b9d5..43ca3f9 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["NetSec (Network Security)", "Welcome to NetSec\u2019s documentation!"], "terms": {"i": [0, 1], "tool": 0, "analyz": [0, 1], "devic": [0, 1], "connect": [0, 1], "router": [0, 1], "alert": 0, "accordingli": 0, "when": [0, 1], "new": 0, "thi": 0, "app": 0, "can": 0, "displai": 0, "store": 0, "intrud": 0, "ip": [0, 1], "address": [0, 1], "mac": 0, "block": [0, 1], "featur": 0, "current": [0, 1], "avail": 0, "onli": 0, "netgear": 0, "user": 0, "from": [0, 1], "import": 0, "network_monitor": [0, 1], "supportedmodul": [0, 1], "__name__": 0, "__main__": 0, "modul": [0, 1], "att": [0, 1], "init": [0, 1], "true": [0, 1], "creat": [0, 1], "snapshot": [0, 1], "fals": [0, 1], "run": [0, 1], "scan": [0, 1], "docstr": 0, "format": [0, 1], "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "clean": 0, "pre": 0, "commit": 0, "hook": 0, "flake8": 0, "isort": 0, "requir": 0, "python": 0, "m": 0, "pip": 0, "instal": 0, "changelog": 0, "gener": [0, 1], "usag": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "t": 0, "precommit": 0, "ensur": 0, "doc": 0, "creation": 0, "ar": [0, 1], "everi": 0, "sphinx": 0, "5": 0, "1": 0, "recommonmark": 0, "all": [0, 1], "file": [0, 1], "http": 0, "thevickypedia": 0, "github": 0, "io": 0, "network": 1, "secur": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "runbook": 1, "bool": 1, "noreturn": 1, "monitor": 1, "paramet": 1, "support": 1, "ani": 1, "take": 1, "boolean": 1, "valu": 1, "actual": 1, "class": 1, "dictionari": 1, "dict": 1, "convert": 1, "object": 1, "create_snapshot": 1, "json": 1, "which": 1, "us": 1, "determin": 1, "known": 1, "unknown": 1, "format_kei": 1, "kei": 1, "str": 1, "match": 1, "generate_datafram": 1, "datafram": 1, "inform": 1, "web": 1, "page": 1, "return": 1, "list": 1, "data": 1, "frame": 1, "type": 1, "get_attached_devic": 1, "get": 1, "yield": 1, "each": 1, "get_ipaddress": 1, "id": 1, "trigger": 1, "initi": 1, "present": 1, "localipscan": 1, "connector": 1, "same": 1, "rang": 1, "api": 1, "allow": 1, "union": 1, "option": 1, "internet": 1, "access": 1, "name": 1, "an": 1, "argument": 1, "receiv": 1, "get_device_by_nam": 1, "method": 1, "always_allow": 1, "save": 1, "futur": 1, "remov": 1, "entri": 1, "notifi": 1, "msg_dict": 1, "send": 1, "email": 1, "notif": 1, "threat": 1, "messag": 1, "sent": 1, "templat": 1, "devicestatu": 1, "statu": 1, "string": 1, "config": 1, "wrapper": 1, "environ": 1, "variabl": 1, "pathlik": 1, "fileio": 1, "yaml": 1, "gmail_pass": 1, "anystr": 1, "none": 1, "gmail_us": 1, "phone": 1, "recipi": 1, "router_pass": 1, "index": 1, "search": 1}, "objects": {"netsec": [[1, 0, 0, "-", "analyzer"]], "netsec.analyzer": [[1, 1, 1, "", "network_monitor"]], "netsec.modules": [[1, 0, 0, "-", "att"], [1, 0, 0, "-", "helper"], [1, 0, 0, "-", "models"], [1, 0, 0, "-", "netgear"], [1, 0, 0, "-", "settings"]], "netsec.modules.att": [[1, 2, 1, "", "Device"], [1, 1, 1, "", "create_snapshot"], [1, 1, 1, "", "format_key"], [1, 1, 1, "", "generate_dataframe"], [1, 1, 1, "", "get_attached_devices"], [1, 1, 1, "", "get_ipaddress"], [1, 1, 1, "", "run"]], "netsec.modules.helper": [[1, 1, 1, "", "notify"]], "netsec.modules.models": [[1, 2, 1, "", "DeviceStatus"], [1, 2, 1, "", "SupportedModules"]], "netsec.modules.models.DeviceStatus": [[1, 3, 1, "", "allow"], [1, 3, 1, "", "block"]], "netsec.modules.models.SupportedModules": [[1, 3, 1, "", "att"], [1, 3, 1, "", "netgear"]], "netsec.modules.netgear": [[1, 2, 1, "", "LocalIPScan"]], "netsec.modules.netgear.LocalIPScan": [[1, 4, 1, "", "allow"], [1, 4, 1, "", "always_allow"], [1, 4, 1, "", "block"], [1, 4, 1, "", "create_snapshot"], [1, 4, 1, "", "run"]], "netsec.modules.settings": [[1, 2, 1, "", "Config"]], "netsec.modules.settings.Config": [[1, 3, 1, "", "blocked"], [1, 3, 1, "", "gmail_pass"], [1, 3, 1, "", "gmail_user"], [1, 3, 1, "", "phone"], [1, 3, 1, "", "recipient"], [1, 3, 1, "", "router_pass"], [1, 3, 1, "", "snapshot"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:attribute", "4": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "method", "Python method"]}, "titleterms": {"netsec": [0, 1], "network": 0, "secur": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "runbook": 0, "welcom": 1, "": 1, "document": 1, "read": 1, "me": 1, "At": 1, "t": 1, "netgear": 1, "helper": 1, "model": 1, "set": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file +Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["NetSec (Network Security)", "Welcome to NetSec\u2019s documentation!"], "terms": {"platform": 0, "support": [0, 1], "deploy": 0, "i": [0, 1], "tool": 0, "analyz": [0, 1], "devic": [0, 1], "connect": [0, 1], "router": [0, 1], "alert": 0, "accordingli": 0, "when": [0, 1], "new": 0, "thi": 0, "app": 0, "can": 0, "displai": 0, "store": 0, "intrud": 0, "ip": [0, 1], "address": [0, 1], "mac": 0, "block": [0, 1], "featur": 0, "current": [0, 1], "avail": 0, "onli": 0, "netgear": 0, "user": 0, "instal": 0, "python3": 0, "m": 0, "pip": 0, "initi": [0, 1], "from": [0, 1], "import": 0, "network_monitor": [0, 1], "supportedmodul": [0, 1], "__name__": 0, "__main__": 0, "att": [0, 1], "AT": 0, "t": 0, "ani": [0, 1], "us": [0, 1], "modul": [0, 1], "init": [0, 1], "true": [0, 1], "creat": [0, 1], "snapshot": [0, 1], "fals": [0, 1], "scan": [0, 1], "threat": [0, 1], "notif": [0, 1], "repeat": 0, "within": 0, "an": [0, 1], "hour": 0, "environ": [0, 1], "ar": [0, 1], "load": 0, "file": [0, 1], "_": 0, "pass": 0, "password": 0, "gmail": 0, "account": 0, "usernam": 0, "send": [0, 1], "email": [0, 1], "recipi": [0, 1], "which": [0, 1], "should": 0, "sent": [0, 1], "phone": [0, 1], "To": 0, "sm": 0, "exampl": 0, "1234567890": 0, "docstr": 0, "format": [0, 1], "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "clean": 0, "pre": 0, "commit": 0, "hook": 0, "flake8": 0, "isort": 0, "requir": 0, "python": 0, "changelog": 0, "gener": [0, 1], "usag": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "precommit": 0, "ensur": 0, "doc": 0, "creation": 0, "run": [0, 1], "everi": 0, "sphinx": 0, "5": 0, "1": 0, "recommonmark": 0, "all": [0, 1], "http": 0, "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "network": 1, "secur": 1, "kick": 1, "off": 1, "env": 1, "variabl": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "runbook": 1, "bool": 1, "noreturn": 1, "monitor": 1, "paramet": 1, "take": 1, "boolean": 1, "valu": 1, "actual": 1, "whether": 1, "intrus": 1, "class": 1, "dictionari": 1, "dict": 1, "convert": 1, "object": 1, "create_snapshot": 1, "json": 1, "determin": 1, "known": 1, "unknown": 1, "format_kei": 1, "kei": 1, "str": 1, "match": 1, "generate_datafram": 1, "datafram": 1, "inform": 1, "web": 1, "page": 1, "return": 1, "list": 1, "data": 1, "frame": 1, "type": 1, "get_attached_devic": 1, "get": 1, "yield": 1, "each": 1, "get_ipaddress": 1, "id": 1, "trigger": 1, "present": 1, "localipscan": 1, "connector": 1, "same": 1, "rang": 1, "api": 1, "allow": 1, "union": 1, "option": 1, "internet": 1, "access": 1, "name": 1, "argument": 1, "receiv": 1, "get_device_by_nam": 1, "method": 1, "always_allow": 1, "save": 1, "futur": 1, "remov": 1, "entri": 1, "notifi": 1, "msg_dict": 1, "messag": 1, "templat": 1, "devicestatu": 1, "statu": 1, "string": 1, "config": 1, "wrapper": 1, "pathlik": 1, "fileio": 1, "yaml": 1, "gmail_pass": 1, "anystr": 1, "none": 1, "gmail_us": 1, "last_notifi": 1, "router_pass": 1, "index": 1, "search": 1}, "objects": {"netsec": [[1, 0, 0, "-", "analyzer"]], "netsec.analyzer": [[1, 1, 1, "", "network_monitor"]], "netsec.modules": [[1, 0, 0, "-", "att"], [1, 0, 0, "-", "helper"], [1, 0, 0, "-", "models"], [1, 0, 0, "-", "netgear"], [1, 0, 0, "-", "settings"]], "netsec.modules.att": [[1, 2, 1, "", "Device"], [1, 1, 1, "", "create_snapshot"], [1, 1, 1, "", "format_key"], [1, 1, 1, "", "generate_dataframe"], [1, 1, 1, "", "get_attached_devices"], [1, 1, 1, "", "get_ipaddress"], [1, 1, 1, "", "run"]], "netsec.modules.helper": [[1, 1, 1, "", "notify"]], "netsec.modules.models": [[1, 2, 1, "", "DeviceStatus"], [1, 2, 1, "", "SupportedModules"]], "netsec.modules.models.DeviceStatus": [[1, 3, 1, "", "allow"], [1, 3, 1, "", "block"]], "netsec.modules.models.SupportedModules": [[1, 3, 1, "", "att"], [1, 3, 1, "", "netgear"]], "netsec.modules.netgear": [[1, 2, 1, "", "LocalIPScan"]], "netsec.modules.netgear.LocalIPScan": [[1, 4, 1, "", "allow"], [1, 4, 1, "", "always_allow"], [1, 4, 1, "", "block"], [1, 4, 1, "", "create_snapshot"], [1, 4, 1, "", "run"]], "netsec.modules.settings": [[1, 2, 1, "", "Config"]], "netsec.modules.settings.Config": [[1, 3, 1, "", "blocked"], [1, 3, 1, "", "gmail_pass"], [1, 3, 1, "", "gmail_user"], [1, 3, 1, "", "notification"], [1, 3, 1, "", "phone"], [1, 3, 1, "", "recipient"], [1, 3, 1, "", "router_pass"], [1, 3, 1, "", "snapshot"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:class", "3": "py:attribute", "4": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "class", "Python class"], "3": ["py", "attribute", "Python attribute"], "4": ["py", "method", "Python method"]}, "titleterms": {"netsec": [0, 1], "network": 0, "secur": 0, "kick": 0, "off": 0, "env": 0, "variabl": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "pypi": 0, "packag": 0, "runbook": 0, "welcom": 1, "": 1, "document": 1, "read": 1, "me": 1, "At": 1, "t": 1, "netgear": 1, "helper": 1, "model": 1, "set": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file diff --git a/netsec/__init__.py b/netsec/__init__.py index 72697aa..396e6fe 100644 --- a/netsec/__init__.py +++ b/netsec/__init__.py @@ -4,4 +4,4 @@ from netsec.modules.models import SupportedModules # noqa: F401 from netsec.modules.settings import config # noqa: F401 -version = "0.1.7" +version = "0.1.8" diff --git a/netsec/modules/helper.py b/netsec/modules/helper.py index e513c49..f790a50 100644 --- a/netsec/modules/helper.py +++ b/netsec/modules/helper.py @@ -1,5 +1,5 @@ -import time import os +import time from datetime import datetime from typing import Dict, List, NoReturn diff --git a/release_notes.rst b/release_notes.rst index 32bce80..1683a2d 100644 --- a/release_notes.rst +++ b/release_notes.rst @@ -1,6 +1,10 @@ Release Notes ============= +0.1.8 (02/25/2023) +------------------ +- Add LICENSE and update README.md and bump version + 0.1.7 (02/25/2023) ------------------ - Make `NetSec` pip installable