Several simple projects done in Python for network monitoring for Cybersecurity and high availability. All the modules needed are in their folder with the script.
UPDATED, ADDED PASSWORD GENERATOR
๐๐๐ก๐๐ช๐๐๐ง๐
This script, made with the psutil library, obtains your bandwidth on the network interface you specify.
References
https://pypi.org/project/psutil/
๐๐ฅ๐ฌ๐ฃ๐ง๐ข๐๐ฅ๐๐ฃ๐๐ฌ
This script generates a private key with the RSA encryption algorithm of 2048, then what it does is to convert the private key to a PEM format file, we write the key to the generated file. Then we generate the public key from the private key.
Finally we pass the public key to an SSH file and write it to a file.
References
https://pypi.org/project/cryptography/
๐๐๐ฅ๐๐ช๐๐๐ ๐ฅ๐จ๐๐
This script is very customizable, as we can adjust it for our own needs, in this case I have made a rule to block ping, another rule to block RDP protocol, and the last rule allows TCP traffic from one subnet to another over port 80, in this case, the good thing about this is that you can change it to suit your needs.
References
https://pypi.org/project/python-iptables/
๐๐๐ฆ๐ ๐๐๐๐๐จ๐๐๐ง๐ข๐ฅ
References
https://pypi.org/project/hashlib/
๐ฃ๐๐ฆ๐ฆ๐ช๐ข๐ฅ๐ ๐๐๐ก๐๐ฅ๐๐ง๐ข๐ฅ
This password generation script, the first thing I have done is to create a function that creates the password with all the ASCII characters and digits with the string library, then create a JSON file, add an exception, and then call the function created and pass it as parameter 12 to make it as secure as possible, and finally the generated passwords will be dumped to the JSON file previously created.
References
https://pypi.org/project/python-secrets/
https://docs.python.org/3/library/json.html
https://docs.python.org/es/3/library/string.html
๐ฃ๐ข๐ฅ๐ง ๐ฆ๐๐๐ก๐ก๐๐ฅ
The port scanner, I have created a function to scan all ports from 1 to 65535 and check if it is open and then close the connection. Out of the function we indicate the IP to which we want to scan and the ports. Finally we call the function, with the three parameters.
References
https://docs.python.org/es/3/library/socket.html
๐ง๐ฅ๐๐๐๐๐ ๐๐ก๐๐๐ฌ๐ญ๐๐ฅ
This script is very short but powerful because it uses one of the best cybersecurity libraries such as scapy. I define a function, in this function it will verify if the packets are TCP and we indicate the TCP traffic and it indicates the size in bytes. With sniff we start capturing packets through the interface that we indicate, in this case eth0.
References
https://scapy.net/
๐ช๐๐ ๐๐ฃ๐ฃ ๐ฆ๐๐๐ก๐ก๐๐ฅ
This script to scan and analyze a web page we need the famous BeautifulSoup library. We indicate the URL that we want to scan, we collect the GET that we have answered the web that we indicate and we get the HTML and parse it using the library, and in this case, we get all the links on the page and finally iterate it with a for loop to show us all.
References
https://pypi.org/project/requests/
https://pypi.org/project/beautifulsoup4/