官术网_书友最值得收藏!

How it works...

As you can see, in Step 1, we imported the pefile module to enumerate the samples. Once that is done, we define the convenience function, as you can see in Step 2. The reason being that it often imports using varying cases (upper/lower). This causes the same import to appear as distinct imports.

After preprocessing the imports, we then define another function to collect all the imports of a file into a list. We will also define a function to collect the names of the sections of a file in order to standardize these names such as .text, .rsrc, and .reloc while containing distinct parts of the file (Step 3). The files are then enumerated in our folders and empty lists will be created to hold the features we will be extracting. The predefined functions will then collect the imports (Step 4), section names, and the number of sections of each file (Steps 5 and 6). Lastly, a try-catch clause will be defined in case a file's PE header cannot be parsed (Step 7). This can happen for many reasons. One reason being that the file is not actually a PE file. Another reason is that its PE header is intentionally or unintentionally malformed.

主站蜘蛛池模板: 高碑店市| 延安市| 杭锦旗| 平谷区| 道真| 沧州市| 延长县| 定陶县| 玉环县| 玛纳斯县| 同德县| 安龙县| 邓州市| 房山区| 石台县| 米泉市| 绍兴县| 旬阳县| 遂宁市| 临汾市| 舞阳县| 连山| 达尔| 宜兴市| 平果县| 昌都县| 新闻| 西丰县| 鲁山县| 南漳县| 体育| 东阳市| 金溪县| 九台市| 日照市| 嘉鱼县| 鸡西市| 呼伦贝尔市| 微山县| 许昌市| 郓城县|