Thursday, November 24, 2011

Browser Exploitation Framework on Mac OSX 10.6


As you know BeEF is a good framwork for browser exploitation.Here is a guide to install it in Mac,as the original documentation doesnt work most of the times with OSX.


Check your ruby version first (Im assuming you have ruby gem,rvm and svn already installed,if not install them first.)

ruby --version

i had 1.8,updated to 1.9 through rvm and made it default.
create a folder for beef and checkout the latest code,
mkdir beef
cd !$
svn checkout http://beef.googlecode.com/svn/trunk/ beef-read-only
cd beef-read-only
ruby beef
You may see some Load errors,don't be panic..we can easily fix it.

Beef requires some ruby gems,if it is not there inside your system,It will throw load errors,to fix those get what gem is missing and install it using the following command
Lets say you saw one error like ,

/Users/r3dsm0k3/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/
site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- ansi (LoadError)
from /Users/r3dsm0k3/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /users/r3dsm0k3/Desktop/stuffhack/beef/beef-read-only/core/loader.rb:23:in `'
from :29:in `require'
from :29:in `require'
from beef:37:in `
'

from the first line it is sure that,there is no gem called "ansi"
just install it then,
gem install ansi


done, :)
Try running beef again.If it fails,install the missing gem like before.
I got issues with the following gems,
ansi
erubis
term/ansicolor (
gem install term-ansicolor
)
librex (for librex, the installation is quite different as beef needs 0.0.52 version of librex,but when you install from gem it will be the latest,so install the corresponding version like
gem install librex --version 0.0.52 --no-rdoc --no-ri 
)

After all your dependencies are fulfilled run beef.

ruby beef

Enjoy your pwnage,Errr...Pentest :)

Monday, November 21, 2011

Debugging clue-less crash XCode

This is taken from web,but forgot what site it was,I had it on my sticky notes.


I thought I would share this, I'm sure most of you already know, but just in case, cos I find it pretty useful.


Whenever we get one of those crashes where there is no trace on the debug window, there are a few things we ca do, after the crash, don't close the app just yet, go to the debug window, and first, type "bt", that will give you a stack trace of the executing just after the crash, on top of the list you will see the last point that caused the crash, may be code on your classes or from some of the frameworks, find the first one that belongs to your code, there will be a number, for example #5, type "f 5" and that will jump to that part of the code. Now, if you want to debug values of any variables at that point, type "p variable_name" or you can even call a function or expression. If the variable is an object, you will see the pointer, if not, the value. If the variable is an object, use "po variable_name" to get the value, note you may get an memory error, that would mean that variable is nil (maybe the cause of your crash).

So in summary:
  • bt: display stack trace
  • f X: jump to code line
  • p variable: display variable value, pointer of basic type
  • po variable: display object variable value
Maybe this is trivial for some people, but I discovered time ago after more than one year developing on XCode!!