- Python 取證學教程
- 主頁
- 簡介
- 安裝 Python
- Python 概述
- 基本取證應用
- 雜湊函式
- 破解加密
- 虛擬化
- 網路取證
- Python 模組
- Dshell 和 Scapy
- 搜尋
- 索引
- Python 影像庫
- 移動取證
- 網路時間協議
- 多程序支援
- 記憶體與取證
- Linux 中的取證
- 入侵指標
- 雲的實現
- Python 取證學有用資源
- Python 取證學 - 快速指南
- Python 取證學 - 有用資源
- Python 取證學 - 討論
Python 取證學 - 多程序支援
通常情況下,取證專家很難運用數字解決方案分析大量常見的犯罪中出現的數字證據。大多數數字調查工具都是單執行緒的,一次只能執行一個命令。
本章,我們專注於 Python 的多程序功能,可以應對常見的取證挑戰。
多程序
多程序是指計算機系統支援多個程序的能力。支援多程序的作業系統可以同時執行多個程式。
多程序有不同的型別,例如對稱和非對稱處理。下圖引用了通常在取證調查中遵循的對稱多程序系統。
示例
以下程式碼展示了在 Python 程式設計中不同程序在內部如何列出。
import random
import multiprocessing
def list_append(count, id, out_list):
#appends the count of number of processes which takes place at a time
for i in range(count):
out_list.append(random.random())
if __name__ == "__main__":
size = 999
procs = 2
# Create a list of jobs and then iterate through
# the number of processes appending each process to
# the job list
jobs = []
for i in range(0, procs):
out_list = list() #list of processes
process1 = multiprocessing.Process(
target = list_append, args = (size, i, out_list))
# appends the list of processes
jobs.append(process)
# Calculate the random number of processes
for j in jobs:
j.start() #initiate the process
# After the processes have finished execution
for j in jobs:
j.join()
print "List processing complete."
這裡,函式list_append()幫助在系統中列出程序集合。
輸出
我們的程式碼會產生如下輸出 −
廣告