https://alpacahack.com/daily/challenges/private-method

ă‚łăƒŒăƒ‰

import re

class Main:
    # public
    def alpaca():
        return "🩙"

    # private
    def __flag():
        return "Alpaca{REDACTED}"

while True:
    code = input(">>> Main.").strip()

    if re.fullmatch(r"\w+\(\)", code):
      print(eval(f"Main.{code}"))
    else:
      print("Nope")

đŸ€”

mappingproxy({
    "__module__": "__main__",
    "__firstlineno__": 1,
    "alpaca": <function Main.alpaca at 0x000001A184A91300>,
    "_Main__flag": <function Main.__flag at 0x000001A184A90540>,
    "__static_attributes__": (),
    "__dict__": <attribute '__dict__' of 'Main' objects>,
    "__weakref__": <attribute '__weakref__' of 'Main' objects>,
    "__doc__": None,
    "__annotations__": {}
})

Python mangles these names with the class name: if class Foo has an attribute named __a, it cannot be accessed by Foo.__a. (An insistent user could still gain access by calling Foo._Foo__a.)

https://peps.python.org/pep-0008/

solve

Main._Main__flag()