Palo Alto Search Filtering in Contains

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Palo Alto Search Filtering in Contains

L1 Bithead

Hello,

 

I write a basic python code for 'contains' filtering in in rule name search. And I want to share with community also community can give an advice for me.

 

The code: 

"""""""""""""""""""""""

def generate_output(numbers) :
    output_strings = []

    for number in numbers:
        output_strings.append("(name contains 'Rule " + str(number) + "') or ")

    # Remove the trailing "or" from the last string
    output_strings[-1] = output_strings[-1][:-4]

    return output_strings

# Get input from the user
user_input = input("Enter a list of numbers without spaces, separated by commas: ")
input_numbers = [int(num) for num in user_input.split(',')]

# Generate output strings
output_strings = generate_output(input_numbers)

# Combine strings with "or" and display side by side
combined_output = " ".join(output_strings)
print(combined_output)

#298,1024,216,133,906,1413,1345,135,551
"""""""""""""""""""""""
 
Output: tombombadil_0-1706780527481.png
1 REPLY 1

Community Team Member

Hi @tombombadil ,

 

Thanks for your contribution !

I'm sure users can use this and other script gurus can add to it !

 

Kind regards,

-Kim.

LIVEcommunity team member, CISSP
Cheers,
Kiwi
Please help out other users and “Accept as Solution” if a post helps solve your problem !

Read more about how and why to accept solutions.
  • 1070 Views
  • 1 replies
  • 1 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!