This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def __init__(self, **kwargs): | |
| for key, value in kwargs.items(): | |
| setattr(self, key, value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from logging.handlers import SysLogHandler | |
| import sys | |
| def create_logger(name, verbosity): | |
| """create_logger uses a name and verbosity level. The name is most commonly | |
| the __name__ variable and verbosity is most often passed to the program | |
| from command line arguments via ConfigParser/configparser. This then sets | |
| the log level to Warning (no verbosity), Information (verbosity 1), or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import glob | |
| import csv | |
| from libnmap.parser import NmapParser | |
| dir_path = os.path.dirname(os.path.realpath(__file__)) | |
| with open('nmap_results.csv', 'wb') as output_file: | |
| writer = csv.writer(output_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import glob | |
| from datetime import datetime | |
| from elasticsearch import Elasticsearch | |
| from libnmap.parser import NmapParser | |
| dir_path = os.path.dirname(os.path.realpath(__file__)) | |
| es = Elasticsearch() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import os | |
| import re | |
| import subprocess | |
| import yum | |
| yb = yum.YumBase() | |
| yb.setCacheDir() | |
| dependency_installed = yb.rpmdb.searchNevra(name='yum-utils') | |
| if not dependency_installed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| sudo grep -rni --exclude-dir={proc,boot,sys} "searchingfor" / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # or use https://docs.python.org/3/library/itertools.html#itertools.permutations | |
| def permutations(string, step = 0): | |
| # if we've gotten to the end, print the permutation | |
| if step == len(string): | |
| print "".join(string) | |
| # everything to the right of step has not been swapped yet | |
| for i in range(step, len(string)): | |
| # copy the string (store as array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| pat="^[0-9a-zA-Z ]{1,}\.plist" | |
| xml_pat="^<\?xml.*" | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "[-] Not running as root, you probably won't see any results." | |
| fi | |
| for f in /var/db/dslocal/nodes/Default/users/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [defaults] | |
| inventory: ./inventories/production/hosts.yml | |
| remote_user: kkirsche | |
| remote_port: 22 | |
| forks: 20 | |
| pipelining: True | |
| callback_whitelist: json | |
| retry_files_enabled: False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Red Prompt — Production | |
| STARTCOLOR="\e[0;31m" | |
| ENDCOLOR="\e[0;0m" | |
| PS1="\[$STARTCOLOR\][\u@\h \W]\\$ \[$ENDCOLOR\]" | |
| Yellow Prompt — Staging | |
| STARTCOLOR="\e[0;33m" | |
| ENDCOLOR="\e[0;0m" | |
| PS1="\[$STARTCOLOR\][\u@\h \W]\\$ \[$ENDCOLOR\]" |