-
Notifications
You must be signed in to change notification settings - Fork 788
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
New action: Bold/Highlight #30
Comments
that's a cool idea, do you wanna have a crack at implementing it? |
I've given it a shot - but was unable todo it. |
@g0tmi1k, you mean like this? --- patator.py.orig 2016-01-23 22:52:36.947595860 +0100
+++ patator.py 2016-01-23 22:52:26.291596061 +0100
@@ -1209,6 +1209,7 @@
('retry', 'try payload again'),
('free', 'dismiss future similar payloads'),
('quit', 'terminate execution now'),
+ ('color', 'highlight specific part'),
)
available_encodings = {
@@ -1503,6 +1504,9 @@
def lookup_actions(self, resp):
actions = {}
for action, conditions in self.ns.actions.items():
+ if action == 'color':
+ actions[action] = conditions[0][0][0][0]
+ continue
for condition, opts in conditions:
for key, val in condition:
if key[-1] == '!':
@@ -1846,6 +1850,11 @@
actions = {'fail': None}
actions.update(self.lookup_actions(resp))
+
+ if 'color' in actions:
+ match = actions['color']
+ resp.mesg = resp.mesg.replace(match, '\033[31;1m{}\033[00m'.format(match))
+
report_queue.put((actions, pp_prod, resp, time() - start_time))
for name in self.module_actions: |
@hvqzao That works for me! What I panned was to highlight the whole row, rather than the selected phrase (which is what triggers the selection). /me tips hat. |
@lanjelot would above diff work for you as well? I looked at it again and did few more changes toward applying color in Response_Base class (code below). Will you apply the patch (one that fits best) or should I issue a pull request? --- patator.py.orig 2016-01-23 22:52:36.947595860 +0100
+++ patator.py 2016-01-24 10:13:10.559908667 +0100
@@ -1209,6 +1209,7 @@
('retry', 'try payload again'),
('free', 'dismiss future similar payloads'),
('quit', 'terminate execution now'),
+ ('color', 'highlight specific part'),
)
available_encodings = {
@@ -1503,6 +1504,11 @@
def lookup_actions(self, resp):
actions = {}
for action, conditions in self.ns.actions.items():
+ if action == 'color':
+ while not isinstance(conditions, str):
+ conditions = conditions[0]
+ resp.color = conditions
+ continue
for condition, opts in conditions:
for key, val in condition:
if key[-1] == '!':
@@ -2056,11 +2062,14 @@
self.time = timing.time if isinstance(timing, Timing) else timing
self.size = len(mesg)
self.trace = trace
+ self.color = None
def indicators(self):
return self.code, self.size, '%.3f' % self.time
def __str__(self):
+ if self.color:
+ return self.mesg.replace(self.color, '\033[31;1m{}\033[00m'.format(self.color))
return self.mesg
def match(self, key, val): |
I know its going off topic, but I just found out about coloredlogs (https://pypi.python.org/pypi/coloredlogs). |
Thanks for your inputs guys. You've had me thinking of adding a --color option where patator would have every result of the same code & size in the same color (% fuzzy hash or something). |
Liking the sound of it! Makes analysing the data that little bit easier =) |
Currently there are the following actions in Patator:
ignore
,retry
,free
&quit
.Could there be a new one called 'bold'?
This could be then used to highlight results, making it easier to locate certain responses.
The result could be in bold/or a different text colour.
The text was updated successfully, but these errors were encountered: