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()

Sunday, March 20, 2011

Moving over from Macports to Brew

Good Afternoon everyone today is a wonderful but also a special day b/c today is my birthday. I cannot believe it either blogging on my birthday lol yes i know im pretty geeked out but thats ok
This is a tutorial on how to move over from Macports over to Brew in Mac OSX. For a long time i have been using Macports which in the beginning was the best thing since slice bread but as with everything time can kill or improve an applications performance (Just in my opinion). Well Enough rambling from me let get to it. Here is how i moved from Macports over to Brew.

First: Uninstall(get rid of) Macports by running the following commands:


1. sudo port -f uninstall installed

2. sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"

Step 2. Install the Brew OSx Package Installer by running the following command:

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"


Step 3. Once the installer has finished installing
NOTE: The key files for brew are installed in the /usr/local/bin/brew directory
The /usr/local/Cellar directory contains the files of your installed packages.



Step 4. Ok Now that brew is installed the following is an example on how to install an application using the brew command:


brew install mongodb

==> Downloading http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.6.3.tgz
######################################################################## 100.0%
==> Caveats
If this is your first install, automatically load on login with:
cp /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

If this is an upgrade and you already have the org.mongodb.mongod.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
cp /usr/local/Cellar/mongodb/1.6.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Or start it manually:
mongod run --config /usr/local/Cellar/mongodb/1.6.3-x86_64/mongod.conf
==> Summary
/usr/local/Cellar/mongodb/1.6.3-x86_64: 16 files, 83M, built in 2 seconds



Another cool command is the info command within brew check it out:

brew info postgresql

postgresql 9.0.1

http://www.postgresql.org/

Depends on: readline, ossp-uuid
/usr/local/Cellar/postgresql/9.0.1 (1229 files, 25M)

If builds of Postgresl 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:

http://github.com/mxcl/homebrew/issues/issue/2510

To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:

http://www.postgresql.org/docs/9.0/static/install-procedure.html

If this is your first install, create a database with:
initdb /usr/local/var/postgres

If this is your first install, automatically load on login with:
cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

If this is an upgrade and you already have the org.postgresql.postgres.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

Or start manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

And stop with:
pg_ctl -D /usr/local/var/postgres stop -s -m fast

If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.

http://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb

NOTE if you need anything additional information about how to use brew run the following command:

brew help

Well thats all from me going to head out and enjoy the rest of my birthday. :)

Wednesday, March 16, 2011

Compiling Openldap on Centos

Good morning , I took on the project of setting up openldap to talk to freeradius however there is one thing standing in the way. compiling openldap on the centos platform. which proved to be a very challenging process. Well here are the following steps that i took in order to get openldap to compile on centos NOTE:"This method is the method that worked for me so use this method at your own risk :)"

Step1. Make sure you download a copy of Berkeley DB version 4.8. The current version of Berkley DB that comes with centos is not compatable when trying to compile openldap.

Step2. After downloading and unpackging the DB version 4.8 run the following commands

cd build_unix

../dist/configure


Step3. Run make && make install


Step 4. Download and unpack a recent copy of openldap which is at the time of this writing is openldap-2.4.23

Step 5. change over to the openldap directory and run the following commands

LDFLAGS=-L/path/to/BerkeleyDB.4.8/lib CPPFLAGS=-I/path/to/BerkeleyDB.4.8/include ./configure

example: LDFLAGS=-L/usr/local/BerkeleyDB.4.8/lib CPPFLAGS=-I/usr/local/BerkeleyDB.4.8/include ./configure

Step6. Once the configure has completed run the folllowing command

make depend && make && make install


The compiled version of openldap should be installed in the /usr/local/etc/openldap directory


Step 7. enjoy your new version of openldap :)

Saturday, March 12, 2011

How to Convert a dmg over to an iso

This morning i downloaded the RedHat Enterprise linux 6 the 64 bit version, However when i downloaded it i noticed that i was in a .dmg file format which is a file type that runs only on MAC OSX (for those that dont know that is like .exe for windows). After playing around with the command line for like an hour i finally figured out how to convert a .dmg file over to iso from the command line in MAC OSX (snow leopard) but im sure this will work in other versions of MAC OSX. Anyway here are the steps that were taken in order to convert a .dmg over to an .iso file.

1. hdiutil convert /path-to-the-.dmg file/ -format UDTO -o /path-to-whatever you are going to name the .iso file

Example: hdiutil convert /Users/csh11/os_systems/redhat/RHEL_6.0x86_64.dmg -format UDTO -o /Users/csh11/redhat6.iso


2. Once the command has finished running you will see the following file redhat6.iso.cdr now all this means is that the file has been converted over to an dvd image all that needs to be done is rename the file from redhat6.iso.cdr to redhat6.iso


3. All done enjoy your new iso file.

Monday, March 7, 2011

Back Again

Well Hello EveryOne i'm finally back and full of fire. Well alot has happened to me since i last blogged. I was fired from my job for a reason that was beyond my control it was pretty much a situation where not being in the in crowd and standing up for myself cost me my job, but oh well the only people that im going to miss are my friends but i can call them and hang out with them so im not at a lost there lol :) ok now moving on. I've decided to grow my business called globalwave consulting full time doing network/system security with a variety of Operating Systems and Applications. I'm really enjoying the independent route right now. But im working on same very interesting projects which is will be blogging more about on a day to day basis.

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...