-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/improve autocomplete js #18552
Open
Q-back
wants to merge
14
commits into
develop
Choose a base branch
from
feature/improve-autocomplete_js
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
50cb5a5
brought back FormInputSubmitStrategy, better alghoritm of discovering…
Q-back 13a5d0d
fix _handle_authentication_success breaking parent's functionality in…
Q-back e04104f
revert enabling FormInputSubmitStrategy from pre-previous commit
Q-back 389646d
new options in autocomplete_js to manually provide username/submit bu…
Q-back 52b8f39
don't create new chrome instance when running autocomplete_js.has_act…
Q-back 2192ca5
fix after rebase
Q-back 1723b6b
reloading chrome when checking active session may break the session
Q-back b81b71d
implemented _login_using_existing_form
Q-back d4b6531
fix iterate error in frame manager, don't kill chrome in autocomplete…
Q-back 25a1125
better description for new params in autocomplete_js
Q-back 888eea6
sometimes login button doesn't contain 'log' characters in it's text,…
Q-back 27ede04
add option to click on element before autocompleting form
Q-back 5854763
fix error when user provides CSS selectors with quotes. Slightly bett…
Q-back 8d520bc
fix error when empty list was returned by querySelectorAll to Instrum…
Q-back File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
w3af/core/controllers/chrome/login/find_form/strategies/base_find_form_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from w3af.core.controllers.chrome.instrumented.exceptions import EventTimeout | ||
|
||
|
||
class BaseFindFormStrategy: | ||
def __init__(self, chrome, debugging_id, exact_css_selectors=None): | ||
""" | ||
:param InstrumentedChrome chrome: | ||
:param String debugging_id: | ||
:param dict exact_css_selectors: Optional parameter containing css selectors | ||
for part of form like username input or login button. | ||
""" | ||
self.chrome = chrome | ||
self.debugging_id = debugging_id | ||
self.exact_css_selectors = exact_css_selectors or {} | ||
|
||
def prepare(self): | ||
""" | ||
:raises EventTimeout: | ||
Hook called before find_forms() | ||
""" | ||
form_activator_selector = self.exact_css_selectors.get('form_activator') | ||
if form_activator_selector: | ||
func = 'window._DOMAnalyzer.clickOnSelector("{}")'.format( | ||
form_activator_selector.replace('"', '\\"') | ||
) | ||
result = self.chrome.js_runtime_evaluate(func) | ||
if result is None: | ||
raise EventTimeout('The event execution timed out') | ||
|
||
def find_forms(self): | ||
raise NotImplementedError | ||
|
||
@staticmethod | ||
def get_name(): | ||
return 'BaseFindFormStrategy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new! Are you sure it is handled in all calls to this method? In the past we were returning
None
and now we raise an exception. Make sure to search all calls for this method and modify error handling appropiately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I have added few more fixes in this PR.
This works for sure. It's additional (new) exception which is raised when underlying script throws internal JS exception. We still return
None
in other cases here https://github.com/andresriancho/w3af/pull/18552/files/8d520bc067455089a9fccac9c395f9114f521e8a#diff-4a954d4e5c6123fad237c66f5399b9dfR617