Python Forensics 简明教程

Python Forensics - Implementation of Cloud

Cloud computing 可定义为面向 Internet 用户提供的托管服务集合。它使组织能够使用或甚至计算资源,其中包括虚拟机 (VM)、存储或应用程序作为公用事业。

在 Python 编程语言中构建应用程序最重要的优势之一是,它包括在几乎任何平台(包括 cloud )上虚拟部署应用程序的能力。这意味着 Python 可以在云服务器上执行,也可以在诸如台式机、平板电脑或智能手机之类的便携式设备上启动。

一个有趣的视角是利用 Rainbow tables 创建云基础。它有助于集成单版本和多进程版本的应用程序,这需要一些考量。

Pi Cloud

Pi Cloud 是云计算平台,集成了 Python 编程语言和 Amazon Web Services 的计算能力。

pi cloud

我们来看看一个使用 rainbow tables 实现 Pi 云的示例。

Rainbow Tables

rainbow table 被定义为针对特定散列算法列出所有可能的明文排列的加密密码。

  1. 彩虹表遵循标准模式,创建散列密码列表。

  2. 文本文件用来生成密码,其中包括要加密的密码字符或明文。

  3. 该文件由 Pi 云使用,Pi 云调用要存储的主功能。

  4. 散列密码的输出也存储在文本文件中。

该算法还可以用来将密码存储在数据库中,并在云系统中进行备份存储。

以下内置程序在文本文件中创建加密密码列表。

Example

import os
import random
import hashlib
import string
import enchant    #Rainbow tables with enchant
import cloud      #importing pi-cloud

def randomword(length):
   return ''.join(random.choice(string.lowercase) for i in range(length))

print('Author- Radhika Subramanian')

def mainroutine():
   engdict = enchant.Dict("en_US")
   fileb = open("password.txt","a+")

   # Capture the values from the text file named password
   while True:
      randomword0 = randomword(6)
      if engdict.check(randomword0) == True:
         randomkey0 = randomword0+str(random.randint(0,99))
      elif engdict.check(randomword0) == False:
         englist = engdict.suggest(randomword0)
         if len(englist) > 0:
            randomkey0 = englist[0]+str(random.randint(0,99))
         else:
            randomkey0 = randomword0+str(random.randint(0,99))

      randomword3 = randomword(5)
      if engdict.check(randomword3) == True:
         randomkey3 = randomword3+str(random.randint(0,99))
      elif engdict.check(randomword3) == False:
         englist = engdict.suggest(randomword3)
         if len(englist) > 0:
            randomkey3 = englist[0]+str(random.randint(0,99))
         else:
            randomkey3 = randomword3+str(random.randint(0,99))

      if 'randomkey0' and 'randomkey3' and 'randomkey1' in locals():
         whasher0 = hashlib.new("md5")
         whasher0.update(randomkey0)
         whasher3 = hashlib.new("md5")
         whasher3.update(randomkey3)
         whasher1 = hashlib.new("md5")
         whasher1.update(randomkey1)
         print(randomkey0+" + "+str(whasher0.hexdigest())+"\n")
         print(randomkey3+" + "+str(whasher3.hexdigest())+"\n")
         print(randomkey1+" + "+str(whasher1.hexdigest())+"\n")
         fileb.write(randomkey0+" + "+str(whasher0.hexdigest())+"\n")
         fileb.write(randomkey3+" + "+str(whasher3.hexdigest())+"\n")
         fileb.write(randomkey1+" + "+str(whasher1.hexdigest())+"\n")

jid = cloud.call(randomword)  #square(3) evaluated on PiCloud
cloud.result(jid)
print('Value added to cloud')
print('Password added')
mainroutine()

Output

此代码将生成以下输出:

cloud implementation output

密码存储在文本文件中,是可见的,如下面的屏幕截图所示。

passwords stored in text files