Skip to content
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

add ! for negative search as requested #80

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions arsenal/modules/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,28 @@ def match(self, cheat):
:param cheat: cheat to check
:return: boolean
"""
match = True

# if search begin with '>' print only internal CMD
if self.input_buffer != '' and self.input_buffer[0] == '>':
match = cheat.command[0] == '>'
if(self.input_buffer.startswith('>')
and not cheat.command.startswith('>')):
return False

for value in self.input_buffer.lower().split(' '):
if value in cheat.str_title.lower() \
or value in cheat.name.lower() \
or value in cheat.tags.lower() \
or value in "".join(cheat.command_tags.values()).lower() \
or value in cheat.command.lower():
match = True and match
else:
match = False
return match
is_value_excluded = False
if value.startswith("!") and len(value) > 1:
value = value[1:]
is_value_excluded = True

if (value in cheat.str_title.lower()
or value in cheat.name.lower()
or value in cheat.tags.lower()
or value in "".join(cheat.command_tags.values()).lower()
or value in cheat.command.lower()):
if is_value_excluded:
return False

elif not is_value_excluded:
return False
return True

def search(self):
"""
Expand Down
Loading