Skip to content

Commit

Permalink
Make NetSec pip installable
Browse files Browse the repository at this point in the history
Do not repeat notifications in under an hour
Onboard github actions to deploy to pypi
Update .gitignore, README.md and release_notes.rst
  • Loading branch information
dormant-user committed Feb 25, 2023
1 parent f739a98 commit 6bc698e
Show file tree
Hide file tree
Showing 28 changed files with 510 additions and 385 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will upload a Python Package using Twine when a release is created

name: pypi-publish

# Controls when the workflow will run
on:
workflow_dispatch: {}
release:
types: [ published ]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Create packages
run: python -m build
- name: Run twine check
run: twine check dist/*
- name: Upload to pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*.whl
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ venv
__pycache__/
_build/
fileio
dist/
NetSec.egg-info/
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
global-exclude .env
global-exclude *.yaml
global-exclude *.json
global-exclude .DS_Store
recursive-include netsec/modules *
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# NetScan
Network Scanner to analyze devices connecting to the router and alert accordingly.
# 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 intruders' IP addresses, MAC addresses, and lets the user Ping the device, and even Block the device.

Block IP Address feature helps the user to remove the specified connections and block the specific IP address.
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.
```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) # Scan for threats and alert
```

> Notifications will not repeat within an hour.
## Coding Standards
Docstring format: [`Google`](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) <br>
Styling conventions: [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) <br>
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
[`isort`](https://pycqa.github.io/isort/)

## [Release Notes](https://github.com/thevickypedia/netscan/blob/master/release_notes.rst)
## [Release Notes](https://github.com/thevickypedia/NetSec/blob/master/release_notes.rst)
**Requirement**
```shell
python -m pip install changelog-generator
Expand All @@ -40,4 +50,4 @@ pre-commit run --all-files
## 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)

[https://thevickypedia.github.io/netscan/](https://thevickypedia.github.io/netscan/)
[https://thevickypedia.github.io/NetSec/](https://thevickypedia.github.io/NetSec/)
39 changes: 21 additions & 18 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

<title>NetScan &#8212; NetScan documentation</title>
<title>NetSec (Network Security) &#8212; NetSec documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/classic.css" />

Expand All @@ -18,7 +18,7 @@

<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Welcome to NetScan’s documentation!" href="index.html" />
<link rel="prev" title="Welcome to NetSec’s documentation!" href="index.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
Expand All @@ -30,10 +30,10 @@ <h3>Navigation</h3>
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to NetScan’s documentation!"
<a href="index.html" title="Welcome to NetSec’s documentation!"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NetScan documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">NetScan</a></li>
<li class="nav-item nav-item-0"><a href="index.html">NetSec documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">NetSec (Network Security)</a></li>
</ul>
</div>

Expand All @@ -42,15 +42,18 @@ <h3>Navigation</h3>
<div class="bodywrapper">
<div class="body" role="main">

<section id="netscan">
<h1>NetScan<a class="headerlink" href="#netscan" title="Permalink to this heading"></a></h1>
<p>Network Scanner to analyze devices connecting to the router and alert accordingly.</p>
<p>This app can display intruders’ IP addresses, MAC addresses, and lets the user Ping the device, and even Block the device.</p>
<p>Block IP Address feature helps the user to remove the specified connections and block the specific IP address.</p>
<section id="netsec-network-security">
<h1>NetSec (Network Security)<a class="headerlink" href="#netsec-network-security" title="Permalink to this heading"></a></h1>
<p>NetSec is a tool to analyze devices connecting to the router and alert accordingly when a new device is connected.</p>
<p>This app can display and store intruders’ IP address, MAC address, and Block the device.</p>
<blockquote>
<div><p>Blocking device feature is currently available only for <code class="docutils literal notranslate"><span class="pre">Netgear</span></code> router users.</p>
</div></blockquote>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">netsec</span> <span class="kn">import</span> <span class="n">network_monitor</span><span class="p">,</span> <span class="n">SupportedModules</span>

<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">network_monitor</span><span class="p">(</span><span class="n">module</span><span class="o">=</span><span class="n">SupportedModules</span><span class="o">.</span><span class="n">att</span><span class="p">,</span> <span class="n">init</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="c1"># Create snapshot</span>
<span class="n">network_monitor</span><span class="p">(</span><span class="n">module</span><span class="o">=</span><span class="n">SupportedModules</span><span class="o">.</span><span class="n">att</span><span class="p">,</span> <span class="n">init</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="c1"># Run the scan</span>
</pre></div>
</div>
<section id="coding-standards">
Expand All @@ -61,7 +64,7 @@ <h2>Coding Standards<a class="headerlink" href="#coding-standards" title="Permal
<a class="reference external" href="https://pycqa.github.io/isort/"><code class="docutils literal notranslate"><span class="pre">isort</span></code></a></p>
</section>
<section id="release-notes">
<h2><a class="reference external" href="https://github.com/thevickypedia/Jarvis/blob/master/release_notes.rst">Release Notes</a><a class="headerlink" href="#release-notes" title="Permalink to this heading"></a></h2>
<h2><a class="reference external" href="https://github.com/thevickypedia/NetSec/blob/master/release_notes.rst">Release Notes</a><a class="headerlink" href="#release-notes" title="Permalink to this heading"></a></h2>
<p><strong>Requirement</strong></p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>changelog-generator
</pre></div>
Expand All @@ -86,7 +89,7 @@ <h2>Linting<a class="headerlink" href="#linting" title="Permalink to this headin
<section id="runbook">
<h2>Runbook<a class="headerlink" href="#runbook" title="Permalink to this heading"></a></h2>
<p><a class="reference external" href="https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html"><img alt="made-with-sphinx-doc" src="https://img.shields.io/badge/Code%20Docs-Sphinx-1f425f.svg" /></a></p>
<p><a class="reference external" href="https://thevickypedia.github.io/netscan/">https://thevickypedia.github.io/netscan/</a></p>
<p><a class="reference external" href="https://thevickypedia.github.io/NetSec/">https://thevickypedia.github.io/NetSec/</a></p>
</section>
</section>

Expand All @@ -100,7 +103,7 @@ <h2>Runbook<a class="headerlink" href="#runbook" title="Permalink to this headin
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">NetScan</a><ul>
<li><a class="reference internal" href="#">NetSec (Network Security)</a><ul>
<li><a class="reference internal" href="#coding-standards">Coding Standards</a></li>
<li><a class="reference internal" href="#release-notes">Release Notes</a></li>
<li><a class="reference internal" href="#linting">Linting</a></li>
Expand All @@ -113,7 +116,7 @@ <h3><a href="index.html">Table of Contents</a></h3>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Welcome to NetScan’s documentation!</a></p>
title="previous chapter">Welcome to NetSec’s documentation!</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
Expand Down Expand Up @@ -146,10 +149,10 @@ <h3>Navigation</h3>
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to NetScan’s documentation!"
<a href="index.html" title="Welcome to NetSec’s documentation!"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NetScan documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">NetScan</a></li>
<li class="nav-item nav-item-0"><a href="index.html">NetSec documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">NetSec (Network Security)</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
17 changes: 9 additions & 8 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# NetScan
Network Scanner to analyze devices connecting to the router and alert accordingly.
# 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 intruders' IP addresses, MAC addresses, and lets the user Ping the device, and even Block the device.

Block IP Address feature helps the user to remove the specified connections and block the specific IP address.
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.

```python
from netsec import network_monitor, SupportedModules

if __name__ == '__main__':
network_monitor(module=SupportedModules.att, init=True) # Create snapshot
network_monitor(module=SupportedModules.att, init=False) # Run the scan
```


## Coding Standards
Docstring format: [`Google`](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) <br>
Styling conventions: [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) <br>
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
[`isort`](https://pycqa.github.io/isort/)

## [Release Notes](https://github.com/thevickypedia/Jarvis/blob/master/release_notes.rst)
## [Release Notes](https://github.com/thevickypedia/NetSec/blob/master/release_notes.rst)
**Requirement**
```shell
python -m pip install changelog-generator
Expand All @@ -45,4 +46,4 @@ pre-commit run --all-files
## 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)

[https://thevickypedia.github.io/netscan/](https://thevickypedia.github.io/netscan/)
[https://thevickypedia.github.io/NetSec/](https://thevickypedia.github.io/NetSec/)
22 changes: 11 additions & 11 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
.. NetScan documentation master file, created by
.. NetSec documentation master file, created by
sphinx-quickstart on Thu Aug 26 16:15:06 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to NetScan's documentation!
===================================
Welcome to NetSec's documentation!
==================================

.. toctree::
:maxdepth: 2
:caption: Read Me:

README

NetScan
=======
NetSec
======

.. automodule:: analyzer
.. automodule:: netsec.analyzer
:members:
:undoc-members:

At&t
====

.. automodule:: modules.att
.. automodule:: netsec.modules.att
:members:
:undoc-members:

Netgear
=======

.. automodule:: modules.netgear
.. automodule:: netsec.modules.netgear
:members:
:undoc-members:

Helper
======

.. automodule:: modules.helper
.. automodule:: netsec.modules.helper
:members:
:undoc-members:

Models
======

.. automodule:: modules.models
.. automodule:: netsec.modules.models
:members:
:undoc-members:

Settings
========

.. automodule:: modules.settings
.. automodule:: netsec.modules.settings
:members:
:undoc-members:

Expand Down
Loading

0 comments on commit 6bc698e

Please sign in to comment.