forked from theJaxon/unlocker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work on a dynamic darwin.iso fetcher
- Loading branch information
I049299
authored and
I049299
committed
Oct 10, 2015
1 parent
153f0a5
commit 258b81c
Showing
14 changed files
with
115 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import os | ||
import urllib | ||
import urllib2 | ||
from HTMLParser import HTMLParser | ||
import shutil | ||
import tarfile | ||
import zipfile | ||
|
||
|
||
# Parse the Fusion directory page | ||
class myHTMLParser(HTMLParser): | ||
|
||
def __init__(self): | ||
self.reset() | ||
self.HTMLDATA = [] | ||
|
||
def handle_data(self, data): | ||
if data.find("\n") == -1 : | ||
if data[0].isdigit(): | ||
self.HTMLDATA.append(data) | ||
|
||
def clean(self): | ||
self.HTMLDATA = [] | ||
|
||
|
||
def main(): | ||
url = 'http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/' | ||
dir = os.path.dirname(os.path.abspath(__file__)) | ||
response = urllib2.urlopen(url) | ||
html = response.read() | ||
parser = myHTMLParser() | ||
parser.feed(html) | ||
url = url + parser.HTMLDATA[-1] + '/' | ||
response = urllib2.urlopen(url) | ||
html = response.read() | ||
parser.clean() | ||
parser.feed(html) | ||
url = url + parser.HTMLDATA[-1] + '/packages/com.vmware.fusion.tools.darwin.zip.tar' | ||
urllib.urlretrieve(url, 'tools/com.vmware.fusion.tools.darwin.zip.tar') | ||
parser.clean() | ||
tar = tarfile.open('tools/com.vmware.fusion.tools.darwin.zip.tar', 'r') | ||
tar.extract('com.vmware.fusion.tools.darwin.zip', path='tools/') | ||
zip = zipfile.ZipFile('tools/com.vmware.fusion.tools.darwin.zip', 'r') | ||
zip.extract('payload/darwin.iso', path='tools/') | ||
zip.extract('payload/darwin.iso.sig', path='tools/') | ||
shutil.move(dir + '/tools/payload/darwin.iso', dir + '/tools/darwin.iso') | ||
shutil.move(dir + '/tools/payload/darwin.iso.sig', dir + '/tools/darwin.iso.sig') | ||
shutil.rmtree(dir + '/tools/payload', True) | ||
os.remove(dir + '/tools/com.vmware.fusion.tools.darwin.zip.tar') | ||
os.remove(dir + '/tools/com.vmware.fusion.tools.darwin.zip') | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters