Skip to content

Commit

Permalink
Update email templates
Browse files Browse the repository at this point in the history
Update .gitignore, README.md
Use gitverse for release notes generation
Use requirements.txt instead of hard coded pyproject.toml
  • Loading branch information
dormant-user committed Aug 16, 2023
1 parent ff00de4 commit 11c083a
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 120 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.env
.idea
venv
__pycache__/
_build/
fileio

dist/
_build/
fileio/
__pycache__/
NetSec.egg-info/
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/
## [Release Notes](https://github.com/thevickypedia/NetSec/blob/master/release_notes.rst)
**Requirement**
```shell
python -m pip install changelog-generator
python -m pip install gitverse
```

**Usage**
```shell
changelog reverse -f release_notes.rst -t 'Release Notes'
gitverse-release reverse -f release_notes.rst -t 'Release Notes'
```

## Linting
Expand All @@ -87,3 +87,9 @@ pre-commit run --all-files
[![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/NetSec/](https://thevickypedia.github.io/NetSec/)

## License & copyright

© Vignesh Rao, NetSec

Licensed under the [MIT License](https://github.com/thevickypedia/NetSec/blob/main/LICENSE)
10 changes: 8 additions & 2 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ <h2>Coding Standards<a class="headerlink" href="#coding-standards" title="Permal
<section id="release-notes">
<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
<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>gitverse
</pre></div>
</div>
<p><strong>Usage</strong></p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>changelog<span class="w"> </span>reverse<span class="w"> </span>-f<span class="w"> </span>release_notes.rst<span class="w"> </span>-t<span class="w"> </span><span class="s1">&#39;Release Notes&#39;</span>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>gitverse-release<span class="w"> </span>reverse<span class="w"> </span>-f<span class="w"> </span>release_notes.rst<span class="w"> </span>-t<span class="w"> </span><span class="s1">&#39;Release Notes&#39;</span>
</pre></div>
</div>
</section>
Expand All @@ -128,6 +128,11 @@ <h2>Runbook<a class="headerlink" href="#runbook" title="Permalink to this headin
<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/NetSec/">https://thevickypedia.github.io/NetSec/</a></p>
</section>
<section id="license-copyright">
<h2>License &amp; copyright<a class="headerlink" href="#license-copyright" title="Permalink to this heading"></a></h2>
<p>© Vignesh Rao, NetSec</p>
<p>Licensed under the <a class="reference external" href="https://github.com/thevickypedia/NetSec/blob/main/LICENSE">MIT License</a></p>
</section>
</section>


Expand All @@ -148,6 +153,7 @@ <h3><a href="index.html">Table of Contents</a></h3>
<li><a class="reference internal" href="#linting">Linting</a></li>
<li><a class="reference internal" href="#pypi-package">Pypi Package</a></li>
<li><a class="reference internal" href="#runbook">Runbook</a></li>
<li><a class="reference internal" href="#license-copyright">License &amp; copyright</a></li>
</ul>
</li>
</ul>
Expand Down
10 changes: 8 additions & 2 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/
## [Release Notes](https://github.com/thevickypedia/NetSec/blob/master/release_notes.rst)
**Requirement**
```shell
python -m pip install changelog-generator
python -m pip install gitverse
```

**Usage**
```shell
changelog reverse -f release_notes.rst -t 'Release Notes'
gitverse-release reverse -f release_notes.rst -t 'Release Notes'
```

## Linting
Expand All @@ -87,3 +87,9 @@ pre-commit run --all-files
[![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/NetSec/](https://thevickypedia.github.io/NetSec/)

## License & copyright

&copy; Vignesh Rao, NetSec

Licensed under the [MIT License](https://github.com/thevickypedia/NetSec/blob/main/LICENSE)
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ <h1>Welcome to NetSec’s documentation!<a class="headerlink" href="#welcome-to-
<li class="toctree-l2"><a class="reference internal" href="README.html#linting">Linting</a></li>
<li class="toctree-l2"><a class="reference internal" href="README.html#pypi-package">Pypi Package</a></li>
<li class="toctree-l2"><a class="reference internal" href="README.html#runbook">Runbook</a></li>
<li class="toctree-l2"><a class="reference internal" href="README.html#license-copyright">License &amp; copyright</a></li>
</ul>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion netsec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from netsec.modules.models import SupportedModules # noqa: F401
from netsec.modules.settings import config # noqa: F401

version = "0.9"
version = "0.9.1"
8 changes: 5 additions & 3 deletions netsec/analyzer.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from typing import NoReturn

import gmailconnector
import gmailconnector as gc

from netsec.modules import att, models, netgear, settings


def network_monitor(module: models.SupportedModules, init: bool = True, block: bool = False) -> NoReturn:
def network_monitor(module: models.SupportedModules,
init: bool = True,
block: bool = False) -> NoReturn:
"""Monitor devices connected to the network.
Args:
Expand All @@ -14,7 +16,7 @@ def network_monitor(module: models.SupportedModules, init: bool = True, block: b
block: Takes a boolean value whether to block the intrusive device.
"""
if settings.config.recipient:
settings.config.recipient = gmailconnector.EmailAddress(address=settings.config.recipient)
settings.config.recipient = gc.EmailAddress(address=str(settings.config.recipient))
if module == models.SupportedModules.netgear:
if not settings.config.router_pass:
raise ValueError(
Expand Down
11 changes: 5 additions & 6 deletions netsec/modules/att.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from collections.abc import Generator
from typing import Any, NoReturn, Optional, Union

import pandas
import pandas as pd
import requests
from pandas import DataFrame

from netsec.modules.helper import notify
from netsec.modules.settings import LOGGER, config
Expand Down Expand Up @@ -57,14 +56,14 @@ def __init__(self, dictionary: dict):
setattr(self, key, dictionary[key])


def generate_dataframe() -> DataFrame:
def generate_dataframe() -> pd.DataFrame:
"""Generate a dataframe using the devices information from router web page.
Returns:
DataFrame:
pd.DataFrame:
Devices list as a data frame.
"""
# pandas.set_option('display.max_rows', None)
# pd.set_option('display.max_rows', None)
try:
response = requests.get(url=SOURCE)
except requests.RequestException as error:
Expand All @@ -74,7 +73,7 @@ def generate_dataframe() -> DataFrame:
if response.ok:
html_source = response.text
try:
html_tables = pandas.read_html(html_source)
html_tables = pd.read_html(html_source)
except ImportError:
raise ValueError("No tables found")
return html_tables[0]
Expand Down
5 changes: 3 additions & 2 deletions netsec/modules/email_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ <h3>NetSec Intrusion Alert</h3>
</tr>
{% for key, value in alert.items() %}
<tr>
<td style="height: 30px; horizontal-align: left; vertical-align: bottom; font-weight:bold; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd; border-right: 1px solid #ddd;"> {{ key }}</td>
<td style="height: 30px; horizontal-align: right; vertical-align: bottom; text-align: right; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd; border-right: 1px solid #ddd;"> {{ value }}</td>
<td style="text-align:left"> <b>{{ key }}</b></td>
<td style="text-align:right"> {{ value }}</td>
</tr>
{% endfor %}
<br>
{% endfor %}
</tbody>
</table>
<br>
<div style="font-family:'Helvetica Neue';font-size:12px;line-height:20px;margin-bottom:10px;color:#444444;line-height:20px;padding:16px 16px 16px 16px;text-align:center;">
<br><b>Source code:</b> <a href="https://github.com/thevickypedia/JarvisMonitor" target="_bottom">https://github.com/thevickypedia/NetSec</a>
<br><b>Reach out:</b> <a href="https://vigneshrao.com/contact" target="_bottom">https://vigneshrao.com/contact</a>
Expand Down
Loading

0 comments on commit 11c083a

Please sign in to comment.