Beispiel #1
0
 def __init__(self, connection_string: str,
              target_table: Opt[str]=None, update_id: Opt[str]=None,
              echo: bool=False) -> None:
     SQLAlchemyTarget.__init__(
         self, connection_string,
         target_table=target_table,
         update_id=update_id,
         echo=echo)
Beispiel #2
0
    def output(self):
        """ Returns the target output files for this task.

        Returns:
            luigi.contrib.sqla.SQLAlchemyTarget
        """
        return SQLAlchemyTarget(
            connection_string=self.db_mgr.connection_string, target_table="target", update_id=self.task_id
        )
Beispiel #3
0
    def output(self):
        """ Returns the target output for this task.

        Naming convention for the output file is masscan.TARGET_FILE.parsed.pickle.

        Returns:
            luigi.local_target.LocalTarget
        """
        return SQLAlchemyTarget(
            connection_string=self.db_mgr.connection_string, target_table="port", update_id=self.task_id
        )
Beispiel #4
0
 def __init__(self, table=''):
     super(BaseTask, self).__init__()
     if table != '':
         self.table = table
     # self.mysql_target = mysqldb.MySqlTarget(host=self.ip, database=self.db, user=self.user,
     #                                         password=self.password, table=self.table,
     #                                         update_id=datetime.now().strftime('{table}_%Y-%m-%d').format(table=table))
     self.sqla_target = SQLAlchemyTarget(
         connection_string=self.connection_string,
         target_table=self.table,
         update_id=self.update_id(),
         connect_args=self.connect_args,
         echo=self.echo)
Beispiel #5
0
    def output(self):
        """ Returns the target output for this task.

        If recursion is disabled, the naming convention for the output file is gobuster.TARGET_FILE.txt
        Otherwise the output file is recursive-gobuster_TARGET_FILE.log

        Results are stored in their own directory: gobuster-TARGET_FILE-results

        Returns:
            luigi.local_target.LocalTarget
        """
        return SQLAlchemyTarget(
            connection_string=self.db_mgr.connection_string, target_table="endpoint", update_id=self.task_id
        )
Beispiel #6
0
    def output(self):
        """ Returns the target output for this task.

        Naming convention for the output folder is TARGET_FILE-searchsploit-results.

        The output folder will be populated with all of the output files generated by
        any searchsploit commands run.

        Returns:
            luigi.local_target.LocalTarget
        """
        return SQLAlchemyTarget(
            connection_string=self.db_mgr.connection_string, target_table="searchsploit_result", update_id=self.task_id
        )
Beispiel #7
0
    def output(self):
        """ Returns the target output for this task. target_file.ips || target_file.domains

        In this case, it expects a file to be present in the local filesystem.
        By convention, TARGET_NAME should be something like tesla or some other
        target identifier.  The returned target output will either be target_file.ips
        or target_file.domains, depending on what is found on the first line of the file.

        Example:  Given a TARGET_FILE of tesla where the first line is tesla.com; tesla.domains
        is written to disk.

        Returns:
            luigi.local_target.LocalTarget
        """
        # normally the call is self.output().touch(), however, that causes recursion here, so we grab the target now
        # in order to call .touch() on it later and eventually return it
        db_target = SQLAlchemyTarget(
            connection_string=self.db_mgr.connection_string, target_table="target", update_id=self.task_id
        )

        with open(Path(self.target_file).expanduser().resolve()) as f:
            for line in f.readlines():
                line = line.strip()

                if is_ip_address(line):
                    tgt = self.db_mgr.get_or_create(Target)
                    tgt = self.db_mgr.add_ipv4_or_v6_address_to_target(tgt, line)
                else:
                    # domain name assumed if not ip address
                    tgt = self.db_mgr.get_or_create(Target, hostname=line, is_web=True)

                self.db_mgr.add(tgt)
                db_target.touch()

            self.db_mgr.close()

        return db_target
Beispiel #8
0
    def output(self):
        """ Returns the target output for this task.

        Naming convention for the output folder is TARGET_FILE-nmap-results.

        The output folder will be populated with all of the output files generated by
        any nmap commands run.  Because the nmap command uses -oA, there will be three
        files per target scanned: .xml, .nmap, .gnmap.

        Returns:
            luigi.local_target.LocalTarget
        """
        return {
            "sqltarget": SQLAlchemyTarget(
                connection_string=self.db_mgr.connection_string, target_table="nmap_result", update_id=self.task_id
            ),
            "localtarget": luigi.LocalTarget(str(self.results_subfolder)),
        }