Export your public key:
keybase pgp export > keybase-public.key
Export your private key:
keybase pgp export --secret > keybase-private.key
""" | |
user_example.py - Sample flow of using ReactorlessCommando. | |
This is an example of the following: | |
1. Run 'show users' on a list of devices. | |
2. Check if a certain user is found in the output for each device. | |
3. Execute 'show clock' on each device where user was found. | |
4. Display the results | |
""" |
""" | |
Test (data) migrations in Django. | |
This uses py.test/pytest-django (the `transactional_db` fixture comes from there), | |
but could be easily adopted for Django's testrunner: | |
from django.test.testcases import TransactionTestCase | |
class FooTestcase(TransactionTestCase): | |
def test_with_django(self): |
# -*- coding: utf-8 -*- | |
""" | |
Loader for Trigger NetDevices using NSoT API. | |
Right now this loads ALL devices ALL the time, which scales very poorly with | |
the number of devices and attributes in NSoT. | |
Note that ``NETDEVICES_SOURCE`` is ignored because the settings from your | |
``~/.pynsotrc``. |
""" | |
Integration of Trigger + NAPALM drivers | |
""" | |
from napalm import get_network_driver | |
def get_driver_for_netdevice(device): | |
vendor_name = device.vendor.name | |
if vendor_name == 'cisco': |
# -*- coding: utf-8 -*- | |
""" | |
config_device2.py | |
Duplicate of `~trigger.contrib.commando.plugins.config_device` using | |
``Commando`` as a base vs. ``CommandoApplication``. | |
Bug fixes: |
def plain_to_dot(asn): # -> str | |
'''Take ASPLAIN and return ASDOT notation | |
asn: int | |
''' | |
barray = struct.pack('>I', asn) | |
return '%d.%d' % struct.unpack('>HH', barray) | |
def dot_to_plain(asn): # -> int |
import sys | |
from datetime import datetime | |
import time | |
from pprint import pprint | |
from trigger.cmds import Commando | |
from twisted.python import log | |
from twisted.internet import reactor | |
from trigger.netdevices import NetDevices, NetDevice | |
''' | |
620031587 | |
Net-Centric Computing Assignment | |
Part A - RSA Encryption | |
''' | |
import random | |
''' |
Export your public key:
keybase pgp export > keybase-public.key
Export your private key:
keybase pgp export --secret > keybase-private.key
# Inspired from https://medium.com/@ismailakkila/black-hat-python-encrypt-and-decrypt-with-rsa-cryptography-bd6df84d65bc | |
# Updated to use python3 bytes and pathlib | |
import zlib | |
import base64 | |
from Crypto.PublicKey import RSA | |
from Crypto.Cipher import PKCS1_OAEP | |
from pathlib import Path | |