Jump to content

Recommended Posts

Hi everyone! i have Two-Problems:

  • I've used this code to decode and export cookies from Google Chrome application's "C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Default\Cookie" file but i can't receive any data:
#include <CryptProtect.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>

Global Const $g_sLoc_Output = @ScriptDir & "\Cookies.txt"
If FileExists($g_sLoc_Output) Then
   FileDelete($g_sLoc_Output)
EndIf
$hFO_Output = FileOpen($g_sLoc_Output ,1)
If $hFO_Output <> -1 Then
   FileWrite($hFO_Output, Chrome())
   FileFlush($hFO_Output)
   FileClose($hFO_Output)
EndIf

Func Chrome()
   Local $q, $r, $sOutput, $sLoc_ChromeDB = EnvGet("localappdata") & "\Google\Chrome\User Data\Default\Cookies"
   If FileExists($sLoc_ChromeDB) = False Then Return ""
   _SQLite_Startup()
   If @error Then
      MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded! - " & $__g_hPrintCallback_SQLite & @CRLF & @CRLF & "Exiting application")
      Exit -1
   EndIf
   _SQLite_Open($sLoc_ChromeDB)
   _SQLite_Query(-1, 'SELECT host_key, name, value, encrypted_value FROM cookies', $q)
   While _SQLite_FetchData($q, $r) = 0
      $sOutput = $sOutput & r[0] & @CRLF & r[1]
   WEnd
   _SQLite_Close()
   _SQLite_Shutdown()
   Return $sOutput
EndFunc
Edited by Ho3ein
Link to post
Share on other sites

That works fine for me :

#include <Constants.au3>
#include <SQLite.au3>

Opt ("MustDeclareVars", 1)

Local $sResult = Chrome ()
ConsoleWrite (@error & @CRLF)
MsgBox ($MB_SYSTEMMODAL,"",$sResult)

Func Chrome()
   Local $q, $r, $sOutput, $sLoc_ChromeDB = EnvGet("localappdata") & "\Google\Chrome\User Data\Default\Cookies"
   If Not FileExists($sLoc_ChromeDB) Then Return SetError (1, 0, "")
   _SQLite_Startup()
   If @error Then Return SetError (2, 0, "")
   _SQLite_Open($sLoc_ChromeDB)
   If @error Then Return SetError (3, 0, "")
   Local $aNames, $hQuery, $aRow
   _SQLite_Query(-1, "SELECT host_key, name, encrypted_value FROM cookies WHERE ROWID < 50", $hQuery)
   _SQLite_FetchNames ($hQuery, $aNames)
   Local $sOutput = StringFormat ("%-40s  %-40s", $aNames[0], $aNames[1]) & @TAB & $aNames[2] & @CRLF
   While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
      $sOutput &= StringFormat ("%-40s  %-40s", $aRow[0], $aRow[1]) & @CRLF & $aRow[2] & @CRLF
   WEnd
   _SQLite_Close()
   _SQLite_Shutdown()
   Return $sOutput
EndFunc

ps. value is useless for me as it is always equals to "".  Note also I only read rows under 50

Link to post
Share on other sites

Hi @Nine. thanks for your coding, but "encrypted_value" value's are already encrypted. as i told, my 2nd problem is decrypting this values from my chrome Cookies & Login Data db then export them to tidy plain text file.

But thanks for your taking time for me :)

Edited by Ho3ein
Link to post
Share on other sites
7 minutes ago, Nine said:

great protection

It uses Windows API CryptProtect lib for crypt and decrypt data.

I've used this function in AutoIt too, but i did't get decrypted values.

Many freewares are built in this way, but i don't know how they work fine😕

https://gist.github.com/DakuTree/428e5b737306937628f2944fbfdc4ffc

Edited by Ho3ein
Link to post
Share on other sites
  • 4 weeks later...

Any idea? 🤫




I've just got that Chrome 80 (and higher versions) requires to have Master Key in C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Local State file and this file's encrypted_key value has been encrypted via CryptProtectData (DPAPI), then for decrypt Cookie value or Logins value must be use AES-256 (GCB) Algorithm.

https://xenarmor.com/how-to-recover-saved-passwords-google-chrome/

But i don't know how to use in AutoIt, i just have C++ code for this issue🙁

 

Link to post
Share on other sites

Please do not PM, I prefer to use the forum.  You already mentioned there are tools out there that can do this, but in your PM you said you only wanted to get 2 website passwords, most sites have a "Forgot Password" so they should be able to resend you the passwords, can't they?

Also in Google Chrome you should be able to retrieve your passwords or use a password recovery tool see https://www.isunshare.com/internet/recover-or-find-passwords-saved-on-chrome-browser.html so once you have them and you store them in password manager there should be no reason for a script, right?

"I think AutoIt Forum's members think that decrypting credentials of Google Chrome is illegal, but there is a lots of free decryption tools for do this job, i want to get my credentials and cookies as what i want."

You need to remember that while your intentions might be good, this is a public form and others may use any code on here for bad, which hurts the AutoIt community.

Stay safe.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By goku200
      I am trying to change the settings of the print option to Save as PDF and its not changing the settings and clicking on the Save button at the bottom. Here is my script that I have written and the format is correct below. Chrome browser I'm using is 97.0 My script was working fine using Chrome 95.0\ Not sure why its not working now
      It finds the print-preview-app element but not the others.
       
    • By goku200
      I am trying to hit the Return key without having to use the Send keys. I have the following code and its not hitting the Return key. Am I missing something?
      ; Press Return $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE006"},' ; Pause $sAction &= '{"type": "pause", "duration": 500},' ; Release Return $sAction &= '{"type": "keyUp", "value": "\uE006"}]}]}' _WD_Action($sSession, "actions", $sAction)  
    • By goku200
      I'm having some issues with my script that's not grabbing the id from the cell and appending it to the url test that I have in my script.
      Here is my script:
      What I'm having issues is looping through the id column in the excel spreadsheet and adding 1 to the url address when its tabbed by using _WD_NewTab. When it goes to the browser I'm wanting it to display: https://127.0.0.1/test.html?id=1 press Enter and save the file as 1.html and so forth for the others. Not sure what I'm doing wrong here. 
       
    • By SkysLastChance
      How should I be attempting to click this link?

      <span id="x2m8_R-s" class="s_22 s-text">Walk&nbsp;In</span> If I double click the Walk$nbsp;In the text reads Walk In.

      How can I search for this text? 
      I have tried a several  different ways with no luck. Here are a few;
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//span[text()="Walk${nbsp}In"]') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[translate(text(), '\u00a0', ' ') = 'Walk In']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk In')]") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk&nbsp;In')]") Any help is appreciated as always. 
       
       
       
    • By mLipok
      wd_capabilities.au3 UDF was changed/modified/refactored .... and commited/merged (02-12-2021) to https://github.com/Danp2/WebDriver

      WARNING: Before you start using this UDF be sure you download the recent version from: https://github.com/Danp2/WebDriver
       
      ==================================================================================================

      Recently I start wd_capabilities.au3 project on my side.
      I think this is time to share to AutoIt community.
      Check attached UDF: wd_capabilities.au3

      Here is a scratch example showing how to use them:
      #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() ........ ........ ........ _WD_Capabilities_Build_Arguments(Null) ; CLEANUP ARGS _WD_Capabilities_Build_Arguments('--headless') _WD_Capabilities_Build_Arguments('start-maximized') _WD_Capabilities_Build_Arguments('disable-infobars') _WD_Capabilities_Build_Arguments('user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') Local $s_WD_Capabilities_Arguments = _WD_Capabilities_Build_Arguments(Default) ; GET ARGS _WD_Capabilities_Build_Preferences(Null) ; CLEANUP PREFS If $s_Download_dir Then _WD_Capabilities_Build_Preferences('download.default_directory', $s_Download_dir) Local $s_WD_Capabilities_Preferences = _WD_Capabilities_Build_Preferences(Default) ; GET PREFS Local $s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome', $s_WD_Capabilities_Arguments, $s_WD_Capabilities_Preferences) Local $WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) ........ ........ ........ EndFunc  
      I plan to publish the code on GitHub.
      In the indefinite future, when the project becomes more functional, if @Danp2 accepts it, I hope it may be included in the main WebDriver UDF.

      I am waiting for yours feedback and help in the further development of this project.

      REMARK 1:
      As so far this UDF only supports GoogleChrome.
      Adding support for other browsers shouldn't be difficult, I just didn't need to.

      REMARK 2:
      For now, this project is working but still as a early BETA, so please do not discuss, ask questions, or post examples or snippets of code that pertain to any function of this UDF in other part of this forum, until it is found acceptable. Simply: discusion and tests only here in this topic.


      Regards,
      @mLipok
       
×
×
  • Create New...