tag:support.arachni-scanner.com,2012-07-01:/discussions/questions/13416-login_script-check-pattern-failingArachni: Discussion 2017-08-30T19:56:22Ztag:support.arachni-scanner.com,2012-07-01:Comment/432814082017-08-24T14:16:37Z2017-08-26T16:45:43ZLogin_Script check pattern failing<div><p>Hi,</p>
<p>I'm interested if anyone could help me a bit with my logging issue. I just started to use Arachni, I've found several discussions with similar errors but I couldn't manage to solve this. Here is the command for running arachni scan:</p>
<pre>
<code>arachni https://appURL/login?TargetUrl=/ --plugin=login_script:browser=chrome,script=.\..\..\test\login2.js --http-response-max-size=1500000 --browser-cluster-job-timeout=50 --session-check-url=https://appURL/#/userMgmt --session-check-pattern="Home" --scope-exclude-pattern="logout|Logout"</code>
</pre>
<p>Here is my login2.js content:</p>
<pre>
<code>document.getElementById( "username" ).value = "admin";
document.getElementById( "password" ).value = "mypassword";
document.getElementById( "loginButton" ).click();</code>
</pre>
<p>I get the following error:</p>
<pre>
<code>Login script: [components/plugins/login_script#set_status:99] The script was executed successfully, but the login check failed.</code>
</pre>
<p>If I change the --session-check-pattern=/.*/ the log says that the login was successful but I don't think that it's properly logging in as per se: <a href="http://support.arachni-scanner.com/discussions/questions/12891-login_script-check_pattern-failing">http://support.arachni-scanner.com/discussions/questions/12891-logi...</a></p>
<p>I have Windows 10 and working with arachni 1.5.1-0.5.12 windows version.<br>
I attached the debug 3 level log.<br>
Any idea?</p>
<p>Thanks in advance!<br>
Szilvia</p></div>Szilvia Molnartag:support.arachni-scanner.com,2012-07-01:Comment/432814082017-08-26T16:48:26Z2017-08-26T16:48:26ZLogin_Script check pattern failing<div><p>Are you sure your script is actually working? The JS will run in the browser like usual and this means that it'll work asynchronously and have all the drawbacks of that environment.</p>
<p>If you're not sure about what's going on you should switch to a Ruby script, that'll allow for greater control and for easier debugging.</p></div>Tasos Laskostag:support.arachni-scanner.com,2012-07-01:Comment/432814082017-08-29T15:08:48Z2017-08-30T19:53:19ZLogin_Script check pattern failing<div><p>Hi Tasos,</p>
<p>Thank you for the quick reply!<br>
I tried it with Ruby script, but in this case I get the attached error message. I don't know which element it can't find...<br>
Here is my rb scipt:</p>
<pre>
<code>browser.goto '<URL>/login?TargetUrl=/'
browser.text_field( :id => 'username' ).set('admin')
browser.text_field( :id => 'password' ).set('password')
browser.input( :id => 'loginButton' ).click
sleep(3)
framework.options.session.check_url = '<URL>/#/userMgmt'
framework.options.session.check_pattern = 'Home'</code>
</pre>
<p>I checked in chrome dev mode that all of the UI elements (username, password, loginButton) are present in the login page.</p>
<p>Thanks,<br>
Szilvi</p></div>Szilvia Molnártag:support.arachni-scanner.com,2012-07-01:Comment/432814082017-08-29T15:14:24Z2017-08-29T15:14:24ZLogin_Script check pattern failing<div><p>Ohh, BTW the browser.goto and the session.check_url is set properly in the script (browser.goto 'URL/login?TargetUrl=/') it just looks like that during the submission process of my answer somehow it disappeared from my answer...</p></div>Szilvia Molnártag:support.arachni-scanner.com,2012-07-01:Comment/432814082017-08-30T19:56:22Z2017-08-30T19:56:22ZLogin_Script check pattern failing<div><p>The error message says it all, is the element actually interactable and visible or do you need to trigger some other DOM event to bring it out?</p>
<p>Also, your <code>check_url</code> may not work, it won't be loaded in a browser, it'll be requested over HTTP, so the URL fragment won't matter.</p></div>Tasos Laskos