Jump to content
pyth0n3

getfox.py

Recommended Posts

Posted (edited)

Nu face nimic special , descarca ?i instaleaz? ultima versiune de firefox în Linux

Nu are nici un fel de op?iune , va descarca ultima versiune 3.6.x în limba engleza

Uneori are o mica problema de conexiune cu serverul ftp de la Mozilla dar merge

l-am scris deoarece în debian ar trebui sa fac update de fiecare data manual cînd apare o noua versiune de firefox

Daca nu fac update îmi apar o gr?mad? de pop-up care îmi spun ca exista o noua versiune

#!/usr/bin/python
#Date:6.11.2010
#Purpose: Download and install latest US firefox in Linux
#Author: pyth0n3
#Blog: http://pyth0n3.blogspot.com/

import os
import ftplib
import glob
import tarfile
import shutil
import time
import sys



print "[+]This script will download && install the latest 3.6.x firefox US
version for Linux"

var = raw_input ("Do you want to continue?Type |yes/no| : ")
if var.lower() == "no":
sys.exit()
elif var.lower() == 'yes' :
###making a temp directory in local
print "[+]Creating a temporary directory for work.. "
time.sleep(2)
if not os.path.exists("/tmp/firefox"):
os.mkdir("/tmp/firefox")

os.chdir("/tmp/firefox/")

print "[+]Connecting..."
ftp = ftplib.FTP("releases.mozilla.org")
ftp.login("anonymous", "anonymous")

directory = '/pub/mozilla.org/firefox/releases/latest-3.6/linux-i686/en-US/'

match = '*.bz2'

ftp.cwd(directory)

print "[+]Searching the latest version..."

for f1 in ftp.nlst(match):
var = open(f1, 'wb')
print '[+]Downloading ' + f1 ,'Please wait...'
ftp.retrbinary('RETR ' + f1, var.write)
var.close()

print "[+]Extracting files... "
def extract_file(path, dst='/usr/lib/'):
if path.endswith('.tar.bz2'):
opener, mode = tarfile.open, 'r:bz2'

cwd = os.getcwd()
os.chdir(dst)

try:
file = opener(path, mode)
try: file.extractall()
finally: file.close()
finally:
os.chdir(cwd)


var1 = glob.glob('/tmp/firefox/*.bz2')
var2 = ','.join(var1)

extract_file (var2)
print "[+]Setting up the browser..."
time.sleep(3)
os.symlink("/usr/lib/firefox/firefox", "/usr/bin/firefox")
print "[+]Removing temporary files..."
shutil.rmtree("/tmp/firefox")
print '[+]Done'
sys.exit()


#END#

wget http://sprunge.us/EZGX   -O getfox.py

Edited by pyth0n3
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...