- Learning Python for Forensics
- Preston Miller Chapin Bryce
- 170字
- 2021-08-20 10:17:10
Developing the print_output() function
The print_output() function defined on line 71 allows us to control how the data is displayed to the user. This function requires two strings as input that represent the USB name and date, as defined by the docstring. On line 78 and 79, we print the USB data using the .format() method. As discussed in Chapter 1, Now for Something Completely Different, this function replaces the curly brackets ({}) with the data provided in the method call. A simple example like this doesn't show off the full power of the .format() method. However, this function can allow us to perform complex string formatting with ease. After printing the input, execution returns to the called function where the script continues the next iteration of the loop, as follows:
071 def print_output(usb_name, usb_date):
072 """
073 Print the information discovered
074 :param usb_name: String USB Name to print
075 :param usb_date: String USB Date to print
076 :return: None
077 """
078 print('Device: {}'.format(usb_name))
079 print('First Install: {}'.format(usb_date))
推薦閱讀
- unidbg逆向工程:原理與實踐
- 為你護航:網(wǎng)絡空間安全科普讀本(第2版)
- 零信任網(wǎng)絡:在不可信網(wǎng)絡中構建安全系統(tǒng)
- CSO進階之路:從安全工程師到首席安全官
- Web安全與攻防入門很輕松(實戰(zhàn)超值版)
- 工業(yè)控制網(wǎng)絡安全技術
- 同態(tài)密碼學原理及算法
- .NET安全攻防指南(上冊)
- 硬黑客:智能硬件生死之戰(zhàn)
- 移動APT:威脅情報分析與數(shù)據(jù)防護
- Instant Java Password and Authentication Security
- 黑客攻防從入門到精通:黑客與反黑客工具篇(第2版)
- 網(wǎng)絡入侵檢測系統(tǒng)原理與應用
- Instant OSSEC Host-based Intrusion Detection System
- 密碼朋克:自由與互聯(lián)網(wǎng)的未來