Tag Archives: macos

Configure Cisco switch from Mac OS X through console port

Recently, I was searching for rollover cable that used to connect your PC/laptop to your switch via console port. It took me for a while searching this kind of cable in Low Yat Plaza, KL. Here, you can find variety of electronics stuff from PC hardware to servers stuffs.

But, it was hard for me to find this cable. After several visit to Low Yat, I managed to find the cable together with DB9 to USB converter. As you know, the rollover cable is using serial to ethernet cable. So, this post will guide you on how to install the driver and connect your rollover cable to your switch from Mac OS X.

So, for the first step, you should have rollover cable that looks like this:

Rollover to DB9/serial cable
Rollover to DB9/serial cable

And the DB9 to USB 2.0 converter. The one that I’m using is like this:
http://www.vztec.com.my/?sec=product&type=connect&sub=5&id=13776589936053

For my Mac OS X version, I’m using Mac OS X Yosemite 10.10.5 on MacBook Pro (13-inch, Early 2011). You’ll need the driver for the cables that you can download at here:
http://www.prolific.com.tw/UserFiles/files/PL2303_MacOSX_1_6_1_20160309.zip

After you’ve done downloading and extracting the driver, just click at .pkg file and proceed to install the driver. Reminder, make sure you restarted you machine after installing the driver in order for system to take effect:

DB9 to USB Converter driver
DB9 to USB Converter driver

Then, connect/plug-in the rollover cable to DB9 to USB converter. Then connect the converter USB to you Mac. After all has been connected, click on Apple logo on top left menu bar, click About This Mac, on Overview tabs, click System Report. Ensure that you DB9 converter is connected:

Mac OS X System Info
Mac OS X System Info

After restart, you can verify if the driver has successfully installed and loaded to the system by using this command:

$ kextstat | grep prolific

or

$ ioreg -c IOSerialBSDClient | grep usb

Now finally, you need an application which will talk to the serial port. We’ll using Terminal app on Mac OS X. On Mac, the file which maps to the port is /dev/cu.usbserial. Once all the cable has been connected, run this command to start connecting to you switch is:

$ screen /dev/cu.usbserial 9600

Flatten a Nested Directory & File Hierarchy from Command Line of OS X

Lets say you have this kind of file/folder structure:

master folder ---- folder1 ---- image1.jpg
               |            |
               |            |-- image2.jpg
               |
               |
               |-- folder2 ---- image1.jpg
               |            |
               |            |-- image2.jpg
               |
               |-- etc.

You can take all the *.jpg file or any file type, and move it into one single/master folder.
Here are the command to use:

cd <master_directory> <-- master/top folder where all the file are located inside it
find * -type f -print0 | xargs -0 -I%%% mv -n %%% ../<new_directory> <-- "new destination folder"

Installing bulk_extractor on Mac OS X

All reference is taken at here: https://github.com/simsong/bulk_extractor/wiki/Installing-bulk_extractor

bulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools.

To install bulk_extractor, first install required library via Macports:

sudo port install flex autoconf automake pkgconfig

All install dev library:

sudo port install libewf openssl tre libxml2

Download libewf source code:

https://github.com/libyal/libewf

Then install libewf from source (because libewf via ports too old):

./configure
make
sudo make install
sudo ldconfig./configure
make
sudo make install
sudo ldconfig

Setting locale failed on Mac OS X Mavericks

If you using Mac OS X (in my case, I’m using Mavericks), during SSH session, you may see this kind of error in your terminal:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To solve this, edit .bash_profile file in your host/local machine

sudo nano ~/.bash_profile

and add this line:

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Credit to: Agile Faqs

Maltrieve on Mac OS X

Maltrieve originated as a fork of mwcrawler. It retrieves malware directly from the sources as listed at a number of sites, including:

  • Malc0de
  • Malware Black List
  • Malware Domain List
  • VX Vault
  • URLqery
  • CleanMX

If you want to install maltrieve on your Mac OS X, below is the steps to install it.

  • First, install beautifulsoup4 via pip
sudo pip install beautifulsoup4
  • Install required dependencies via apt-get
sudo port install libxml2 libxslt py-lxml
  • Download maltrieve from github
sudo git clone https://github.com/technoskald/maltrieve.git
cd maltrieve
python maltrieve.py -d pull -l maltrieve.log

Done. Now you can use the Maltrieve on your Mac OS X.

How to install Volatility on Mac OS X Mavericks (10.9.2)

Requirements

Install Xcode
Command Line Tools in the ‘Components’ tab.

Installing Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew doctor

Installing XQuartz:
Download installer from http://xquartz.macosforge.org/landing/
Install using the installer downloaded from the website.

Installing Wine with Homebrew

brew install wine

Note: Keeping Wine up-to-date:

brew update
brew upgrade

Installing Wget with Homebrew

brew install wget

Installing pcre with Homebrew

brew install pcre

Installing pip

sudo easy_install pip

Recommended packages

Note: Change ownership of ‘opt’ directory to your user account:

sudo chown -R [USERNAME] /opt
e.g.:
sudo chown -R zam /opt

Installing Distorm3

cd /opt/
wget http://distorm.googlecode.com/files/distorm-package3.1.zip
unzip distorm-package3.1.zip
rm distorm-package3.1.zip
cd /opt/distorm3
python setup.py build
sudo python setup.py install

Installing Yara

cd /opt/
wget http://yara-project.googlecode.com/files/yara-1.7.tar.gz
tar xvzf yara-1.7.tar.gz
rm yara-1.7.tar.gz
mv yara-1.7 yara
cd /opt/yara
./configure CFLAGS=-std=gnu89
make
sudo make install

Installing Yara-Python

cd /opt/
wget http://yara-project.googlecode.com/files/yara-python-1.7.tar.gz
tar xvzf yara-python-1.7.tar.gz
rm yara-python-1.7.tar.gz
mv yara-python-1.7 yara-python
cd /opt/yara-python
python setup.py build
sudo python setup.py install

Test by running python shell:

python
>>> import yara

Installing PyCrypto

cd /opt/
wget https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.tar.gz
tar xvzf pycrypto-2.6.tar.gz
rm pycrypto-2.6.tar.gz
mv pycrypto-2.6 pycrypto
cd /opt/pycrypto
python setup.py build
sudo python setup.py install

Installing PIL – Python Imaging Library

brew install libtiff libjpeg webp little-cms2
pip install Pillow

Installing OpenPyxl

sudo pip install openpyxl

Installing Graphviz

brew install libtool

Download: www.graphviz.org/pub/graphviz/stable/macos/mountainlion/graphviz-2.32.0.pkg
Install Graphviz using the installer downloaded.

Optional packages

Installing pytz

cd/opt/
wget http://downloads.sourceforge.net/pytz/pytz/2006p/pytz-2006p.zip
unzip pytz-2006p.zip
rm pytz-2006p.zip
mv pytz-2006p pytz
cd /opt/pytz
python setup.py build
sudo python setup.py install

IPython
Installing Anaconda:

cd ~/Downloads
wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-1.6.1-MacOSX-x86_64.sh
bash Anaconda-1.6.1-MacOSX-x86_64.sh

Installing IPython:

conda update conda
conda update ipython

Installing pyxpress:

cd/opt/
mkdir pyxpress
cd /opt/pyxpress
wget https://rekall.googlecode.com/git/contrib/pyxpress/README
wget https://rekall.googlecode.com/git/contrib/pyxpress/pyxpress.c
wget https://rekall.googlecode.com/git/contrib/pyxpress/setup.py
python setup.py build
sudo python setup.py install

Installing libforensic1394:

cd /opt/
git clone git://git.freddie.witherden.org/forensic1394.git
cd forensic1394

Download: www.cmake.org/files/v2.8/cmake-2.8.11.2-Darwin64-universal.dmg

Install CMake:

cmake CMakeLists.txt
sudo make install
cd python
sudo python setup.py install

Installing Sysinternals Strings:

cd /opt/
mkdir Tools
cd /opt/Tools
wget http://download.sysinternals.com/files/Strings.zip
unzip Strings.zip
rm Strings.zip && rm Eula.txt

Volatility

Installing Volatility 2.3_beta

cd /opt/
sudo svn checkout http://volatility.googlecode.com/svn/trunk Volatility
cd /opt/Volatility
python setup.py build
sudo python setup.py install
sudo chmod +x vol.py

Finished! You can run it by using this command:

$ python vol.py

Reference: http://www.evild3ad.com/2459/how-to-install-volatility-on-mac-os-x-version-10-8-4/

Remove .svn folder from Github repo

For those who are using Github services, and pushing their code via terminal, you may encounter this problem where you will see a folder named .svn on each folder of your code.

So if you want to delete this folder, follow this step below:

First, pull your code from Github to your computer:

git pull origin master

Then, use this command to find folder .svn and delete it:

find . -name '.svn' | xargs git rm -rf --ignore-unmatch

Last, push your code back to Github server:

git push origin master

ODROID U2 – Flashing Images on Mac OS X

  1. Download the image of the OS you want to boot on your ODROID to the local disk of your Mac

  2. If the Image is compressed, unpack it (if it is in ‘.xz’ format you need a tool like The Unarchiver to be able to unpack it)

  3. Insert your SD card and check the currently mounted filesystems

gh0st:Downloads zer0$ df -h
Filesystem      Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2   371Gi  270Gi  100Gi    73% 70913436 26254530   73%   /
devfs          200Ki  200Ki    0Bi   100%      694        0  100%   /dev
map -hosts       0Bi    0Bi    0Bi   100%        0        0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%        0        0  100%   /home
/dev/disk1s1   7.4Gi  2.5Mi  7.4Gi     1%        0        0  100%   /Volumes/UNTITLED

*Note the name of the filesystem that Mac OS X assigned to the mounted SD card (in my case /dev/disk2s1)

  1. Unmount that filesystem so that you will be allowed to overwrite the disk:
gh0st:Downloads zer0$ sudo diskutil unmount /dev/disk1s1
Volume UNTITLED on disk1s1 unmounted
  1. Using the device name of the filesystem work out the raw device name for the entire SD card, by omitting the final “s1” and replacing “disk” with “rdisk” (Important: you will lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name is the name of the whole SD card as described above, not just a partition of it (for example, rdisk3, not rdisk3s1. Similarly you might have another SD drive name/number like rdisk2 or rdisk4, etc. — recheck by using the df -h command both before & after you insert your SD card reader into your Mac if you have any doubts!):
    In my case, since the device name of the mounted filesystem is /dev/disk2s1 the entire SD card has the device name /dev/rdisk2

  2. Write the image to the card with the dd command, using the raw disk device name from above (read carefully the above step, to be sure you use the correct rdisk# here!)

gh0st:Downloads zer0$ sudo dd bs=1m if=odroid-debian-wheezy-u2.img of=/dev/rdisk1
7260+0 records in
7260+0 records out
7612661760 bytes transferred in 709.578823 secs (10728423 bytes/sec)

*(note that dd will not output any information until there is an error or it is finished)

  1. When dd finished successfully it will display some information and the SD card will be re-mounted. You can now eject the card:
gh0st:Downloads zer0$ sudo diskutil eject /dev/rdisk1
Disk /dev/rdisk1 ejected
  1. Remove the SD card from the card reader and put it in the ODROID to boot your new OS image

Mac OS X – Can’t locate Switch.pm

Recently, I want to run some script using Perl. But I encountered this:

Can’t locate Switch.pm in @INC (@INC contains: /Library/Perl/5.16/darwin-thread-multi-2level /Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16 /Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16 /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .)

So, the solution is:

evasi0n7 can’t be opened because it is from an unidentified developer

Maybe you have heard about the new iOS 7.x jailbreak that has been released to public recently. Some people maybe are getting an error on their Mac OS X saying that: “evasi0n 7” can’t be opened because it is from an unidentified developer

evasion 7 problem

evasion 7 problem

Well, that’s pretty bad. But, we have the solution! 🙂

You can fix the error by navigating to System Preferences. Then go to Security and Privacy. On tab General, check on Anywhere from the “Allow apps downloaded from”.

Please ensure that you click on the lock symbol below before making any changes so that you’re allow to do the changes. You’re required to enter your password to allow changes.