Skip to content

Port to Python3 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions docker_image_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def list_repos():

def find_tags(reponame):
req = requests.get(url+ "/" + apiversion + "/" + reponame+"/tags/list", verify=False)
print "\n"
print("\n")
data = json.loads(req.content)
if "tags" in data:
return data["tags"]
Expand All @@ -51,35 +51,35 @@ def download_blobs(reponame, blobdigest,dirname):
def main():
if url is not "spam":
list_of_repos = list_repos()
print "\n[+] List of Repositories:\n"
print("\n[+] List of Repositories:\n")
for x in list_of_repos:
print x
target_repo = raw_input("\nWhich repo would you like to download?: ")
print(x)
target_repo = input("\nWhich repo would you like to download?: ")
if target_repo in list_of_repos:
tags = find_tags(target_repo)
if tags is not None:
print "\n[+] Available Tags:\n"
print("\n[+] Available Tags:\n")
for x in tags:
print x
print(x)

target_tag = raw_input("\nWhich tag would you like to download?: ")
target_tag = input("\nWhich tag would you like to download?: ")
if target_tag in tags:
list_blobs(target_repo,target_tag)

dirname = raw_input("\nGive a directory name: ")
dirname = input("\nGive a directory name: ")
os.makedirs(dirname)
print "Now sit back and relax. I will download all the blobs for you in %s directory. \nOpen the directory, unzip all the files and explore like a Boss. " % dirname
print("Now sit back and relax. I will download all the blobs for you in %s directory. \nOpen the directory, unzip all the files and explore like a Boss. " % dirname)
for x in final_list_of_blobs:
print "\n[+] Downloading Blob: %s" % x
print("\n[+] Downloading Blob: %s" % x)
download_blobs(target_repo,x,dirname)
else:
print "No such Tag Available. Qutting...."
print("No such Tag Available. Qutting....")
else:
print "[+] No Tags Available. Quitting...."
print("[+] No Tags Available. Quitting....")
else:
print "No such repo found. Quitting...."
print("No such repo found. Quitting....")
else:
print "\n[-] Please use -u option to define API Endpoint, e.g. https://IP:Port\n"
print("\n[-] Please use -u option to define API Endpoint, e.g. https://IP:Port\n")


if __name__ == "__main__":
Expand Down