Run zypper lr -d to get your repolist.
Run a search for installed packages for each repo via zypper se -ir <repo_name_or_number>
Compare the received lists with your initial created 6k package list. Can be done with any text editor or calc app (Libreoffice)…
But 6k packages sound like a messy system…
Yep. And that is the base list where the TO needs to “subtract” the other lists from the active repos. The rest are packages from unknown sources where only the TO knows where he got them from…
Another way would be to use the --orphaned search function…
I thought that this is about packages installed beyond what is installed at system installation. Never thought that he would mean “from non standard repos”, because that is an easy one as you point out.
But that could be impossible to achive when it is a grown system from Leap 15.2 → 15.5 as zypper history is not kept that long. There is the autorotation and cleanup algorithm to prevent overflow of logs…