sábado, 30 de outubro de 2010

Compiling aircrack-ng with CUDA support on Mac OS X

After struggling to compile aircrack-ng 1.0 rc3 on Mac OS X 10.6.4, I thought I should write some instructions down and maybe someone could benefit from my experience.

I'll try to do this quick and simple as possible.

Download the latest version from the SVN (at the time this post was written aircrack-ng was on revision 1788):
svn co http://trac.aircrack-ng.org/svn/branch/aircrack-ng-cuda aircrack-ng-cuda

When the checkout finishes, cd into the directory:
cd aircrack-ng-cuda

Create a new file named aircrack_osx_cuda.patch and paste the following content inside it, or download the file directly from here:
diff -ruN --exclude=.svn --exclude='*~' ./src/Makefile ../aircrack-ng-cuda_patched/src/Makefile
--- ./src/Makefile 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/Makefile 2010-10-30 16:39:56.000000000 -0200
@@ -4,7 +4,7 @@
TEST_DIR = $(AC_ROOT)/test
-CFLAGS += -Iinclude
+CFLAGS += -Iinclude -arch i386
iCC = $(shell find /opt/intel/cc/*/bin/icc)
iCFLAGS = -w -mcpu=pentiumpro -march=pentiumpro $(COMMON_CFLAGS)
@@ -145,7 +145,7 @@
aircrack-ng-opt-prof -lpthread $(LIBSQL)
aircrack-ng$(EXE): $(OBJS_AC)
- $(CC) $(CFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
+ $(CXX) $(CFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
airdecap-ng$(EXE): $(OBJS_AD)
$(CC) $(CFLAGS) $(OBJS_AD) -o $(@) $(LIBSSL)
diff -ruN --exclude=.svn --exclude='*~' ./src/include/radiotap-parser.h ../aircrack-ng-cuda_patched/src/include/radiotap-parser.h
--- ./src/include/radiotap-parser.h 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/include/radiotap-parser.h 2010-10-30 16:33:55.000000000 -0200
@@ -17,7 +17,7 @@
#define __user
-#include
+#include
#include
typedef uint64_t u64;
diff -ruN --exclude=.svn --exclude='*~' ./src/osdep/Makefile ../aircrack-ng-cuda_patched/src/osdep/Makefile
--- ./src/osdep/Makefile 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/osdep/Makefile 2010-10-30 16:25:39.000000000 -0200
@@ -2,7 +2,7 @@
include $(AC_ROOT)/common.mak
LIB = libosdep.a
-CFLAGS += $(PIC) -I.. $(LIBAIRPCAP)
+CFLAGS += $(PIC) -arch i386 -I.. $(LIBAIRPCAP)
OBJS_NET = network.o
OBJS = osdep.o $(OBJS_NET)
diff -ruN --exclude=.svn --exclude='*~' ./src/sha1-sse2.S ../aircrack-ng-cuda_patched/src/sha1-sse2.S
--- ./src/sha1-sse2.S 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/sha1-sse2.S 2010-10-30 16:24:31.000000000 -0200
@@ -21,7 +21,7 @@
.globl _shasse2_cpuid;
.data
-.align(16)
+.align(12)
const_init_a:
.long 0x67452301
.long 0x67452301

Then apply this patch executing the command:
patch -p1 < aircrack_osx_cuda.patch

and start the compilation process with:
CXX=g++ CUDA=true make

when the compilation finishes you can install it on your system with the traditional:
sudo make install

sexta-feira, 7 de maio de 2010

How to access Pandora outside of the US (using a proxy)

I was talking to a great friend of mine about music and Internet radio, and he brought up Pandora's name in the conversation. Do you remember the good old days where you could just access Pandora's site and listen to interesting music? Unfortunately, those days are over and Pandora has limit its access to US residents only.

I decided to invest some time and find a way to bypass it. The solution I came up was to use my DreamHost shell account (since the server is located in the US) to act as a proxy between my PC and Pandora's server. This was pretty simple to do, by the way.

I'm currently on Ubuntu Linux, but this could be set up on Windows as well (with the help of Putty).

Go to your command line and execute the following:
$ ssh -N -v -D 8080 account@in_some_other_server.net

This will create a ssh tunnel between your PC and the remote server, using port 8080 to do it. I used DreamHost as a server for a quick test. Don't close the terminal or you'll loose the connection.

The next step is to configure the proxy settings in your_favorite_browser. Since I use Firefox a lot, click on: Edit > Preferences , then Advanced (tab) > Network (tab) > Settings. Mark the box "Manual proxy configuration" and in the SOCKS Host field type in: 127.0.0.1
and in the port field, type: 8080

Now, go to Pandora's website and check it out. Keep in mind that this mean that every single tab you'll open inside Firefox will use the proxy connection to browse the Internet, and you probably want to use your regular connection to do your other stuffs, don't you?

Since Firefox is not capable of handling a individual proxy configurations for each of your tabs, I suggest using 2 Firefox windows instead: this allows you to have one window dedicated for Pandora and the other one for your regular browsing. How to do this? The answer is to set up two different Firefox profiles: this is very easy to do, and there are documents all over the place to assist you with this.

Anyway, I created 2 Firefox shortcuts to run each profile. I find them to be self-explanatory:
1) firefox -P "default"
2) firefox-3.5 -P "pandora" -no-remote

Needless to say that the second is the one that has the proxy configured on.

quinta-feira, 6 de maio de 2010

iPhone 3.1.3: ssh_exchange_identification error

After jailbreaking my iPhone, changing the default password for mobile, and installing a few apps from Installous, suddenly I began to have a problem connecting to the iPhone via SSH (Wifi):
$ ssh mobile@10.0.33.141 (iPhone's IP)
ssh_exchange_identification: Connection closed by remote host

First I thought, "What the F....!!!". Then I googled a lot looking for an easy way out, but nothing worked. After re-installing OpenSSH (from Cydia), the SSH server was back and fully functional. So I was happy... for a while... until I rebooted my phone to check if the fix was permanent. The SSH connection worked for about 10 seconds, and then closed. I couldn't connect to it anymore.

I had to re-install OpenSSH from cydia to make it work again. After that, I downloaded some apps (deb files) from the saurik server, to help me investigate the problem. I had to manually install them, one by one, because Telesphoreo Tangelo repository is not listing any files in Cydia for me (i'm still working on that). Theses are the apps I downloaded to assist me:
adv-cmds_119-5_iphoneos-arm.deb
apt_0.7.20.2-21_iphoneos-arm.deb
aptitude_0.4.11.11-5_iphoneos-arm.deb
bash_4.0.17-9_iphoneos-arm.deb
berkeleydb_4.6.21-4_iphoneos-arm.deb
cwidget_0.5.8-2_iphoneos-arm.deb
gettext_0.17-6_iphoneos-arm.deb
libpcap_1.0.0-4_iphoneos-arm.deb
libsigc++_2.2.3-4_iphoneos-arm.deb
nano_2.0.7-5_iphoneos-arm.deb
openssh_5.2p1-7_iphoneos-arm.deb
openssl_0.9.8k-9_iphoneos-arm.deb
tar_1.19-8_iphoneos-arm.deb
tcpdump_3.9.8-3_iphoneos-arm.deb
vim_7.1-3_iphoneos-arm.deb
wget_1.11-3_iphoneos-arm.deb


In order to install a .deb file, simply execute the command below for each file on MobileTerminal (as root):
# dpkg -i filename.deb

At this point, my current arsenal had: a working apt-get system, a text editor, a network downloader, a tool to list current processes and another tool to dump network traffic.

Next, I also installed the syslogd to give me more information of what was going on inside the operation system:
# apt-get install syslogd
# touch /var/log/syslog (this will create a log file in the right place)

Now It was time to record some data: after rebooting the phone and unlocking the screen, I immediately tried to connect via ssh and succeed for 10 seconds, as expected. Then I opened MobileTerminal and copied the /var/log/syslog to my computer using SCP:
# scp /var/log/syslog karl@zpm:~/

If you look carefully at the logs below, you'll see I successfully connected through ssh from 10.0.33.33 (my pc). Also, weird messages showed up after that:

May 6 15:48:44 my-iPhone launchproxy[120]: /usr/libexec/sshd-keygen-wrapper: Connection from: 10.0.33.33 on port: 34812
May 6 15:48:50 my-iPhone sshd[121]: Accepted password for mobile from 10.0.33.33 port 34812 ssh2
May 6 15:48:50 my-iPhone sshd[122]: USER_PROCESS: 122 ttys000
May 6 15:49:01 my-iPhone /bin/poc-bbot[20]: IIIIIII Just want to tell you how im feeling
May 6 15:49:01 my-iPhone /bin/poc-bbot[20]: pdp_ip0
May 6 15:49:01 my-iPhone /bin/poc-bbot[20]: 189.96.95.135
May 6 15:49:01 my-iPhone /bin/poc-bbot[20]: awoadqdoqjdqjwiodjqoi aaah!
May 6 15:49:01 my-iPhone /bin/poc-bbot[20]: Checking out the local scene yo
May 6 15:49:01 my-iPhone com.ikey.bbot[20]: cp:
May 6 15:49:01 my-iPhone com.ikey.bbot[20]: cannot stat `/var/log/youcanbeclosertogod.jpg': No such file or directory
May 6 15:49:02 my-iPhone sshd[121]: Exiting on signal 15
May 6 15:49:02 my-iPhone sshd[121]: DEAD_PROCESS: 122 ttys000


That's just wrong! Right after the stat operation fails, SSH service mysteriously dies. Googling for poc-bbot I discovered something nasty: apparently, poc-bbot is a proof-of-concept virus that attacks iPhones with the default root password.

To remove it from my system and protect it, I followed very simple instructions at:
http://thebackpackr.com/remove-the-ikee-virus-from-your-iphone/

At last, SSH was finally working.

[]'s

IPhone: new storage folder on Installous 3.0 & 3.1

This week Installous updated to version 3.0 and today to 3.1, and there were huge improvements made in these versions.

In previous versions though, the storage folder was:
/var/mobile/Library/Downloads/

Now, the storage folder is in a more proper location, and you can still manually copy your .ipa files to:
/var/mobile/Documents/Installous/Downloads/

I created a symlink in the home directory to that folder to make things easier in the future:
$ ln -s /var/mobile/Documents/Installous/Downloads ~/

Whenever I need to install .ipa files on the iPhone, I just SCP them to the home directory via WIFI, then open MobileTerminal inside the iPhone and run the following command:
$ mv *.ipa Downloads/

and that's it.

For more information on Installous, visit: http://hackulo.us/

domingo, 15 de novembro de 2009

Fast grayscale image conversion with CUDA

After getting seriously disappointed searching for simple source-codes on Digital Image Processing using NVIDIA CUDA technology I decided it was time to do something about it.

This multi-platform project presents a nice, simple and straightforward technique for converting colored images to their grayscale representation using CUDA enabled GPUs to speed up processing, with the assistance of OpenCV for loading and saving images.

Full source-code is available for download. The software was successfully tested and compiled under Windows XP (MSVS2005) and Ubuntu Linux (g++), both using CUDA 2.3.

cuda-grayscale project: http://code.google.com/p/cuda-grayscale/

quarta-feira, 11 de novembro de 2009

Listar todas as funções de um código-fonte

A próxima dica vai para os desenvolvedores linux. Para listar todas as funções de um determinado fonte em C, você pode utilizar a ferramenta ctags da seguinte maneira:

$ ctags --c++-kinds=f -x hello.c

Também funciona para C++.

[]'s

segunda-feira, 9 de novembro de 2009

Video Intel no Ubuntu 9.10

Antes de qualquer coisa, verifique que o /boot/grub/menu.lst foi atualizado para utlizar o kernel 2.6.31-14-generic. Problemas de vídeo e som podem estar diretamente relacionados a isso. Drivers novos com kernel antigo.. problema!

Se por algum motivo você precisa permanecer com uma versão de kernel, pode experimentar o seguinte..

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Integrated Graphics Controller (rev 04)

Obviamente eu tenho uma Intel 82915G/GV/910GL neste computador. A solução foi fazer download de um pacote antigo do driver e instalar manualmente.

$ wget http://launchpadlibrarian.net/27624866/xserver-xorg-video-intel_2.6.3-0ubuntu9.3_i386.deb

$ sudo dpkg -i xserver-xorg-video-intel_2.6.3-0ubuntu9.3_i386.deb

Para finalizar, só precisa fazer logout e reiniciar o X. Então depois de deslogar, aperte CTRL+ALT+F2 para ir para o terminal e depois de fazer o login execute:

$ sudo stop gdm

$ sudo start gdm

Não desperdisse tempo tentando fechar o gdm com killall ou kill -9 que não irá funcionar no Karmic, pois ele continuará ressurgindo das sombras.

Lembrando que se o compiz não funcionar, você pode ter o AWN rodando através do próprio metacity. Basta habilitar o compositing_manager do metacity no gconf-editor:
apps > metacity > general e marque o campo compositing_manager

[]'s