Obteniendo las bases de datos de concejales

Me enteré por javibc de que hay un portal del ministerio de haciendo con los datos de los concejales de toda españa disponibles [ http://ssweb.mpt.es/portalEELL/consulta_alcaldes ] (hay que entrar dos veces, una para que dea la cookie y la siguiente ya deja pasar :P), después no pocos dolores de cabeza ahí va el parser y la base de datos. [ cargos.zip ]

Nota: Hay información en #Freesoftwareando, de hecho al principio los parsers usaban su base de datos de municipios pero ahora generan otra para evitar salirse de las librerías estándar de python.

Para parsearlas de nuevo, primero hay que preparar y lanzar get_provincias.py, para ponerlo a punto hay que editar las cookies (línea 20) con las que la web te haya asignado, al lanzar el script este preparará una base de datos con los municipios de cada provincia.

El siguiente paso es preparar el , de nuevo hay que editar las cookies (línea 8) y esta vez además ajustar el csrf_token (línea 128) que se puede encontrar en la página buscando esto:

Obtaining the spanish town concilor database

I found out via javibc that there's a treasury department portal with data about all spanish town concilors [ http://ssweb.mpt.es/portalEELL/consulta_alcaldes ] (you have to enter twice, first to get the cookie and get redirected to the homepage and a second to access the form :P), and after several headcaches here it is the parser and the database. [ cargos.zip ]

Note: There's a ton of information at #Freesoftwareando, in fact at the beggining the parsers used his municipalities database but now they generate another one to avoid use something outside the standard python libraries.

To parse it again, first we have to prepare and launch get_provincias.py, make it ready the cookie string have to be edited (line 20) to fit the ones the web has assigned you, after launching the script it'll prepare a database with the municipalities and each and the provinces.

The next step is to prepare

Catálogo de lenguajes de programación

A la vista de que al menos en HxC el problema de con que lenguaje de programación comenzar es algo recurrente, me he decidido a hacer una recopilación de mini programas en distintos lenguajes para que quien comience pueda encontrar facilmente uno que se acerce a su forma de ver las soluciones de los problemas (personalmente creo que es un buen criterio para escojer un primer lenguaje).

Para no quedarse en los 4 de siempre me he tomado la libertad en escojer unos cuantos lenguajes que no suelen tener tanta visibilidad (sin ser tipo brainf*ck), he intentado también ser todo lo imparcial posible pero como humano que soy eso no es algo que suela salir bien ;).

Por ahora contiene alrededor de 30 lenguajes, pero solo un código de cada uno, así que aún queda mucho por andar, los códigos serían:

All your buckets are belong to us: DOSeando PHP a través de arrays asociativos

Hace unas horas andaba yo pasando el rato por /r/programming cuando me encontré con un post sobre la posibilidad y las consecuencias de forzar externamente colisiones dentro de los arrays asociativos de PHP, es algo tan... ¿abrumador? que hay que probarlo para ver el peligro que representa, veamoslo.

Nota: El día 28 de este mes hubo en el 28C3 una charla que tiene mucho, ¡todo! que ver con esto, es muy recomendable hecharle un vistazo, enormemente interesante.

El peligro se agrava por una combinación de varios factores que PHP agrupa:

  • Se puede adivinar de forma trivial el hash de un entero, el mismo.

  • Hay algunos arrays donde el usuario tiene total poder para crear a su antojo: $_GET, $_POST y $_COOKIE.

Imaginad si lanzamos contra un servidor unas cuantas peticiones con un poco de mala leche, como puede ser un poco engorroso hacerlo a mano, he aqui un script para facilitar la tarea prueba_hashmap_php.py... no es bonito, no es elegante, pero tampoco lo pretende.

All your buckets are belong to us: DOSsing PHP through associative arrays

Some hours ago I was reading /r/programming when I found a post about the posibility and consecuences of externally forcing colisions inside the associative arrays in PHP, it's something so... ¿overwhelming? you have to try it to see the danger it represents, let's go.

Note: The day 28 of this month took a place a_lecture which has a lot, everything! in relation with this in 28C3, it's very interesting.

The danger gets worse because a combination of factors which PHP groups:

  • The hash of an integer can be trivially guessed, the number itself.

  • There are some arrays the user can create at will: $_GET, $_POST y $_COOKIE.

Now imagine what whould happen if we launch a few malicious queries agaist a server, it can be a little tiresome to do it by hand, so there a script to do it prueba_hashmap_php.py... it's not pretty, it's not elengant, but it's not intended to either.

Link compilation

Now I'm too busy to work on the blog, here you have some links that could be interesting, just looking at the link it's possible to expect what awaits behind it.

Recopilación de links

Ya que ando medio escapado, ahí van unos cuantos enlaces que pueden resultar interesantes, ya por el nombre se intuye lo que hay detrás.

Writting a brainf*ck parser with BLK

At last! at this time BLK can compile a reasonable C subset... well, ok, it needs pointers and structures in order to have something decent, but the former are picky to simulate in a interpreter, and the structures are in the way. The important thing is that the general structure is more or less stable, even inside the prototyping branch, a consecuence is that is open to any participation :), so let's see an example of how to write a little brainf*ck parser.

The first thing we'll do is to import the bytecode manager and prepare a constant to hold the memory size, in this case it will be a static

1
2
3
from bytecode_manager import *

MEM_SIZE = 1024

The parser will be encapsulated in a class with the following scheme

1
2
3
4
5
class BrainfuckParser:

    code = "" # Unparsed code
    _bytecode_manager = None # Bytecode manager
    global_frame = None # The global function

Now comes the class intializer function, it receives the bytecode manager as the only parameter

1
2

Blogueando en tres idiomas|Blogging in three languages|Blogueando en tres idiomas

Desde ahora intentaré escribir el blog en 3 lenguages: castellano, inglés y gallego.

El primero por que es el que vengo usando en él, y funciona bastante bien, inglés por ser la lingua franca en estos temas, y el gallego porque hecho en falta un blog sobre computación en ese idioma,.

Este post ya está en los tres lenguajes (de hecho es sobretodo una excusa para poder probar el plugin :P).

From now on, I'll try to write the blog in 3 languages: spanish, english and galician. The first one because is in which the blog was already being written, and working pretty well, english for being the lingua franca in technology, and galician because I miss a computing blog in that language.

This post is already written in the three languages(the fact is that it's above all an excuse to test the plugin :P).

Desde agora intentarei escribi-lo blogue en 3 linguaxes: castelán, inglés e galego.

De permisos de directorios [unix]

Andaba yo leyendo cierto post [ http://blog.jgc.org/2009/01/single-line- assignment-filled-with-epic.html ] cuando, sin previo aviso descubrí la respuesta a una pregunta que me llevo haciendo meses sinó años, ¿como @#$% hacen para que algunos directorios los pueda listar cualquiera y otros no?... ¿y para acceder?
[...]  It also removes execute permission. In the UNIX world
execute permission on a directory means that you can CD into it; with
it removed the directory cannot be accessed (i.e. you can't get a
list of the files in the directory). [...]

Así que resulta que con los directorios las cosas funcionan así:

* x: Acceso al directorio

* r: Leer los contenidos del directorio
*
* w: Crear/eliminar archivos
*

Newer posts Older posts