Monday, August 04, 2014

Piscu Negru - Piciorul Lespezi - Vârful Lespezi

Am adăugat un traseu nou în OpenStreetMap (va apărea odată cu actualizarea de miercuri la gis.modulo.ro) - este traseul marcat punct roșu care merge de la Piscu Negru pe Piciorul Lespezilor spre Vârful Lespezi. E un traseu lipsit de dificultăți, afară de diferența de nivel de 1300 de metri și poate de câinii de la stâna Lespezi.

Marcajul continuă după vârful Lespezi spre Șaua Lespezi (în direcția Podeanu) și până în șa, unde întâlnește marcajul bandă albastră e mai pretențios (urmează câteva brâne relativ expuse deasupra Căldării Berbecilor). Am citit prin diverse locuri că marcajul continuă înapoi spre Stâna Lespezi dar noi nu l-am urmat dincolo de șa (am mers în direcția opusă, spre Strunga Doamnei și Lacul Călțun).



Track GPS pe osm.org.

Friday, July 11, 2014

Bran - Valea Gaura - Scara - Poiana Ciubotea - Bran

Cu ocazia unei ture de recunoaștere pentru Maraton 7500 pe Bran - Valea Gaura - Scara - Ciubotea - Bran am înregistrat track GPS și am făcut poze cu o parte din indicatoarele de pe traseu.

Am încărcat track-ul în format GPX pe openstreemap și am definit în gis.modulo.ro două trasee care lipseau, Stâna Gaura - Poiana Guțanu (triunghi albastru) și Șimon - Valea Șimon - Stâna Gaura (triunghi galben).


Indicator la intersecția traseelor Valea Gaura / Ciubotea:

Indicatoare la intrarea în Valea Gaura (Stâna Gaura):



Thursday, July 10, 2014

Avem un traseu nou în gis.modulo.ro zona Bucegi - Spre Lacul (lacurile) Vânturiș.

Track-ul GPS de pe OpenStreetMap merge din drumul de cotă la Poiana Stânii, apoi spre Cota 1400 pe bandă albastră și bandă roșie pe lângă schitul Sfânta Ana, urcă pe drumul de vară spre cota 2000 și urmeaza traseul marcat punct roșu pe lângă lacurile Vânturiș pâna la Cabana Valea Dorului.



De la Cabana Valea Dorului încolo track-ul nu mai urmărește marcaje - între Cota 2000 și 1400 coboară abrupt pe sub instalația de telescaun - în coborâre am făcut un soi de sprint ca antrenament pentru Marathon 7500.


Thursday, April 24, 2014

What process owns a certain window (Mac OS X)


This popped up on my screen, leaving me wondering which process actually drew the window:


It's the UserNotificationCenter app and here's how you can tell:

#!/usr/bin/env python

import time
from Quartz import CGWindowListCopyWindowInfo, kCGWindowListExcludeDesktopElements, kCGNullWindowID
from Foundation import NSSet, NSMutableSet

wl1 = CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID)
print 'Move target window'
time.sleep(5)
wl2 = CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID)

w = NSMutableSet.setWithArray_(wl1)
w.minusSet_(NSSet.setWithArray_(wl2))
print '\nList of windows that moved:'
print w
print '\n'

The script prints information for the window that changed position within a 5 second interval.
The output looks like this:

List of windows that moved:
{(
        {
        kCGWindowAlpha = 1;
        kCGWindowBounds =         {
            Height = 217;
            Width = 420;
            X = 828;
            Y = 213;
        };
        kCGWindowIsOnscreen = 1;
        kCGWindowLayer = 8;
        kCGWindowMemoryUsage = 406420;
        kCGWindowName = "";
        kCGWindowNumber = 77;
        kCGWindowOwnerName = UserNotificationCenter;
        kCGWindowOwnerPID = 481;
        kCGWindowSharingState = 1;
        kCGWindowStoreType = 2;
    }
)}

Wednesday, February 05, 2014

Volatility on Mac OS X 10.9.1


The Volatility Framework


Quoting from the volatility home page: "The Volatility Framework is a completely open collection of tools, implemented in Python under the GNU General Public License, for the extraction of digital artifacts from volatile memory (RAM) samples."

Or put more simply, you collect a memory dump from a system and Volatility helps you investigate what was running on the machine at the time of the memory dump.

You can get a list of processes or a list of open files that is computed on a clean system so it's not subject to a potentially-rootkit-replaced /bin/ps or /usr/sbin/lsof.

There are many other useful built in commands and the framework works on Mac, Linux and Windows.


Very basic usage


I used OSXPmem to get a memory dump:
$ sudo ./osxpmem -f raw /tmp/memory.dump

Once you get the dump (which is fairly slow as you're dumping your entire physical memory to disk) you can get a list of running processes:
$ sudo python vol.py -i /tmp/memory.dump -o ps
Password:
[+] Process List
OFFSET(P)     PID  PPID PRIORITY NICE     PROCESS_NAME        USERNAME(UID,GID) CRED(UID,GID)      CREATE_TIME (UTC+0) 
0x150FBCC0      0     0        0    0      kernel_task                    (0,0)         (0,0) Tue Dec 17 11:36:22 2013 
0x15593A80      1     0      128    0          launchd      _securityagent(0,0)         (0,0) Tue Dec 17 11:36:22 2013 
0x155947E0     11     1      255    0   UserEventAgent                root(0,0)         (0,0) Tue Dec 17 11:37:20 2013 

or look up the kernel syscall table:
$  sudo python vol.py -i /tmp/memory.dump -o systab
[+] Syscall List
NUM ARG_COUNT                            NAME           CALL_PTR    ARG_MUNGE32_PTR ARG_MUNGE64_PTR RET_TYPE ARG_BYTES HOOK_FINDER
0           0                          _nosys 0xFFFFFF8014DEF270         0x00000000      0x00000000        1         0 True
1           1                           _exit 0xFFFFFF8014DCBE50 0xFFFFFF8014BBBD30      0x00000000        0         4 True
2           0                           _fork 0xFFFFFF8014DD07E0         0x00000000      0x00000000        1         0 True
3           3                           _read 0xFFFFFF8014DEF2D0 0xFFFFFF8014BBBD60      0x00000000        6        12 True
4           3                          _write 0xFFFFFF8014DEF980 0xFFFFFF8014BBBD60      0x00000000        6        12 True



Friday, January 17, 2014

Mac OS X Mavericks MapKit notes


A few days ago when I opened Maverick's Maps.app and I had the curiosity to navigate to a mountainous region I was blown away. The satellite imagery provided by Apple's Maps.app is much better than Google Earth's, at least in the areas I'm interested in.

See below a same-area-comparison of Maps.app vs Google Earth; in the left hand side the cable car pillar is clearly seen whereas in the right hand side it's a total blur:

In Maps.app you can distinguish relatively small features, valleys and ridges in the 3D view, making Maps.app a possible tool to use when planning or remembering a hiking trip. If only there was a way to annotate the map with more than pins.

These here are my notes on trying to annotate Apple's Maps.app imagery with external data.

Using Maps.app with an external data source


The first thing I've tried was using Maps.app itself.
I haven't found any way to add external content (other than pins).

Which is sad, because the MapKit framework powering part of the app (there's also a private framework behind it, which as far as I can tell provides the data behind satellite imagery and vector data) makes it very easy to display tiles from an external provider.

I can only hope a future Maps.app version will offer some way of loading external content (e.g. Google Earth's NetworkLink or maybe exposing MapKit's capability to load external map tiles - see below).


Developing an application using MapKit


As Maps.app was out of the question, I then summoned my Objective-C almost forgotten skills and tried the MapKit framework, freshly arrived in Mavericks from the iOS world.

While using XCode does not require an active (as in currently payed for) Apple developer account, using MapKit does (when a developer account is not active, MapKit will print a warning on the console and refuse to load any Apple provided data).

Once you have an active developer account, XCode requests a MapKit for you.
After the entitlement is approved (in my case it took a half an hour or so), MapKit starts displaying data.

Maps.app is 3D, MapKit is 2D


This is my biggest gripe with MapKit so far.

Maps.app has 3D data (it probably uses something similar to the SRTM dataset to build an elevation profile and warps imagery over the slopes computed based on the elevation grid).

MapKit does not have 3D data and all it offers in this regard is a pseudo-3D view based on tilting the camera. Even this pseudo-3D view is restricted to the standard map view (in satellite and hybrid modes tilting the camera does not work).

Lack of 3D makes MapKit pretty useless for me - the great appeal of MapKit was the good quality of satellite imagery in Romania's mountains but without 3D the imagery gets really hard to decipher as lack of altitude information makes valleys look like ridges and vice-versa.

Integrating OpenStreetMap tiles within a MapKit app


Apple's MapKit makes it very easy to load OpenStreetMap tiles in the MapKit views (pictured below are some tiles from our hiking web application overlaid on top of MapKit's hybrid view:


In 10 or so lines of code you can have tiles in your MapKit based map.

You add an overlay:
NSString *template = @"http://some.server/tiles/{z}/{x}/{y}.png";
MKTileOverlay * overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
[map addOverlay:overlay];

and in the map's delegate you create a renderer for it:
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView 
    rendererForOverlay:(id < MKOverlay >)overlay
{
    if([overlay isKindOfClass:[MKTileOverlay class]])
    {
        MKTileOverlayRenderer * r = [[MKTileOverlayRenderer alloc] initWithOverlay:overlay];
        return r;
    }
    return nil;
}

What about vectors?


Yes, you can add vectors (points, lines, polygons, custom shapes) as overlays on top of the MapKit view.

The problem is built in overlays are painfully basic.
Meaning I couldn't find a way to display a label (only a pin that displays something when clicked) or that the built in MKPolyline renderer does not display the MKPolyline's title (you have to write your own overlay renderer to do that).

Below is a screenshot of my MapKit test app, showing a couple of valleys in red (using the built in MKPolyline) and a few labels (implemented using a custom data overlay and renderer):


Conclusion


MapKit is a big help when trying to build a map application but don't kid yourself - building a proper mapping app takes a LOT of work.

I look forward to buying a MapKit based app that matches Google Earth's integration capabilities.

Thursday, January 16, 2014

Actualizări în Iezer


Mai jos poze cu indicatoarele de la cabana Cuca.

Timpii afișați pentru vârfurile Păpușa și Cascue sunt probabil greșiți (noi am făcut trei ore de la Cuca până pe Păpușa mergând în ritm normal).






Cu ocazia turei am actualizat zona pe OpenStreetMap și am adăugat vârfurile pentru care am avut date (Păpușa din datele GPS și restul (Oticu, Roșu, Piscanu, Cățunu, Văcarea, Bătrâna, Găinațul Mare, Țefeleica) pe baza profilelor de altitudine SRTM).

Interposing in Mavericks


Somewhere along Lion or Mountain Lion Apple switched from gcc to clang as the default compiler.
One of the things that clang does differently is it does not create a Mach DATA section for interposing.

Below is a screenshot of MachOView on dynamic libraries compiled by gcc and clang respectively (I've used the Mavericks gcc 4.9 binary downloaded from High Performance Computing).


I've no idea if clang can be instructed to create the DATA interpose section but if you need to use it in recent Mac OS X versions compiling with gcc still works.