ord function is to convert a character to its equivalent integer representation. chr function is to convert the integer to its character representation. random.choice() method randomly picks a character from a series of characters to form a string of N length, this is the key for encryption and decryption. A message is taken from user's … Continue reading [python]Hand made cryptography with XOR method.
I do not like to write a python cli that accepts argument as I am an advocate of using wizard style to guide user on how to configure things easily. But it seems the time has come for me to write a CLI script in python, and in order to provide usage guide and data … Continue reading [python]Argparser
There is a chance when you need to verify all params in the dictionary are present before submitting a post request to an API server. This is one of the solution which I am using: The use of all function evaluates an iterable and returns true if all elements are true.
I noticed I did not have enough testing on my code for getting directories under base project directory. This is part of the code snippet of my SSHClient subclass: The problem The method gets all things under the base directory that is files and directories, that is because I have sliced and diced too much … Continue reading [python] Improving get_project_dirs method of SSHClient subclass
Paramiko SSH client I wrote a sub class from paramiko in order add on functionality to assist myself to work with Ansible AWX 9.2.0 (dockerless version). The subclass works with my CentOS which hosts the Ansible AWX, the purpose is to use the SSHClient class to download and upload playbooks, check the existence of project … Continue reading [python]Paramiko’s SSHClient
I have a dev server which is running with http, however to minimise the need to change the code, I want to write a function to check. Here's an example:
I felt it is worth to take some of my sleeping time to document how to dissect AggregatedResult object after a nornir task is executed. napalm_get with getters=["config"] This are my user inputs: example: After nornir task is executed an AggregatedResult object which looks like below: AggregatedResult is a dictionary like object, in this example … Continue reading [python]Dissecting AggregatedResult
I have a few Cisco routers which are on IOS, I have never used NAPALM before, I use netmiko most often for cisco devices, Napalm itself is based on netmiko, I napalm has a get_facts method that gather the information of cisco ios router, this is very convenient as compared with netmiko, netmiko is more … Continue reading [python]First use of Napalm
Introduction The version used for this lab is Cisco FMC 6.4.0, and Cisco FTD used is 6.3.0. To access the Cisco FMC REST API, you need to ensure it is enabled. You can test it by going to https:///api/api-explorer if you can see the swagger like documentation then the REST API is enabled, you can … Continue reading [python]Cisco FMC REST API example – GET Server version and add device to Cisco FMC
Introduction I am finding a windows application which can use to download youtube videos like downie, I found out a python module known as pytube3 that can be used for this purpose. Basic usage So for my own purpose I download some videos which I need to listen while exercising, below is the code to … Continue reading [python]Download videos from youtube with pytube