Tuesday, November 3, 2015

Sharing folders between VMware host and guest O.S.

1. Install VMware Tools. See http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022048 and http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022525
     . Virtual Machine -> Install VMware Tools
           sudo mkdir /mnt/vmtools
           sudo mount /dev/sr0 /mnt/vmtools
           cd /mnt/vmtools
           tar zxvf VMwareTools-x.x.x.tar.gz -C /tmp
           cd /tmp/vmware-tools-distrib
           sudo ./vmware-install.pl -d
           sudo reboot

2. Configure share folder
     . Go to settings of the guest VM -> Sharing
           Setup the sharing folder

3. The location of the shared folder will be in /mnt/hgfs or /media/psf/

bash_profile for Mac

# reloads the prompt, usefull to take new modifications into account
alias reload="source ~/.bash_profile"

alias ll='ls -al'
alias ..="cd ../"
alias ...="cd ../../"
alias .3="cd ../../../"
alias .4="cd ../../../../"

#Find CPU hogs
alias cpu_hogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10'

#recommended 'top' invocation to minimize resources
alias ttop="top -R -F -s 10 -o rsize"

# qfind: Quickly search for file alias qfind="find . -name "
alias qfind="find . -name "

# your public ip
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"

# your local ip
alias localip="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"

#   ---------------------------
#   6.  NETWORKING
#   ---------------------------

# netCons:      Show all open TCP/IP sockets
alias netCons='lsof -i'

# flushDNS:     Flush out the DNS Cache
alias flushDNS='dscacheutil -flushcache'

# lsock:        Display open sockets
alias lsock='sudo /usr/sbin/lsof -i -P'

# lsockU:       Display only open UDP sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP'

# lsockT:       Display only open TCP sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP'

# ipInfo0:      Get info on connections for en0
alias ipInfo0='ipconfig getpacket en0'

# ipInfo1:      Get info on connections for en1
alias ipInfo1='ipconfig getpacket en1'

# openPorts:    All listening connections
alias openPorts='sudo lsof -i | grep LISTEN'

# showBlocked:  All ipfw rules inc/ blocked IPs
alias showBlocked='sudo ipfw list'

#   ii:  display useful host related informaton
#   -------------------------------------------------------------------
    ii() {
        echo -e "\nYou are logged on ${RED}$HOST"
        echo -e "\nAdditionnal information:$NC " ; uname -a
        echo -e "\n${RED}Users logged on:$NC " ; w -h
        echo -e "\n${RED}Current date :$NC " ; date
        echo -e "\n${RED}Machine stats :$NC " ; uptime
        echo -e "\n${RED}Current network location :$NC " ; scselect
        echo -e "\n${RED}Public facing IP Address :$NC " ;myip
        #echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns
        echo

    }

Tuesday, August 25, 2015

[Books] Five marketing/creative books that have stood the test of time

Source: http://www.adweek.com/adfreak/5-marketing-and-creativity-books-stand-test-time-157640
1. A Technique for Producing Ideas, James Webb Young (1965)
2. The Soul of a New Machine, Tracy Kidder (1981)
3. Bill Bernbach's Book, Bob Levenson (1987)
4. The Book of Gossage, Howard Gossage, edited by Bruce Bendinger (1995)
5. The Cluetrain Manifesto, Rick Levine, Christopher Locke, David "Doc" Searls, David Weinberger (2000)

Saturday, July 25, 2015

Capture packets from iOS devices on Mac OS with Wireshark

RVI (Remote Virtual Interface)

1. Connect your iOS device to a Mac with USB
2. Open terminal and enter "rvictl -s deviceUUID" to start device with interface rvi0
3. Run wireshark and start capturing the packet on interface rvi0
4. Sotp interface rvi0 by enter "rvictl -x deviceUUID"

PS. deviceUUID is the UUID of your iOS device

Friday, July 24, 2015

Useful applications for Mac OS X

Browser:
   . Chrome
   . Firefox
IM:
   . Line
   . Skype
   . QQ
Code editor:
   . Sublime text
IDE:
   . Xcode
Utilities:
   . CleanMyMac
   . Alfred
   . Disk Inventory X
Cloud storage:
   . Dorpbox
Download:
   . BitTorrent
   . FileZilla
Video Player:
   . MPlayerX
Background nature music:
   . Noizio
. NTFS:
   . Paragon NTFS
. Virtual Machine:
   . Parallels Desktop
. Calendar:
   . Sunrise calendar
. Remote Desktop
   . TeamViewer
. Gestures for trackpad
   . BetterTouchTool

Tuesday, July 7, 2015

Keyboard shortcuts for symbols on Mac OS X


Degree (˚): option + k
Micro (µ): option + m
Copyright (©): option + g
Ohm (Ω): option + z
Registered (®): option + r
Trade mark (™): option + 2

Math:
Approximate (≈): option + x
PI (π): option + p
Delta (∆): option + j
Infinity (∞): option + 5
Division (÷): option + /
Not equal (≠) : option + '+'
Plus/Minus (±): option + shift + =
Square root (√): option + v
Alpha (∂): option + d
Beta (ß): option + s
Function(ƒ): option + f
Calculus (∫): option + b

Money:
Yen (¥): option + y
Pound: (£): option + 3
Euro (€): option + shift + 2

No interface available in Wireshark on Mac OS

Change the permission to 644 on the BFF (Berkeley Packet Filter) in /dev/

sudo chmod 644 /dev/bpf*

or

whoami to find out your name

sudo chown yourname:admin /dev/bp*

And restart wireshark!

Monday, July 6, 2015

USB to Serial (Console) on Mac OS X

Use the built-in "screen"

1. Install the USB to Serial driver (PL2303 Mac OS X)
2. In terminal, launch Screen and connect to device by following command (115200: baud rate)
    screen /dev/cu.usbserial 115200
or screen /dev/tty.usbserial 115200

To list the screen sessions: screen -ls   (output in format pid.tty.host)
To resume a detached session: screen -r   or  screen -x pid

Commands in 'screen':
'Control+a' and then '?' : Help
'Control+a' and then 'H' : toggle logging
'Control+a' and then 'Control+\' : Quit screen



Thursday, May 21, 2015

tcpdump wirte to screen and file

Basic form:
tcpdump -i interface OPTIONS -w - | tee outputFile | tcpdump -r -

-w - : write data to stdout
tee : write data to file and its own stdout
-r - : read data from stdin

Example:
tcpdump -i enp3s0 udp and port 53 -w - | tee packet.pcap | tcpdump -nn -r -

Tuesday, May 5, 2015

Use iptables for CentOS 7 instead of firewalld

CentOS 7 is now using firewalld instead of iptables. To use iptables, here are the steps:

1. Disable firewalld
systemctrl disable firewalld

2. Stop firewalld
systemctrl stop firewalld

3. Install iptables-services
yum install iptables-services

4. Enable iptables
systemctl enable iptables

5. Start iptables
systemctl start iptables

 6. Configure iptables as usual (/etc/sysconfig/iptables)

Monday, May 4, 2015

Wednesday, April 22, 2015

Completely remove nf_conntrack from kernel

1. Remove the following line, if it exists, in /etc/sysconfig/iptables-config
   IPTABLES_MODULES="ip_conntrack_netbios_ns"

2. Stop iptables
   iptables -F

3. Remove the related modules
   modprobe -r xt_NOTRACK nf_conntrack_netbios_ns nf_conntrack_ipv4 xt_state
   modprobe -r iptable_nat ipt_MASQUERADE nf_nat nf_defrag_ipv4
   modprobe -r nf_conntrack

Wednesday, February 25, 2015

Solution for VPN client not working after upgraded to Mac 10.10 Yosemite

Source: http://apple.stackexchange.com/questions/151345/vpn-client-is-not-working-after-yosemite-update-enforce-firewall-policy-fail

Solution: put computer into kext developer mode (-> 10.9 behavior)
   sudo nvram boot-args="kext-dev-mode=1"

To change back to 10.10 behavior (VPN client will not work)
   sudo nvram -d boot-args


After the change, you need to reboot the computer

Friday, January 16, 2015

rpath

Reference: http://ftp.gnu.org/pub/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html

Add directory to the runtime library search path, for shared object.

Example: Add runtime search path /tmp/igetui

gcc -Wl,-rpath,/tmp/igetui/ $(PLATFORM) $(DEBUG) -lpthread -ldl


OR add it to LD_LIBRARY_PATH
ex.
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/igetui

OR add it /etc/ld.so.conf and run ldconfig

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX