List of all scripts?

I recently had a rather silly problem. I wanted to copy a Python script that was part of a layout I hadn’t worked on in a while… and I couldn’t find it. I knew which layout it was in, but I could not recall which component it was a Behaviour of!
Fortunately, this layout wasn’t very complex, so I was able to find the script simply by looking at the Behavior list of each component (and opening each Python script to check its contents – note to self, name scripts properly in future!).

But this leads me to wonder: is there any way to open a layout and generate a list of scripts in an entire layout? Preferably with a way to filter out the “default” scripts. Bonus points if there were a way to, say, search the text of each script for certain keywords.

For UI there is this add-on.

From both Python and .NET API you can loop throgh components in the world, find all script behaviors from each component and then access the script text as string.