From 239ab8ba9a2f2a238276f4d4a262a56a227959e9 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:11:04 -0500 Subject: [PATCH 01/10] Non-code changes - Typo - Update "Authenticator Key" image URL --- README.md | 2 +- assets/bw-at.ini | Bin 8154 -> 8152 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8f0552..6eef168 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ This is a script-based utility; not a full-fledged, enterprise-ready application [04]: https://bitwarden.com "Bitwarden" [05]: https://github.com/anonymous1184/bitwarden-autotype/wiki "Wiki not written yet" [06]: https://keepass.info/help/v2/autotype_obfuscation.html "TCATO: Two-Channel Auto-Type Obfuscation" -[07]: https://i.imgur.com/WeddYxr.png "Entry with Authenticator Key" +[07]: https://i.imgur.com/Qwv9oKQ.png "Entry with Authenticator Key" [08]: https://github.com/bitwarden/cli "Bitwarden CLI" [09]: https://github.com/bitwarden/jslib/blob/master/src/models/view/loginUriView.ts#L9 "loginUriView.ts:9" [10]: https://github.com/bitwarden/jslib/blob/master/src/angular/components/icon.component.ts#L80 "icon.component.ts:6" diff --git a/assets/bw-at.ini b/assets/bw-at.ini index c628c33747d912a33c5bf0b65299e337082aa7ea..1d4524566b6f8bd64d55ebeac28b0505b80c0122 100644 GIT binary patch delta 31 mcmca*f5U!*oAhQ6X){LNK!$RLG6qYAd%WP69~!x delta 31 mcmca%f6IP@oAhQEX$wYP1BOTjZw3nnXNC-hyv?05{>%WI8whCt From 4c625e6baba0d4175b90275cf55beb4b5ca656a1 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:12:09 -0500 Subject: [PATCH 02/10] Better settings change detection --- Lib/settings.ahk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Lib/settings.ahk b/Lib/settings.ahk index 15f9565..75d0543 100644 --- a/Lib/settings.ahk +++ b/Lib/settings.ahk @@ -1,26 +1,26 @@  settings() { - SetTimer fileUpdate, 1000 - SplitPath settings, fileName - if !WinExist(fileName) - Run % "edit " settings - WinWait % fileName - WinWaitClose % fileName - SetTimer fileUpdate, Delete + SplitPath settings, filename + Run % "edit " settings + WinWait % filename + SetTimer settings_update, 1000 } -fileUpdate() +settings_update() { static last := 0 FileGetTime mTime, % settings - if !last + if !last || WinExist("Secure Password Generator") last := mTime - if (last != mTime) + else if (last != mTime) { MsgBox % 0x4|0x20|0x40000, % appTitle, Application needs to be reloaded for the changes to take effect. Reload now? IfMsgBox Yes Reload last := mTime } + SplitPath settings, filename + if !WinExist(filename) + SetTimer % A_ThisFunc, Delete } From c412fce4f7ee5fb51a656c5a7af32ce4bcb35283 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:13:40 -0500 Subject: [PATCH 03/10] Wrap TrayTip in a function --- Lib/autoType.ahk | 2 +- Lib/init.ahk | 2 +- Lib/sync.ahk | 2 +- Lib/tip.ahk | 5 +++++ Lib/toggleLock.ahk | 4 ++-- Lib/toggleLogin.ahk | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 Lib/tip.ahk diff --git a/Lib/autoType.ahk b/Lib/autoType.ahk index 02dd20a..c278369 100644 --- a/Lib/autoType.ahk +++ b/Lib/autoType.ahk @@ -10,7 +10,7 @@ autoType(entry, mode) { if INI.GENERAL.totp Clipboard := entry.totp - TrayTip % appTitle, % "TOTP: " formatOtp(entry.totp), 10, 0x20 + tip("TOTP: " formatOtp(entry.totp)) } } diff --git a/Lib/init.ahk b/Lib/init.ahk index 8e278af..75e412b 100644 --- a/Lib/init.ahk +++ b/Lib/init.ahk @@ -26,7 +26,7 @@ init() ; Acknowledge Menu Tray, Icon, % A_IsCompiled ? A_ScriptFullPath : A_ScriptDir "\assets\bw-at.ico" - TrayTip % appTitle, Auto-Type Ready, 10, 0x20 + tip("Auto-Type Ready") ; Setup PIN if INI.PIN.use = -1 && !INI.PIN.hex && pin := pinSetup() diff --git a/Lib/sync.ahk b/Lib/sync.ahk index 6b3a23e..f759c94 100644 --- a/Lib/sync.ahk +++ b/Lib/sync.ahk @@ -8,7 +8,7 @@ sync(showTip := false) SetTimer bwStatus, -1 getData() if showTip - TrayTip % appTitle, Sync complete, 10, 0x20 + tip("Sync complete") } sync_auto(mins) diff --git a/Lib/tip.ahk b/Lib/tip.ahk new file mode 100644 index 0000000..e28c989 --- /dev/null +++ b/Lib/tip.ahk @@ -0,0 +1,5 @@ + +tip(txt) +{ + TrayTip % appTitle, % txt, 10, 0x20 +} diff --git a/Lib/toggleLock.ahk b/Lib/toggleLock.ahk index 2b19910..80205da 100644 --- a/Lib/toggleLock.ahk +++ b/Lib/toggleLock.ahk @@ -39,7 +39,7 @@ toggleLock(showTip := false) Menu Tray, Icon, % A_IsCompiled ? A_ScriptFullPath : A_ScriptDir "\assets\bw-at.ico" isLocked := false if showTip - TrayTip % appTitle, Vault unlocked, 10, 0x20 + tip("Vault unlocked") return passwd } else @@ -47,7 +47,7 @@ toggleLock(showTip := false) Menu Tray, Disable, 1& Menu Tray, Rename , 2&, Un&Lock if showTip - TrayTip % appTitle, Vault locked, 10, 0x20 + tip("Vault locked") Menu Tray, Icon, shell32.dll, 48 isLocked := true } diff --git a/Lib/toggleLogin.ahk b/Lib/toggleLogin.ahk index 6352240..38805af 100644 --- a/Lib/toggleLogin.ahk +++ b/Lib/toggleLogin.ahk @@ -5,7 +5,7 @@ toggleLogin(showTip := true) if isLogged { isLogged := false - TrayTip % appTitle, Logged out, 10, 0x20 + tip("Logged out") ; Update Menu Menu Tray, Disable, 1& Menu Tray, Disable, 2& @@ -55,7 +55,7 @@ toggleLogin(showTip := true) Menu Tray, Rename, 3&, Log&out Menu Tray, Icon, % A_IsCompiled ? A_ScriptFullPath : A_ScriptDir "\assets\bw-at.ico" if showTip - TrayTip % appTitle, Logged In, 10, 0x20 + tip("Logged In") return passwd } } From a85099b114e06f382ab75f9a0187fb6ebd9e2bfd Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:14:46 -0500 Subject: [PATCH 04/10] Reduce memory footprint --- Lib/tip.ahk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/tip.ahk b/Lib/tip.ahk index e28c989..c2842b5 100644 --- a/Lib/tip.ahk +++ b/Lib/tip.ahk @@ -2,4 +2,6 @@ tip(txt) { TrayTip % appTitle, % txt, 10, 0x20 + fn := Func("DllCall").Bind("K32EmptyWorkingSet", "Int",-1) + SetTimer % fn, -1000 } From a558afc0fbe5d285884bc5e5345fa5a027f7887e Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:16:18 -0500 Subject: [PATCH 05/10] Don't ask to update installer for debug version --- setup.ahk | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/setup.ahk b/setup.ahk index 81e403e..98ddddf 100644 --- a/setup.ahk +++ b/setup.ahk @@ -5,13 +5,11 @@ DetectHiddenWindows On ; Arguments verbose := !quiet := DEBUG := false -for i,arg in A_Args -{ - if arg ~= "i)[-|\/]quiet" - verbose := !quiet := true - else if arg ~= "i)[-|\/]debug" - DEBUG := true -} +if A_Args[1] ~= "i)[-|\/]quiet" + verbose := !quiet := true +FileGetVersion version, % A_ScriptFullPath +if StrSplit(version, ".")[1] > 2020 + DEBUG := true ; Check if latest version if !DEBUG && !update_isLatest() From c7a0724a33f1ec1e161d03cb8bdef49c645749bf Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Mon, 24 May 2021 18:32:22 -0500 Subject: [PATCH 06/10] Encoding change When encoded as UTF-16 git detects the file as binary rather than plain-text, changing it to UTF-8 (without BOM) to avoid it. --- assets/bw-at.ini | Bin 8152 -> 3910 bytes 1 file changed, 0 insert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VM%)y}hB^ z!6ixR=khxh(%sQb%$ItZMj*uJzmVx7dfcBqRva{R``c8!Hscf4HT`eKX9!K{T9;rJ zz53dD{@3ZPslIbF!!0?T)S4oMU#t54LZeSLLcjk|<1PK#)EK$e)*UJQ>h$K3Vb+?Q z9>2fD3xDt?>&_&zbxuAy{+yeeudNbE>}K4$2V}N>gMIe=ciK!s3hH;hhi7g*bvWE3 zF_)-O?}>2o)%X0M_=gh`?`g+rM21P(x8;#F#ZO!Q@~2LmV7aYd)J}BHpEmyk2*ck+ From 10c0619633ddedddf7a5c47e03d3fba8861ea111 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Thu, 27 May 2021 16:59:03 -0500 Subject: [PATCH 07/10] Close app if no password provided --- Lib/init.ahk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/init.ahk b/Lib/init.ahk index 75e412b..a4f64be 100644 --- a/Lib/init.ahk +++ b/Lib/init.ahk @@ -18,7 +18,7 @@ init() SetTimer bwStatus, -1 ; Async } - if isLocked + if !isLogged || isLocked ExitApp 1 ; Decrypt data From f96641fb870c5915c7836aeda451732eeedeb432 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Thu, 27 May 2021 17:39:10 -0500 Subject: [PATCH 08/10] Numeric version check --- Lib/update.ahk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/update.ahk b/Lib/update.ahk index 7cdbeb3..577cc85 100644 --- a/Lib/update.ahk +++ b/Lib/update.ahk @@ -17,14 +17,16 @@ update_isLatest() if A_IsCompiled FileGetVersion current, % A_ScriptFullPath else - FileRead current, version + FileRead current, % A_ScriptDir "\version" try { whr := ComObjCreate("WinHttp.WinHttpRequest.5.1") whr.Open("GET" , "https://raw.githubusercontent.com/anonymous1184/bitwarden-autotype/master/version" , false), whr.Send() - return (current = RTrim(whr.ResponseText, "``r`n")) + online := RTrim(whr.ResponseText, "`r`n") + return checkVersion(current, online) + } return true ; Error while checking } From 40459c45722d226b97ec67a869bff623ef73ebab Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Thu, 27 May 2021 17:40:09 -0500 Subject: [PATCH 09/10] Remove system button --- setup.ahk | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/setup.ahk b/setup.ahk index 98ddddf..f659129 100644 --- a/setup.ahk +++ b/setup.ahk @@ -94,15 +94,12 @@ if verbose } ; Progress -Gui New, +AlwaysOnTop +HwndHwnd +ToolWindow +Gui New, +AlwaysOnTop +HwndHwnd -SysMenu Gui Font, s11 q5, Consolas Gui Add, Text,, Getting version... Gui Show,, > Download Hotkey IfWinActive, % "ahk_id" hWnd Hotkey !F4, WinExist -hMenu := DllCall("User32\GetSystemMenu", "UInt",hWnd, "UInt",0) -for i,uPosition in { SC_MINIMIZE: 0xF020, SC_CLOSE: 0xF060 } - DllCall("User32\DeleteMenu", "UInt",hMenu, "UInt",uPosition, "UInt",0) ; Latest while !latest From 488272782dabeb5617def2ee4672c8fb6486d525 Mon Sep 17 00:00:00 2001 From: anonymous1184 <53758552+anonymous1184@users.noreply.github.com> Date: Thu, 27 May 2021 17:43:21 -0500 Subject: [PATCH 10/10] Version 1.0.1 See CHANGELOG.txt --- CHANGELOG.txt | 8 ++++++++ bw-at.ahk | 4 ++-- setup.ahk | 4 ++-- uninstall.ahk | 4 ++-- version | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5c98251..3b997e4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -8,6 +8,14 @@ YYYY/MM/DD - MAJOR.MINOR.RELEASE [!] = Fix / Security +2021/05/27 - 1.0.1 +—————————————————— +[!] Sync icon when logged out +[+] Reduced memory footprint +[*] Minor code refactoring +[*] Better settings change detection + + 2021/05/21 - 1.0.0 —————————————————— [!] Less fatal errors diff --git a/bw-at.ahk b/bw-at.ahk index 5f887af..bc4fe9c 100644 --- a/bw-at.ahk +++ b/bw-at.ahk @@ -141,5 +141,5 @@ return ; End of auto-execute ;@Ahk2Exe-SetMainIcon %A_ScriptDir%\assets\bw-at.ico ;@Ahk2Exe-SetName Bitwarden Auto-Type ;@Ahk2Exe-SetOrigFilename bw-at.ahk -;@Ahk2Exe-SetVersion 1.0.0.1 -;@Ahk2Exe-SetProductVersion 1.0.0.1 +;@Ahk2Exe-SetVersion 1.0.1.1 +;@Ahk2Exe-SetProductVersion 1.0.1.1 diff --git a/setup.ahk b/setup.ahk index f659129..d5a7f0a 100644 --- a/setup.ahk +++ b/setup.ahk @@ -166,6 +166,6 @@ return ;@Ahk2Exe-SetMainIcon %A_ScriptDir%\assets\bw-at.ico ;@Ahk2Exe-SetName Bitwarden Auto-Type ;@Ahk2Exe-SetOrigFilename setup.ahk -;@Ahk2Exe-SetVersion 1.0.0.1 -;@Ahk2Exe-SetProductVersion 1.0.0.1 +;@Ahk2Exe-SetVersion 1.0.1.1 +;@Ahk2Exe-SetProductVersion 1.0.1.1 ;@Ahk2Exe-UpdateManifest 1 diff --git a/uninstall.ahk b/uninstall.ahk index 9453319..a8a0e5b 100644 --- a/uninstall.ahk +++ b/uninstall.ahk @@ -85,6 +85,6 @@ Run % ComSpec " /C " quote("timeout /t 1 & del " quote(A_ScriptFullPath)),, Hide ;@Ahk2Exe-SetMainIcon %A_ScriptDir%\assets\uninstall.ico ;@Ahk2Exe-SetName Bitwarden Auto-Type ;@Ahk2Exe-SetOrigFilename uninstall.ahk -;@Ahk2Exe-SetVersion 1.0.0.1 -;@Ahk2Exe-SetProductVersion 1.0.0.1 +;@Ahk2Exe-SetVersion 1.0.1.1 +;@Ahk2Exe-SetProductVersion 1.0.1.1 ;@Ahk2Exe-UpdateManifest 1 diff --git a/version b/version index 217625a..86516d0 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.0.1 \ No newline at end of file +1.0.1.1 \ No newline at end of file