fbf1298b6d7b5dd0eab212947831fb29792baa68,DeepExploit/CreateReport.py,CreateReport,create_report,#CreateReport#,39

Before Change


        self.util.print_message(NOTE, "Creating report.")

        // Gather reporting items.
        csv_file_list = glob.glob(os.path.join(self.report_path, "*.csv"))

        // Create DataFrame.
        content_list = []
        for file in csv_file_list:
            content_list.append(pd.read_csv(file, names=self.header, sep=","))
        df_csv = pd.concat(content_list).drop_duplicates().sort_values(by=["ip", "port"],
                                                                       ascending=True).reset_index(drop=True,
                                                                                                   col_level=1)

After Change


            exit(1)

        // Gather reporting items.
        if mode == "train":
            self.util.print_message(NOTE, "Creating training report.")
            csv_file_list = glob.glob(os.path.join(self.report_train_path, "*.csv"))

            // Create DataFrame.
            content_list = []
            for file in csv_file_list:
                content_list.append(pd.read_csv(file, names=self.header, sep=","))
            df_csv = pd.concat(content_list).drop_duplicates().sort_values(by=["ip", "port"],
                                                                           ascending=True).reset_index(drop=True,
                                                                                                       col_level=1)

            items = []
            for idx in range(len(df_csv)):
                items.append({"ip_addr": df_csv.loc[idx, "ip"],
                              "port": df_csv.loc[idx, "port"],
                              "prod_name": df_csv.loc[idx, "service"],
                              "vuln_name": df_csv.loc[idx, "vuln_name"],
                              "type": df_csv.loc[idx, "type"],
                              "description": df_csv.loc[idx, "description"],
                              "exploit": df_csv.loc[idx, "exploit"],
                              "target": df_csv.loc[idx, "target"],
                              "payload": df_csv.loc[idx, "payload"],
                              "ref": str(df_csv.loc[idx, "reference"]).replace("@", "<br>")})

            try:
                // Setting template.
                env = Environment(loader=FileSystemLoader(self.report_train_path))
                template = env.get_template(self.template_train)
                pd.set_option("display.max_colwidth", -1)
                html = template.render({"title": "Deep Exploit Scan Report", "items": items})

                // Write report.
                with codecs.open(self.report_train_file, "w", "utf-8") as fout:
                    fout.write(html)
            except Exception as err:
                self.util.print_exception(err, "Creating report error.")
            self.util.print_message(OK, "Creating training report done.")
        else:
            self.util.print_message(NOTE, "Creating testing report.")
            self.util.print_message(OK, "Creating testing report done.")


// Define command option.
__doc__ = {f}
Usage:
    {f} (-m <mode> | --mode <mode>)
    {f} -h | --help
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: 13o-bbr-bbq/machine_learning_security
Commit Name: fbf1298b6d7b5dd0eab212947831fb29792baa68
Time: 2018-07-11
Author: takaesu235@gmail.com
File Name: DeepExploit/CreateReport.py
Class Name: CreateReport
Method Name: create_report


Project Name: 13o-bbr-bbq/machine_learning_security
Commit Name: 8ef0696faafad2a35227fef0227bf6e1f81cef74
Time: 2018-07-17
Author: takaesu235@gmail.com
File Name: DeepExploit/CreateReport.py
Class Name: CreateReport
Method Name: create_report


Project Name: gyoisamurai/GyoiThon
Commit Name: dcadd82c55dcc78d2b419467b93e1df28be2dc81
Time: 2019-03-20
Author: gyoiler3@gmail.com
File Name: modules/Gyoi_Creator.py
Class Name: Creator
Method Name: add_train_data