Skip to content

Commit

Permalink
change own libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
procamora committed Apr 20, 2020
1 parent ace08c1 commit 5bf0c13
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 436 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It is being designed to be easily extensible through plugins, as it may allow to

![minitrue][minitrue]

[minitrue]: bot_scan_networks.svg
[minitrue]: resources/images/bot_scan_networks.svg


# Installation
Expand All @@ -36,7 +36,7 @@ sudo dnf install nmap texlive-latex-recommended texlive-latex-extra texlive-date



```python
```bash
python3 bot_scan.py
```

Expand Down
6 changes: 3 additions & 3 deletions generate_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Dict, Text, Tuple, Any, Optional

import jinja2
from procamora_logging import get_logging
from procamora_utils.logger import get_logging

from host import Host

Expand All @@ -21,8 +21,8 @@
def generate_latex(hosts: Dict[Text, Host], interfaces: Text, arp: Text, routes: Text) -> Text:
working_path: Path = Path(__file__).resolve().parent
# report_path: Path = Path(working_path, 'resources', 'templates', 'report.tex')
personal_icon_path: Path = Path(working_path, 'resources', 'icons', 'personal.png')
proyect_icon_path: Path = Path(working_path, 'resources', 'icons', 'logo_transparent.png')
personal_icon_path: Path = Path(working_path, 'resources', 'images', 'personal.png')
proyect_icon_path: Path = Path(working_path, 'resources', 'images', 'logo_transparent.png')

latex_jinja_env = jinja2.Environment(
block_start_string='\BLOCK{',
Expand Down
4 changes: 2 additions & 2 deletions implement_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from pathlib import Path # nueva forma de trabajar con rutas
from typing import Dict, Any, List, Text, NoReturn

from procamora_logging import get_logging
from procamora_sqlite3 import conection_sqlite, execute_script_sqlite
from procamora_utils.interface_sqlite import conection_sqlite, execute_script_sqlite
from procamora_utils.logger import get_logging

from host import Host

Expand Down
2 changes: 1 addition & 1 deletion mac_vendor_lookup_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import Text, NoReturn, Dict, AnyStr

import requests
from procamora_logging import get_logging
from procamora_utils.logger import get_logging

logger: logging = get_logging(False, 'mac_lockup')

Expand Down
3 changes: 2 additions & 1 deletion mio_bot_scan_networks.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/pi/bot_scan_networks/bot_scan.py >> /home/pi/bot_scan/tg_bot.log 2>&1
ExecStart=/usr/bin/python3 /home/pi/minitrue/bot_scan.py >> /home/pi/minitrue/tg_bot.log 2>&1
ExecStop=killall -9 bot_scan.py
User=pi

[Install]
Expand Down
9 changes: 4 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
beautifulsoup4
lxml
# Obtener interfaces locales y sus MACs
netifaces

Expand All @@ -10,11 +12,8 @@ python-nmap

requests

# Libreria propia para gestion de sqlite
procamora-sqlite3

# Libreria propia para realizar ping
procamora-ping
# Libreria propia para gestion de sqlite ping
procamora-utils

# Telegram Bot
pyTelegramBotAPI
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
263 changes: 0 additions & 263 deletions resources/templates/main.tex

This file was deleted.

12 changes: 6 additions & 6 deletions scan_nmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import subprocess
import sys
from ipaddress import IPv4Interface, IPv6Interface
from typing import List, Tuple, Union, Dict, Text
from typing import List, Tuple, Union, Dict, Text, NoReturn

import netifaces
import nmap
from procamora_logging import get_logging
from procamora_ping import ping
from procamora_utils.logger import get_logging
from procamora_utils.ping import ping

from host import Host
from implement_sqlite import select_all_hosts, insert_host, update_host, update_host_offline
Expand All @@ -23,7 +23,7 @@


class ScanNmap:
def __init__(self, subnets: List[Union[IPv4Interface, IPv6Interface]] = None):
def __init__(self: ScanNmap, subnets: List[Union[IPv4Interface, IPv6Interface]] = None) -> NoReturn:
self.nmap_tcp_scan: Text = '--top-ports 1000 --open -T5 -sV -v -n'
self.nmap_ping_scan: Text = '-n -sP'

Expand All @@ -41,10 +41,10 @@ def __init__(self, subnets: List[Union[IPv4Interface, IPv6Interface]] = None):
self.update_db()
logger.info(self.subnets)

def update_db(self: ScanNmap):
def update_db(self: ScanNmap) -> NoReturn:
self.hosts_db = select_all_hosts()

def set_local_interfaces(self: ScanNmap):
def set_local_interfaces(self: ScanNmap) -> NoReturn:
"""
Metodo para obtener todas las interfaces del sistema que tienen asignada una direccion IP y enlazarla con su MAC
en un diccionario
Expand Down
Loading

0 comments on commit 5bf0c13

Please sign in to comment.