Esempio n. 1
0
    def __init__(self, sh, testparam=''):
        """
        Initialization Routine for the module
        """
        # TO DO: Shortname anders setzen (oder warten bis der Module Loader es beim Laden setzt
        self._shortname = self.__class__.__name__
        self._shortname = self._shortname.lower()

        self.logger = logging.getLogger(__name__)
        self._sh = sh
        self.shtime = Shtime.get_instance()
        self.logger.debug(f"Module '{self._shortname}': Initializing")

        # Test if http module is loaded (if the module uses http)
        # try:
        #     self.mod_http = Modules.get_instance().get_module('http')  # try/except to handle running in a core version that does not support modules
        # except:
        #     self.mod_http = None
        # if self.mod_http == None:
        #     self.logger.error(
        #         "Module '{}': Not initializing - Module 'http' has to be loaded BEFORE this module".format(self._shortname))
        #     self._init_complete = False
        #     return
        #
        # self._showtraceback = self.mod_http._showtraceback

        # get the parameters for the module (as defined in metadata module.yaml):
        self.logger.debug(
            f"Module '{self._shortname}': Parameters = '{dict(self._parameters)}'"
        )
        try:
            # self.broker_ip = self._parameters['broker_host']
            pass
        except KeyError as e:
            self.logger.critical(
                f"Module '{self._shortname}': Inconsistent module (invalid metadata definition: {e} not defined)"
            )
            self._init_complete = False
            return

        ip = Utils.get_local_ipv4_address()  # remove line if `ip` unused
Esempio n. 2
0
 def run(self, command):
     return Utils.run(self.getName(), self.user, command)
Esempio n. 3
0
def processData(mssqlConfig, mysqlConfig, logFile, tables):
    logging.basicConfig(filename=logFile,
                        filemode='a',
                        level=logging.INFO,
                        format='%(asctime)s: %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S')

    mysqlServer = mysqlConfig['host']
    mysqlPort = mysqlConfig['port']
    mysqlUsername = mysqlConfig['username']
    mysqlPassword = mysqlConfig['password']
    mysqlDB = mysqlConfig['db']
    mysqlHandle = DB.myHandle(mysqlServer, mysqlUsername, mysqlPassword,
                              mysqlDB, mysqlPort)

    print 'mysqlServer:' + mysqlServer + ' mysqlPort:' + str(
        mysqlPort) + ' mysqlUserName:'******'mysqlPassword:'******' mysqlDB:' + mysqlDB

    mssqlDriver = mssqlConfig['driver']
    mssqlServer = mssqlConfig['host']
    mssqlUsername = mssqlConfig['username']
    mssqlPassword = mssqlConfig['password']
    mssqlDB = mssqlConfig['db']
    mssqlPort = mssqlConfig['port']
    mssqlDSN = 'Driver={};Server={};Database={};Uid={};Pwd={};Port={};TDS_Version=8.0;'.format(
        mssqlDriver, mssqlServer, mssqlDB, mssqlUsername, mssqlPassword,
        mssqlPort)

    print 'mssqlDriver:' + mssqlDriver + ' mssqlServer:' + mssqlServer + ' mssqlUserName:'******'mssqlPassword:'******' mssqlDB:' + mssqlDB + ' mssqlPort:' + str(
        mssqlPort)

    mssqlHandle = DB.msHandle(mssqlDSN)

    mssqlUtil = MssqlUtil()
    mssqlUtil.setMssqlHandle(mssqlHandle.getCursor())
    dataTypes = Utils.getDataTypes()

    process = DataProcess()
    process.setDBHandle(mysqlHandle, mssqlHandle)
    process.setLogging(logging)

    for table in tables:
        msTable = table
        myTable = '{}_{}'.format(mssqlServer, table)

        pk = mssqlUtil.getPrimaryKey(table)

        # Auto create table
        createSql = mssqlUtil.genCreateTableSql(table, myTable, dataTypes)
        mysqlHandle.getCursor().execute(createSql)

        # Update/Insert records in destination DB that do not match source DB.
        logging.info("Preparing to insert/update records.")

        process.refreshData(myTable, msTable, pk)

        logging.info("Insert/update records complete.")

        # Delete records from destination DB that no longer exist in source DB.
        logging.info("Preparing to delete records.")

        process.deleteData(myTable, msTable, pk)

        logging.info("Delete records complete.")

    mssqlHandle.disconnect()
    mysqlHandle.disconnect()
Esempio n. 4
0
	def run(self, command):
		return Utils.run(self.getName(), self.user, command)
Esempio n. 5
0
 def test_ssh(self):
     output = Utils.run('aws-devbox-root', 'root', 'uname -a')
     self.assertEqual(
         output,
         'Linux aws-devbox 4.1.10-17.31.amzn1.x86_64 #1 SMP Sat Oct 24 01:31:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux'
     )
Esempio n. 6
0
from dotenv import load_dotenv
import os
import random

load_dotenv()
CLIENT_ID=os.getenv('CLIENT_ID')
CLIENT_SECRET=os.getenv('CLIENT_SECRET')
GENIUS_API_SECRET=os.getenv('GENIUS_ACCESS_TOKEN')

# Import spotify interface + utils libraries
from lib.Spotify import Spotify
from lib.Utils import Utils
utils = Utils()

from lib.lyrics import *

# import flask
from flask import Flask
from flask import jsonify
from flask import request
from flask import render_template
from flask_cors import CORS
app = Flask(__name__)
CORS(app)

#import other necessary modules
import json
from dateutil import parser

# Testing route/main route
@app.route('/')
Esempio n. 7
0
import time
import os
import sys
import re
import threading
from termcolor import cprint, colored
from pyfiglet import figlet_format
from lib.Utils import Utils
from lib.Constants import Constants
from lib.SocketConnection import SocketConnection
from pathlib import Path
import colorama

colorama.init()

utils = Utils()
constants = Constants()

# Argument parser
parser = argparse.ArgumentParser(
    description='HTTP Request Smuggling vulnerability detection tool')
parser.add_argument("-u", "--url", help="set the target url")
parser.add_argument("-urls",
                    "--urls",
                    help="set list of target urls, i.e (urls.txt)")
parser.add_argument("-t", "--timeout", help="set socket timeout, default - 10")
parser.add_argument("-m",
                    "--method",
                    help="set HTTP Methods, i.e (GET or POST), default - POST")
parser.add_argument(
    "-r",
Esempio n. 8
0
def my_utils():
    return Utils()
Esempio n. 9
0
	def test_ssh(self):
		output = Utils.run('aws-devbox-root', 'root', 'uname -a')
		self.assertEqual(output, 'Linux aws-devbox 4.1.10-17.31.amzn1.x86_64 #1 SMP Sat Oct 24 01:31:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux')