Search This Blog

Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Monday, November 02, 2020

Python substitute for netcat

When working across multiple platforms and flavours of IX, a system administrator  might not always have tools like telnet or netcat available to test network connections. One tool that is on all flavours of IX and is universal is python.


A quick python script for testing network connection.

I used this python script to send a message via UDP to a logstash server.


import socket
message = 'Flah blah bleh'
byteToSend = str.encode(message)
serverAddressPort = ('IP Address', port)
bufferSize = 1024
soc = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
soc.sendto(byteToSend, serverAddressPort)



Tuesday, August 11, 2020

Password validator

 Validating password with python.


Regex

import re

passRX = re.compile(r'[A-Za-z0-9@#$%^&+=]{8,}')

pp = passRX.search('dy_5mupV')

pp == None

True


pp = passRX.search('DEVGukvk')

pp == None

False


Reference: