示例#1
0
文件: net.py 项目: hackeradam17/pooh
    def download_dionaea_binaries(self):
        self.connect()
        sftp = self.ssh.open_sftp()

        storage_path = util.load_config_string(self.config, 'Samples', 'storage_path')
        binaries_path = util.load_config_string(self.config, 'Dionaea', 'binaries')

        local_binaries = os.path.join(storage_path, util.load_config_string(self.config, 'Samples',
                                                                            'dionaea_binary_path'))
        local_binaries_tmp = os.path.join(local_binaries, ".tmp")

        # Create our directories if not exist
        if not os.path.exists(local_binaries):
            self.logger.info("Local binaries path doesn't exist. Creating it now")
            os.makedirs(local_binaries)
        if not os.path.exists(local_binaries_tmp):
            os.makedirs(local_binaries_tmp)

        # Download the binaries to the temp folder
        self.logger.info("Downloading Dionaea binaries...")
        self.download_dir(binaries_path, local_binaries_tmp, sftp)

        # Zip the binaries (if in config)
        if util.load_config_boolean(self.config, 'Samples', 'zip_binaries'):
            if not file_utils.zipall(local_binaries_tmp):
                self.logger.critical("Failed to zip downloaded binaries!")

        # Move the binaries to the final location
        if util.load_config_boolean(self.config, 'Samples', 'keep_duplicate_binaries'):
            file_utils.moveall(local_binaries_tmp, local_binaries, True)
        else:
            file_utils.moveall(local_binaries_tmp, local_binaries, False)
        os.rmdir(local_binaries_tmp)
示例#2
0
文件: net.py 项目: hackeradam17/pooh
    def __init__(self, config):
        # Setup our logging
        logging.basicConfig(level=logging.DEBUG)
        self.logger = logging.getLogger(__name__)

        # Get our server info from config
        self.config = config
        self.host = util.load_config_string(self.config, 'Server', 'host')
        self.port = util.load_config_int(self.config, 'Server', 'port')
        self.allow_unknown = util.load_config_boolean(self.config, 'Server', 'allow_unknown_hosts')
        self.user = util.load_config_string(self.config, 'Auth', 'user')
        self.paswd = util.load_config_string(self.config, 'Auth', 'pass')
        self.ssh = paramiko.SSHClient()

        self.logger.debug("Using server: %s:%s" % (self.host, self.port))
示例#3
0
文件: net.py 项目: hackeradam17/pooh
    def download_dionaea_bitstreams(self):
        self.connect()
        sftp = self.ssh.open_sftp()

        storage_path = util.load_config_string(self.config, 'Samples', 'storage_path')
        bitstreams_path = util.load_config_string(self.config, 'Dionaea', 'bitstreams')

        # Dump the bitstreams
        local_bitstreams = os.path.join(storage_path, util.load_config_string(self.config, 'Samples',
                                                                              'dionaea_bitstream_path'))

        if not os.path.exists(local_bitstreams):
            self.logger.info("Local bitstream path doesn't exists. Creating it now")
            os.makedirs(local_bitstreams)

        self.logger.info("Downloading Dionaea bitstreams...")
        self.download_dir(bitstreams_path, local_bitstreams, sftp)