Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Styled output in table, added check for admin and ajax actions
- Loading branch information
Showing
5 changed files
with
86 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import re | ||
from terminaltables import AsciiTable, DoubleTable, SingleTable | ||
from colorama import Fore, Back, Style | ||
import copy | ||
|
||
|
||
ADMIN_ACTIONS_DATA = [ | ||
['Action Name', 'Function', 'File'], | ||
] | ||
|
||
AJAX_HOOKS_DATA = [ | ||
['Action Name', 'Function', 'File'], | ||
] | ||
|
||
|
||
def passive_check(content, path): | ||
scope_admin_actions(content, path) | ||
scope_ajax_hooks(content, path) | ||
|
||
|
||
def scope_functions(content): | ||
pattern = r"function(\s+?)([a-zA-Z_0-9-]+?)(\s?)+\((.+?)\)(\s{0,}\S{0,}){" | ||
matches = re.findall(pattern=pattern, string=content) | ||
for match in matches: | ||
print(match[1]) | ||
|
||
|
||
def scope_ajax_hooks(content, file): | ||
pattern = r"(add_action(\s{0,}\S{0,})\((\s{0,}\S{0,})(\"|')(wp_ajax_[a-zA-Z0-9_-]+))(?!{)(\"|')(\s{0,}\S{0,}),(.+)(\"|')(\s{0,})([a-zA-Z0-9_-]+)(\s{0,})(\"|')" | ||
matches = re.findall(pattern=pattern, string=content) | ||
for match in matches: | ||
AJAX_HOOKS_DATA.append([match[4], match[10], file]) | ||
|
||
|
||
def scope_admin_actions(content, file): | ||
pattern = r"(add_action(\s{0,}\S{0,})\((\s{0,}\S{0,})(\"|')(admin_action_[a-zA-Z0-9_-]+))(?!{)(\"|')(\s{0,}\S{0,}),(.+)(\"|')(\s{0,})([a-zA-Z0-9_-]+)(\s{0,})(\"|')" | ||
matches = re.findall(pattern=pattern, string=content) | ||
for match in matches: | ||
ADMIN_ACTIONS_DATA.append([match[4], match[10], file]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
colorama==0.4.1 | ||
tabulate==0.8.3 | ||
terminaltables==3.1.0 |
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