[Python] No module named 'fickling.pickle'; 'fickling' is not a package

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to test code in https://huggingface.co/docs/hub/security-pickle this page.

    code :

    from fickling.pickle import Pickled
    import pickle

    # Create a malicious pickle
    data = "my friend needs to know this"

    pickle_bin = pickle.dumps(data)

    p = Pickled.load(pickle_bin)

    p.insert_python_exec('print("you\'ve been pwned !")')

    with open('payload.pkl', 'wb') as f:
    p.dump(f)

    # innocently unpickle and get your friend's data
    with open('payload.pkl', 'rb') as f:
    data = pickle.load(f)
    print(data)


    I installed fickling python -m pip install fickling ans pickle also, but error ModuleNotFoundError: No module named 'fickling.pickle'; 'fickling' is not a package is constantly occur... don't know why. can any one help?

    Continue reading...

Compartilhe esta Página