TOR+Privoxy minimal setup for DGN2200v3/MIPS architecture

In a previous article I talked about how to customize the Linux based WLAN+ADSL Netgear DGN2200v3 router and prepared various binary packages ready for the device. In this short article I’m offering a small full setup that can be run on this router (and many other compatible ones and in general on any MIPS+uClinux hardware setup) to be able to use easily the TOR network to browser anonymously. In this way all the users behind the router can easily achieve anonymous surfing.

Continue reading

Posted in Linux desktop, Linux embedded, Security, Senza categoria, Teaching Material | Tagged , , , , , , , , | Leave a comment

Command line PHP deobfuscation

Recently a customer asked me to debug some problems on their Joomla!/PHP site that had interoperability issues after some long time for unknown reasons. The site was using some commercial plugins which producer was long time gone and unreachable and worst of all they were all obfuscated. So even searching for some basic string that was displayed on the screen on error to understand what’s going on was not a straight forward exercise and going through the code was a mess.

Apart from changing the code in a logical way, for example by adding intermediate variables or splitting variable assignations into more operations and so on, the first most annoying part of PHP obfuscators is that they modify most of the characters in the strings values with their respective hexadecimal (format \xXX) or octal (\XXX) values and eliminate any line feeds or code structure. Once you get rid of this the code stays quite very messy but is, at least in the cases I analyzed, quite readable and just needs a little more bookkeeping with automatically named vars to go through.

Getting rid at least of this confusing representation is quite straightforward on the command line with a few tricks.
Continue reading

Posted in Linux desktop, Security, Senza categoria, Teaching Material | Tagged , , , | Leave a comment

Linux iMX23 audio loop (or using the iMX23 as an amplifier)

As usual when working with embedded systems every component saved seems like gold to the HW guys (no matter how much software hassles or future limitations this may cause!) and in this context lately I’ve been working on the idea to use the Freescale iMX23 processor, that was anyway present in the project for other needs, as an audio amplifier to pilot a small speaker with no special volume requirements.
Basically the output of a GSM module (audio out) was connected to the MIC input of the iMX23 and then the output to the speaker, just with little strictly needed passive electronics in between. As by the datasheet the processor should be able to pull out till 1.9W at 4Ω and there were some interesting registers to play with, even if not documented so very clearly nor seemed to be used anyhow in the audio driver provided.
The software base used was the LTIB based BSP provided by Freescale, including their kernel patches for a 2.6.31 kernel.
Continue reading

Posted in Linux drivers, Linux embedded, Teaching Material | Tagged , , , , , , , | Leave a comment

pyargocat: Argo Navis Catalog manager in Python

 

pyargocat is a small simple Python script that can be used to program the catalogs of the  Argo Navis Digital Telescope Computer from a machine with a recent Python interpreter installed using the RS232 cable that you can either buy or easily construct yourself. pyargocat can manage, that is insert to the device, all three types of catalogs in the device (asteroids, comets and user defined objects), report the number of objects present, report available space and delete previously flashed catalogs. It can be used on any machine with a Python >= 2.7 installed and it has been tested on Linux and Windows machines.

The imported catalogs have to be in the standard format Argo Navis uses (please refeer to the Argo Navis manual for the details and for links to useful resources). As an example and as a possible useful addition for your advanced observing sessions you can download this sample file I created that I often use as a basis: fede-general.txt. (the file contains all the Abell planetaries, the complete ARP catalog of Peculiar galaxies, the Hickinson galaxy groups catalog, most of the PK Planetary Nebula catalog and a selection of particullar globular clusters such as the Palomars and Terzans). Also a comet database file is given as an example with the most interesting comet objects data at the time of writing: Comets.txt

Download: pyargocat-0.1.tar.gz.
Continue reading

Posted in Linux desktop, Science | Tagged , , , | 2 Comments

How to cross-compile under Linux

Recently I’ve been asked by a few people how to crosscompile programs/packages under Linux. This happened especially after the article on customizing the DGN2200v3 (you can find here) but also for work reasons. In this article I’ll try to give some insights on this operation that is often feared, but is generally not a very hard task (yes I said generally: try for example crosscompiling something like the openjdk and you’ll understand what I mean!). This article will try to be generic but with some more examples on the DGN2200v3 crosscompilation and some ARM references.

 

Get and install the right tools

The first thing to do if of course to install on the system you are working (which is called host system) the tools that run on the host and will permit you to compile something for the target system you want to compile the programs for.
This set of programming tools is usually refeered as a toolchain and contains various things: usually one or a few compilers, one or a few linkers, an assembler, various header files, little or a lot of libraries and other simillar tools. If you are lucky you may get also a debugger packed. All this tools of course are compiled to run on your host machine but produce binaries that run on the target. Depending on how the toolchain was created you may also find supplied with it some set of tools that are ready to be run on the target to help your crosscompilation adventure.
This operation may be very easy if you somehow received the crosscompiler package ready (as for example the DGN2200v3 you just download it from the Netgear site or you collegue may have passed it to you) as you just have to unpack it somewhere and then refeer to it.
Continue reading

Posted in Linux desktop, Linux drivers, Linux embedded | Tagged , , , , , , , | 2 Comments

Customizing your Netgear DGN2200v3

The Netgear DGN2200v3 is a nice low cost Wireless (802.11b/g/n) ADSL2+ router that can be quite easily found. It is a nice piece of hardware and features some interesting features, such an USB host port to connect and share a USB storage device, and expecially is easily customizable for users interested in having a powerfull generic device running a Linux embedded operating system.

Note: this is a heavily “Work in Progress”  page so please check it out here and there if you are interested in the topic! (last update 06th June 2013)

First of all you can find the source tree for the router at Netgear site starting from their GPL Open Source Code for Programmers page. The package also contains a suitable toolchain uclibc-crosstools-gcc-4.4.2-1. Everything described in this page refeers to the “official” firmware V1.1.00.10_1.00.10 . It may also apply to future updates and to the beta version that Netgear started to distribute but it may require slight modifications.

 

The next step to access to your router internals is to enable the telnet shell using the debug backdoor present in the firmware. It is easily done by accessing (we suppose 10.0.1.69 is your router IP address) the URL: http://10.0.1.69/setup.cgi?todo=debug This will enable telnet connections from your local network. Just login with your administrator credentials.

Once you entered you can analyze the running system, briefly:
Continue reading

Posted in Linux desktop, Linux embedded | Tagged , , , , , , , , , , , | 61 Comments

Android on OpenRD, part 1

Android on OpenRD

Android on OpenRD

This is the first article about porting Android 4.0.x AKA Ice Cream Sandwich AKA ICS on the OpenRD Client. This is a pretty powerful ARM machine (1.2 Ghz  256 KB L2 cache, 512 MB RAM and Gigabit Ethernet) with a PCIe Xgi graphics chip. The goal is having a good hacking machine, so the system will be brought up via NFS root (perhaps in a future part everything will be put on the internal NAND or a SD card, it should not be difficult).

Prerequisites

The standard U-boot provided with the OpenRD is used to boot the system. The environment of the boot-loader has to be set-up to start mainline kernel, as outlined on the Debian on the OpenRD page. The Android kernel and users-pace will be loaded via the network (the IP and paths refer to my development environment):

setenv bootargs 'console=ttyS0,115200 root=/dev/nfs
 ip=10.0.10.187:10.0.10.57:10.0.10.57:255.255.255.0:openrd:eth0:off
 nfsroot=10.0.10.253:/mnt/fat/armroots/icsrd,tcp,nolock
 init=/init rw'
tftpboot 0x00800000 openrd-android ; bootm 0x00800000

The Linux Kernel

After some research for a Linux kernel with appropriate Androidism I choose to start with the kernel published by Freescale on their Open Source git repository. I had good results with their kernel on i.MX28 and i.MX53 based machines. The patch for the OpenRD are based on the imx_2.6.38_android branch, tag imx-android-r12. ICS is based on Linux 3.0 kernel but I haven’t seen big problems using this version (just some warning about missing some IP connection tracking statistics in the sysfs file-system). You can download my latest patch for supporting the OpenRD board and the .config file I used. This patch:
Continue reading

Posted in Android | Tagged , , , | 1 Comment

Cool Language Compiler Example – Compilers courses

coolc is a limited class use COOL (Classroom Object Oriented Language) compiler written in C using LEX and YACC. coolc will perform an almost complete static type-check on the given file and generate the intermediate code in a three-address language for a limited subset of the COOL constructs. The three-address code will then be interpreted by the built-in interpreter and the output displayed to the user.

coolc doesn’t fully support all the COOL language constructs. coolc main features are centered around the developing of the dispatch construct of COOL:
ID.ID():void

Therefore, briefly, coolc is able to handle:
- definition of classes without inheritance
- definition of attributes of various types in classes
- definition of methods in classes
- definition of dispatching methods in methods body without parameters and without a return value
Continue reading

Posted in Teaching Material | Tagged , , , | Leave a comment