File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99 to find and add subdomains to the Sites Tree.
1010- passive/JavaDisclosure.js - Passive scan for Java error messages leaks
1111- httpsender/RsaEncryptPayloadForZap.py - A script that encrypts requests using RSA
12+ - selenium/FillOTPInMFA.js - A script that fills the OTP in MFA
1213
1314## [ 18] - 2024-01-29
1415### Added
Original file line number Diff line number Diff line change 1+ /*
2+ This script will fill the OTP if MFA is configured on web-app. Browser-based auth is the pre-requisite for this script.
3+ You need to analyze DOM of the web app this script needs to run on and modify the parameters accordingly.
4+ This script assumes that the web app has fixed OTP for testing which can be stored in the variable below.
5+ */
6+
7+ function browserLaunched ( utils ) {
8+ var By = Java . type ( "org.openqa.selenium.By" ) ;
9+ var Thread = Java . type ( "java.lang.Thread" ) ;
10+ var url = utils . waitForURL ( 5000 ) ;
11+ var wd = utils . getWebDriver ( ) ;
12+ var OTP = "123456" ;
13+
14+ wd . get ( url + "#/login" ) ;
15+ Thread . sleep ( 30000 ) ; //Wait for ZAP to handle the auth.
16+ wd . findElement ( By . id ( "one-time-code" ) ) . sendKeys ( OTP ) ; //Replace the input field as per your web-app's DOM
17+ Thread . sleep ( 1000 ) ;
18+ wd . executeScript ( "document.querySelector('[aria-label=\"Verify Code\"]').click()" ) ; //Replace the submit label as per your web-app's DOM
19+ }
You can’t perform that action at this time.
0 commit comments