Tag Archives: macos

VNCViewer for Metasploit payload on Mac OS X

When working with VNC payloads, the Metasploit framework need vncviwer to be installed on the machine. Since Apple includes a VNC Client by default with OSX lets create a simple bash script that will call on the hos:ip combination that Metasploit uses with vncviwer so we do not have to fight with XQuatz and X11 to get one running on OSX:

echo '#!/usr/bin/env bash' >> /usr/local/bin/vncviewer
echo open vnc://\$1 >> /usr/local/bin/vncviewer
chmod +x /usr/local/bin/vncviewer

This will allow us to call from the terminal a connection to a VNC Server like:


Update Nessus via offline update mode

This step is for people that using Nessus on Mac OS X.

Step 1: Stop Nessus service on your machine
sudo launchctl unload -w /Library/LaunchDaemons/com.tenablesecurity.nessusd.plist

Step 2: Download and copy the necessary registration and plugin files.
Now we have to download the registration file (nessus-fetch.rc) to register your license offline and latest plugin updates file (all-2.0.tar.gz).

run command:
/opt/nessus/bin/nessus-fetch --challenge

This will produce a string called “challenge” that looks like the following:
Challenge code: 67e1690d05c8608e959d5983de66688b5c3acae1

Next, go to https://plugins.nessus.org/offline.php and paste the “challenge” string as well as the Activation Code that you received previously into the appropriate text boxes. If you didn’t have the code or the code is invalid, register new activation code. This will produce a custom URL that can be used to download the latest Nessus plugin feed (all-2.0.tar.gz) along with a link to the nessus-fetch.rc file at the bottom of the screen.

Copy the nessus-fetch.rc file to your computer in the following directory:

Now let’s register the scanner in offline mode.
Run the following command.
cd /Library/Nessus/run/bin/
nessus-fetch --register-offline nessus-fetch.rc

You will receive a message output saying registration was successful.

Step 3: Obtain and install latest plugins
To obtain the newest plugins, go to the URL that was provided in the previous step, download the file named “all-2.0.tar.gz” and save it in the directory /opt/nessus/sbin/. To install the plugins, perform the following command:
/opt/nessus/sbin/nessus-update-plugins all-2.0.tar.gz

Step 5: Rebuild the installed plugins
Run the following command to rebuild the plugins on your system:
/Library/Nessus/run/sbin/nessusd -R

This usually takes time…. So please be patience.

Step 6: Start the nessus server
Start your nessus server and try to login using a browser:

use the credentials you created before and login.

Upgrade Ruby on Mac OS X

Ruby Version Manager (RVM)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. RVM provides the flexibility to use any version of Ruby that you require. It also can be use to upgrade your current ruby version on Mac OS X. You can look for more info at here: https://rvm.io

So now, let’s try open new Terminal, and run this command:
ruby -v

Likely, it’ll show version number ruby 1.8.7.
If you’re just starting out with Ruby, don’t use an old version; you want 1.9.2!
So here is there steps to upgrade your ruby version to the current latest version via RVM.

Step 1
Open a terminal and run the following command:
\curl -L https://get.rvm.io | bash -s stable –ruby

Step 2
After a few seconds of installation, we need to make the RVM available to the shell. We’ll do this by updating our ~/.bash_profile file.

cd ~/
sudo vim .bash_profile
[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” # This loads RVM into a shell session.

* If this file does not exist, you should create it manually. Paste the following to the bottom of the page.

Step 3
To be safe, let’s restart the terminal to make sure that everything took effect. To ensure that RVM is correctly installed, type:

Step 4
Ensure you have the latest version of Xcode

Step 5
To download Ruby 1.9.2, open a new terminal, and type:
rvm list known

You’ll see a long list of versions…
$ rvm list known

Now, let’s try install Ruby 1.9.2:
rvm install 1.9.2

That should take a moment to install.

Once the installation has completed, we need to tell RVM which version of Ruby we currently want to use. Run the following comamnd:
rvm use 1.9.2

Next, test it by checking the version number:
ruby -v

It should returns ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0].
Nice. Now you’re now using Ruby 1.9.2.

If you closed the terminal, and run the ruby -v command, and it returns the old version of ruby, you need to specify the latest ruby version.

Open new terminal, and run this command:
rvm –default use 1.9.2

So now it should be as we wanted. 🙂

How to SSH bruteforce on Linux/Mac OS X

SSH is an acronym for Secure Socket sHell, which provides a secure connection access to a remote machine.

By using this SSH Bruteforce tool, you can test security stuff like iptables, sshguard or fail2ban to see whether the rules or policy that have been set working or not. You also able to see the procedure of real hacking attempt.

Like most of brute forcing tools, first you’ll need a big passlist. You can get one from here:

Get SSHBrute python script:

To get it to work you will need this packages:

For Mac OS X user, this is the requirement:

  • Xcode 4.3 (App Store link) or later installed including Command Line Tools or install GCC and Command Line Tools without Xcode
  • Get Paramiko (or whatever the newest version is), this package includes PyCrypto

Download Paramiko at here:

Then, unzip the Paramiko archive and go to that directory:

Type the following command to start installing:

After that, unzip SSHBrute:

Go to SSHBrute directory:

To start the script, run this command:

The parameter:
-h = hostname/IP address
-u = username/username list
-d = password list

This is how the tool works:

Write failed: Broken pipe issue on Mac OS X

If you ssh to your server using Terminal or iTerm, have you ever encountered this kind of problem?
If you do, here I give you a solution (maybe a solution. it works for me at the meantime) on how to solve this issue.

Open you terminal, and insert this command to your terminal and hit enter:

sudo sysctl -w net.inet.tcp.always_keepalive=9999

Upgrade MAMP phpMyAdmin

For those who don’t know what is MAMP, MAMP is stands for Macintosh, Apache, MySQL and PHP. And it has offered the perfect solution for a local developing environment under Mac OS X. The MAMP is also available free of charge for smaller projects.

Recently, I got some notification on my phpmyadmin saying that I need to upgrade my phpmyadmin.
Upgrading the shipped phpMyAdmin to the latest version appears to be very easy. Just downloading and extracting it to the correct folder.

First, download the latest available version from phpMyAdmin’s download page. If you have MAMP, extract the files to the following directory (backup the old files first just in case): /Applications/MAMP/bin/phpMyAdmin.

Restart MAMP and go to http://localhost/phpMyAdmin, you’ll see that your phpMyAdmin interface is upgraded.

For people who has MAMP Pro, the correct location of your phpMyAdmin files is at /Library/Application Support/appsolute/MAMP PRO/phpMyAdmin.

P/S : If you want to change the url from phpMyAdmin to phpmyadmin, rename the folder accordingly.

Show hidden files Mac OS X

To enable hidden files/folders in finder windows:

  • Open Finder
  • Open the Utilities folder
  • Open a terminal window
  • Copy and paste the following line in:

defaults write com.apple.Finder AppleShowAllFiles YES

  • Press return
  • Now hold ‘alt’ on the keyboard and right click on the Finder icon
  • Click on Relaunch

You should find you will now be able to see any hidden files or folders.

To disable hidden files/folder back, just follow the same step aboce. Just replace the word “YES” with “NO

BootCamp Assistant error


For Mac users, have you ever encountered something like this?

The disk cannot be partitioned because some files cannot be moved.

This error encountered during partitioning hard disk using BootCamp Assistant to install Windows as dual-boot in your Mac OS.

The Solution.

  • Reboot. Hold the “command-key + S key”
  • After that, a terminal will appears. Type in “fsck -fy” (without quote) and press Enter
  • It will start restoring & repairing your hard disk
  • Wait until it complete
  • After finished, type “reboot” and press Enter to restart