Saturday, March 26, 2011

Keeping Mac osx updated via Terminal

For the longest time ive been keeping snow leopard updated using the tradition way by clicking on software update and letting it run from the gui. well one day i decided to sit down and write a python script that takes care of this for me. Im not a python guru so if this code is not to your liking then dont use it. If you see something about my code that might need improving please let me know. well first thing your going to need is the pexpect module which can be downloaded from http://sourceforge.net/projects/pexpect/. After downloading the pexpect module open the terminal and run the following command: tar -xzvf pexpect-2.3.tar.gz. Step2: cd pexpect-2.3 (or whatever version you are using). Step3: run the following command: python setup.py install. Once these steps have been completed you are all set to run the following script.


#!/usr/bin/python
#################################################
#This script keeps my mac osx uptodate with the #
#latest patches and updates #
#written by bsdjedi #
#sept 30, 2010 #
#################################################

from subprocess import call, PIPE, Popen
import pexpect
import getpass

################################
#This function applies updates #
#to your Operating System #
#################################


def software_update():
p = getpass.getpass()
child = pexpect.spawn('sudo softwareupdate -d -i -r')
child.expect('Password:')
child.sendline(p)
child.expect('$')
child.interact()






software_update()

No comments:

Post a Comment

Cracking Kerberos Service Tickets (TGS) Using Kerberoasting

As of late I've been spending a lot of time researching and learning different techniques when it comes to attacking Active Directory En...