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
| 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 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 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
| 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 socket; | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| openPort = False | |
| while openPort == False: | |
| result = sock.connect_ex(('10.10.10.136', 20)) | |
| if result == 0: | |
| openPort = True | |
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
| # 1) Create your private key (any password will do, we remove it below) | |
| $ cd ~/.ssh | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
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
| package main | |
| import "fmt" | |
| func main() { | |
| red := int(0xFF0000FF) | |
| green := int(0x00FF00FF) | |
| blue := int(0x0000FFFF) | |
| redHex, greenHex, blueHex, alphaHex := calcColor(red) |
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 sys, os, socket | |
| s = socket.socket() | |
| s.bind((sys.argv[1], int(sys.argv[2]))) | |
| s.listen(5) | |
| try: | |
| while True: | |
| conn, addr = s.accept() | |
| path = os.path.join(os.getcwd(), "./"+conn.recv(4096).split("\n")[0].split(" ")[1]) | |
| conn.send((open(path).read() if os.path.isfile(path) else reduce(lambda x,s:x+"\n"+s+("/" if os.path.isdir(s) else ""),sorted(os.listdir(path)),"Directory "+path+" ls")) if os.path.exists(path) else '404: '+path) | |
| conn.close() |
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
| package main | |
| import ( | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| // TransportWrapper wraps the http.Transport structure to allow us to record the | |
| // URLs which we are redirected through |