espes / Slave-in-the-Magic-Mirror

Open source implementation of AirPlay Mirroring. WIP.
610 stars 122 forks source link

Error while trying to run get_airtunesd.py + VLC not starting... #20

Open maxiedaniels opened 8 years ago

maxiedaniels commented 8 years ago

I'm trying to run get_airtunesd.py, but I'm getting this error. Regardless, I downloaded the ispw manually and put it in the Slave-in-the-Magic-Mirror folder. I've run airplay.py, and I can see the server show up on my iPhone's airplay menu, but nothing happens when I press it. VLC doesn't pop up. But I'm not getting any error about not having the firmware, so I don't know what to do.

The get_airtunesd.py output is below.

`Looking up key... /home/username/Downloads/pypy2-v5.3.1-linux64/site-packages/requests/packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning) /home/username/Downloads/pypy2-v5.3.1-linux64/site-packages/requests/packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning) /home/username/Downloads/pypy2-v5.3.1-linux64/site-packages/bs4/init.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

BeautifulSoup([your markup])

to this:

BeautifulSoup([your markup], "html.parser")

markup_type=markup_type)) Traceback (most recent call last): File "Slave-in-the-Magic-Mirror/get_airtunesd.py", line 362, in main() File "Slave-in-the-Magic-Mirror/get_airtunesd.py", line 318, in main key_row = key_soup.find("td", text="RootFileSystem").parent AttributeError: 'NoneType' object has no attribute 'parent' `

ncorrare commented 7 years ago

It's because the page now has authentication. Try replacing the key_text variable for the RootFileSystem key you find on the page in the source (just below the main function)

maxiedaniels commented 7 years ago

Thank you - I ended up manually downloading the ipsw and pointing to it in the get_airtunes.py file, and then I inserted the root key, and get_airtunes.py successfully runs now. But airplay.py still isn't opening VLC.. I can select Slave in the Magic Mirror on my Airplay options on my iPhone... but VLC doesn't ever pop up. Any ideas?

parkerlreed commented 7 years ago

Running into a similar issue. Replaced the needed bits

    print "Looking up key..."
    key_resp = requests.get('https://ipsw.me/keys/AppleTV2,1/9A334v',
            headers={'User-Agent': 'get_airtunesd.py'},
            verify=False)
    key_html = key_resp.content
    key_soup = BeautifulSoup(key_html)
    key_row = key_soup.find("td", text="RootFileSystem").parent
    key_cell = key_row.find("td", "key")
    key_text = "keyishere"
    root_key = key_text.decode("hex")
    print "Done!", key_text

    ipsw_filename = "AppleTV2,1_4.4_9A334v_Restore.ipsw"
    ipsw_url = "http://localhost:81/AppleTV2,1_4.4_9A334v_Restore.ipsw"

But when I try to run the script

[parker@e55 Slave-in-the-Magic-Mirror]$ python2 get_airtunesd.py 
Traceback (most recent call last):
  File "get_airtunesd.py", line 29, in <module>
    import hfs
  File "/home/parker/build/Slave-in-the-Magic-Mirror/hfs/__init__.py", line 1, in <module>
    from hfs import HFSVolume, HFSFile
  File "/home/parker/build/Slave-in-the-Magic-Mirror/hfs/hfs.py", line 16, in <module>
    from structs import *
  File "/home/parker/build/Slave-in-the-Magic-Mirror/hfs/structs.py", line 73, in <module>
    UBInt32("startBlock"),
NameError: name 'UBInt32' is not defined
parkerlreed commented 7 years ago

Oddly enough I got around it by pulling the hfs directory from here https://github.com/nabla-c0d3/iphone-dataprotection/tree/master/python_scripts/hfs

Pulling an OLDER construct (latest is not compatible) https://github.com/MostAwesomeDude/construct

Running the script once. It runs till the end and fails on the extraction. moving the original hfs directory back in lets it finish.

But new issue...

...
Done! /tmp/tmpj11lvj/018-7881-372.dmg

Extracting airtunesd...
Done!
[parker@e55 Slave-in-the-Magic-Mirror]$ python2 airplay.py 
Traceback (most recent call last):
  File "airplay.py", line 30, in <module>
    import aac
  File "/home/parker/build/Slave-in-the-Magic-Mirror/aac.py", line 39, in <module>
    If(this.ldSbrPresentFlag,
NameError: name 'this' is not defined
iTheCode commented 7 years ago

Fix this error: key_soup = BeautifulSoup(key_html) key_row = key_soup.find("td", text="RootFileSystem").parent key_cell = key_row.find("td", "key") key_text = key_cell.text

Change for this: key_soup = BeautifulSoup(key_html, "html.parser") key_row = key_soup.find("td", text="RootFileSystem").parent key_cell = key_row.find_all("small")[2].find("code") key_text = key_cell.text

HuangKaiHuan commented 5 years ago

Thank you - I ended up manually downloading the ipsw and pointing to it in the get_airtunes.py file, and then I inserted the root key, and get_airtunes.py successfully runs now. But airplay.py still isn't opening VLC.. I can select Slave in the Magic Mirror on my Airplay options on my iPhone... but VLC doesn't ever pop up. Any ideas?

HI. I also download the ipsw manually.But I don't know how to find the root key.Can you tell me how to get it? Thank!

blake-regalia commented 4 years ago
key_text = "e04125691fea59da7bedc605667f459c78d243d1b4df4c6127d154dc84b3657902538aee"
avantgardnerio commented 4 years ago
key_text = "e04125691fea59da7bedc605667f459c78d243d1b4df4c6127d154dc84b3657902538aee"
root_key = bytes.fromhex(key_text)