Python取證 - 雲端實現



雲計算可以定義為透過網際網路向用戶提供的一組託管服務。它使組織能夠像使用公用事業一樣使用或計算資源,包括虛擬機器(VM)、儲存或應用程式。

使用Python程式語言構建應用程式最重要的優勢之一是它能夠將應用程式幾乎部署到任何平臺,包括。這意味著Python可以在雲伺服器上執行,也可以在方便的裝置上啟動,例如桌上型電腦、平板電腦或智慧手機。

一個有趣的視角是建立基於彩虹表生成的雲端資料庫。這有助於整合應用程式的單程序和多程序版本,但這需要一些考慮。

Pi雲

Pi雲是一個雲計算平臺,它將Python程式語言與Amazon Web Services的計算能力相結合。

Pi Cloud

讓我們來看一個使用彩虹表實現Pi雲的例子。

彩虹表

彩虹表定義為針對給定雜湊演算法的所有可能的加密密碼的明文排列列表。

  • 彩虹表遵循標準模式,它建立一個雜湊密碼列表。

  • 一個文字檔案用於生成密碼,其中包括要加密的密碼的字元或明文。

  • Pi雲使用該檔案呼叫要儲存的主函式。

  • 雜湊密碼的輸出也儲存在文字檔案中。

此演算法也可以用於將密碼儲存在資料庫中,並在雲系統中擁有備份儲存。

以下內建程式在文字檔案中建立一個加密密碼列表。

示例

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()

輸出

這段程式碼將產生以下輸出:

Cloud Implementation Output

密碼儲存在文字檔案中,如下圖所示。

Passwords Stored in Text Files
廣告