Eliminar tildes con python [SOLUCIONADO]
Es muy probable que si programas en python te encuentres, alguna vez, con una situación en la que debes eliminar las tildes de algún texto.
Esto se puede hacer fácilmente utilizando el módulo unicodedata.
He creado la funcion elimina_tildes tal que asi:
1 2 3 4 5 6 7 | import unicodedata def elimina_tildes(s): return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')) # que se puede usar asi: >>> print elimina_tildes(u"córcholis") corcholis |
Espero que os resulte útil.
Más detalles en stackoverflow.com
vBulletin: change the redirect or the url in the login process
There is a common thing for vBulletin users to want to customize the login box.
This can be done by Admin CP -> Styles & Templates -> Style Manager -> « » -> Navigation / Breadcrumb Templates -> navbar (Note for spanish users: Buscar Plantillas de navegación entre las plantillas, y dentro de ella, navbar)
By default, vBulletin’s login forms redirect you back to the page you were viewing. You can define your own redirection URL by adding this hidden field to the login form:
<input type="hidden" name="url" value="REDIRECTION URL HERE" />
The code is inserted like follows (pay attention to last lines):
<!-- login form --> <!-- BLABLABLA a lot of html code here ... --> <input type="hidden" name="vb_login_md5password_utf" /> <input type="hidden" name="url" value="REDIRECTION URL HERE" /> </form> <!-- / login form -->
Notice you can also change the validation URL (for instance if you are having issues with non-www and www url’s, etc).
Rather than doing fancy-custom .htaccess to change URL from non-www to www you should change your vbulletin Forum URL following these steps:
- Close your board from the AdminCP
- Change the Forum URL to the new URL
AdminCP -> vBulletin Options -> Site Name / URL / Contact Details -> Forum URL
- Reset Cookie Path & Domain to default values:
AdminCP -> vBulletin Options -> Cookies and HTTP Header Options
Next Move all the files to the new directory on your server, and re-open board.
Drupal para tontos (II): urls amigables con pathauto, theming de Views, etc
Ayer os conté cómo crear content types complejos con el módulo noderefURL. Como ejemplo creamos fichas de personas con datos propios y galería de fotos relacionada. Nuestro ejemplo es muy mejorable, veamos por qué:
1. Mejorar la URL: si visitamos el nodo de ejemplo que creamos en el anterior post, veremos que la URL es similar a:
www.tusitio.com/node/14. Esta URL es poco descriptiva. Para mejorarla usaremos los módulos Token, Path (instalado por defecto en Drupal 6) y Pathauto
2. Crear una categoría de menú para mostrar un listado de fichas: hemos creado una ficha y la hemos visto. Pero… ¿cómo veremos un listado de todas las fichas? ¿Cómo se ordenará esta visualización? ¿y si queremos tener una visualización “especial” del listado de fichas? Para ello usaremos el módulo Views
3. Crear “subcategorías” de fichas basándonos, por ejemplo, en el género. ¿Cómo añadir esta información a las fichas? Para ello usaremos el Módulo Taxonomy (ya instalado en Drupal 6). Si deseas puedes consultar este estupendo manual de taxonomy para drupal.
Configurando pathauto y URL’s automáticas
Vamos a empezar instalando y activando todos los módulos enumerados anteriormente. A continuación vamos a ir a /admin/build/path/pathauto y desplegaremos los Node path settings. En esta sección, en Patter for all Ficha paths ponemos fichas/[titler-raw].
Para que nuestro nodo de ejemplo tenga una URL de este tipo deberemos editarlo, desplegar las ULR path settings y marcar Automatic alias. La URL del nodo será ahora del tipo /ficha/miguel-martín.
Si os fijáis, esta URL contiene una tilde. Como deseo eliminar las tildes de las URL’s, vuelvo a las opciones de pathauto y marco, en General Settings la opción Reduce strings to letters and numbers from ASCII-96.
Si deseo que funcionen tanto /ficha/miguel-martín como /ficha/miguel-martin deberé marcar, además, en las Update action de General Settings, la opción Create a new alias. Leave the existing alias functioning.
Si ya tenía muchos nodos creados sin asignar url’s, puedo marcar la opción Bulk generate aliases for nodes that are not aliased y se generarán de forma automática estas URL’s. ¿No es genial?
Creando un listado de “Fichas” usando Views
Ahora vamos a jugar con el módulo Views para que al insertar la url /ficha nos liste todos los nodos de este tipo. Veamos cómo (si queréis leerlo en inglés, podéis hacerlo en este excelente tutorial).
Empezamos yendo al menú de Views (/admin/build/views) y pulsamos Add. Nos solicita varios datos (ver siguiente imagen):
Pulsamos Next.
Lo próximo que vamos a hacer es añadir campos (Add Fields) sobre qué deseamos mostrar. En mi caso marco:
* Content-foto (field_foto) [OJO! Cuando lo añadas, la última opción es "FORMAT" y debe tener seleccionado Image para que la imagen se muestre como tal ]
* Node: Link
* Node: Path
* Node: Title
Y pulso “add”.
Ahora tengo que añadir un FILTRO (Filter) para que esta vista sólo me muestre los nodos que me interesann.
* Filtro por Node Type == ‘ficha’. (elegimos en el filtro la opción Node: Type)
A continuación hay que crear un Display para esta vista. Puede ser tanto una página, como un bloque, como un feed. En mi caso crearé una página (Page), pero perfectamente podría ser un bloque. Los matices entre página, bloque, feed, etc, los podéis leer en el manual del módulo Views.
Bien, pulsamos en Add Display. Veremos que en la parte inferior aparece la opción de darle un Path. Pulsamos sobre None y en el campo que aparece la URL, insertamos la palabra ‘ficha’. Se han marcado los pasos en la siguiente imagen (click para ampliarla):
Además, si nos fijamos, aparece la consulta (query) mysql que genera esta vista. En mi caso la consulta es:
SELECT node.nid AS nid, node_data_field_foto.field_foto_fid AS node_data_field_foto_field_foto_fid, node_data_field_foto.field_foto_list AS node_data_field_foto_field_foto_list, node_data_field_foto.field_foto_data AS node_data_field_foto_field_foto_data, node_data_field_foto.delta AS node_data_field_foto_delta, node.type AS node_type, node.vid AS node_vid, node.title AS node_title FROM drup_node node LEFT JOIN drup_content_field_foto node_data_field_foto ON node.vid = node_data_field_foto.vid WHERE node.type in ('ficha')
También aparece una previsualización (preview) de cómo se ve el resultado de la ficha:

Dando estilo a los Page Display’s creados con Views usando el módulo Theme Developer
Ya hemos creado nuestra nueva vista. Veamos qué aspecto tiene:
Si os fijáis, en la parte inferior derecha aparece una ventanita negra (Drupal Themer Information), que forma parte del paquete Theme Developer. Este paquete resulta de mucha utilidad cuando estamos creando temas. Nos dice qué fichero está produciendo esa salida (en este caso, es el views-view-fields.tpl.php).
A continuación vamos a personalizar ese fichero. Deseamos personalizarlo SOLO para esta vista, y no para las demás. Por tanto deberemos crear un NUEVO fichero para darle el estilo que deseemos a nuestro listado de fichas. Sin embargo, aun nos queda una duda: ¿cómo nombrar a ese nuevo fichero?
Entre los nombres propuestos por Drupal en esta View para las Row style output elijo views-view-fields–listafichas–page-1.tpl.php y pulso Rescan Template Files. Aparecerá en negrita el nuevo fichero usado para formatear la vista:
Para empezar es bueno que se muestren los valores de los fields “en bruto” (el vector) y asi a partir de ahí ir jugando. Para ello, prueba el siguiente código (presta atención a las últimas líneas):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <?php // $Id: views-view-fields.tpl.php,v 1.6 2008/09/24 22:48:21 merlinofchaos Exp $ /** * @file views-view-fields.tpl.php * Default simple view template to all the fields as a row. * * - $view: The view in use. * - $fields: an array of $field objects. Each one contains: * - $field->content: The output of the field. * - $field->raw: The raw data for the field, if it exists. This is NOT output safe. * - $field->class: The safe class id to use. * - $field->handler: The Views field handler object controlling this field. Do not use * var_export to dump this object, as it can't handle the recursion. * - $field->inline: Whether or not the field should be inline. * - $field->inline_html: either div or span based on the above flag. * - $field->separator: an optional separator that may appear before a field. * - $row: The raw result object from the query, with all data it fetched. * * @ingroup views_templates */ ?> <?php foreach ($fields as $id => $field): ?> <?php if (!empty($field->separator)): ?> <?php print $field->separator; ?> <?php endif; ?> <<?php print $field->inline_html;?> class="views-field-<?php print $field->class; ?>"> <?php if ($field->label): ?> <label class="views-label-<?php print $field->class; ?>"> <?php print $field->label; ?>: </label> <?php endif; ?> <?php // $field->element_type is either SPAN or DIV depending upon whether or not // the field is a 'block' element type or 'inline' element type. ?> <<?php print $field->element_type; ?> class="field-content"><?php print $field->content; ?></<?php print $field->element_type; ?>> </<?php print $field->inline_html;?>> <?php endforeach; ?> <?php //print print_r(array_keys(get_defined_vars()), 1); //print print_r(array_keys($fields)) // O si tienes instalado el módulo developer, usa la función dpm o dprint_r: echo "<br />".dpm($fields);."<br />"; |
Esta función dsm nos crea una caja amarilla con la información de las variables (fields) que podemos usar:
Por ejemplo podemos acceder a la variable field_foto_fid, que es la que contiene la “imagen de perfil” de la ficha con:
print "<pre>".print_r($fields['field_foto_fid']->content)."
“;
¡A partir de este punto las posibilidades son ilimitadas!
En vez de escribir un rollo enorme, podéis ver este completo screencast sobre theming con views.
Drupal para tontos: crear un nuevo Content Type COMPUESTO para galería fotográfica
Hoy os voy a explicar cómo crear nuevos Content Types complejos. ¿Para qué sirve esto? Imagina que quieres hacer “fichas” de usuarios, que contengan, por ejemplo:
- Fotografía de perfil
- URL de su página web
- Texto
- Galería de fotos asociada
Queremos llegar a algo parecido a:

Imagina, además, que la galería se actualiza muy a menudo, pero no el resto de campos. O que quieres dar al usuario la opción de modificar las fotos de su galería, pero no el resto de campos. O quieres que un usuario tenga la opción de tener varias galerías, y ya tienes un Content Type galería que te gustaría seguir usando. O muchísimos otros casos donde queremos gestionar por separado unos datos del nodo de otros.
Una opción muy interesante para solventar este problema es crear Content Types complejos (con datos propios al nodo y “punteros” que “apuntan” a nodos de otro tipo).
Módulos necesarios
Para realizar los pasos que vienen a continuación es necesario tener instalados los siguientes módulos en Drupal. El orden en que los pongo es el orden en que los instalé yo (si no tienes ni idea, aqui puedes ver cómo instalar un módulo drupal):
- CCK: Para poder crear Custom Content Types
- FileField, ImageAPI, ImageField e ImageCache.
- NodeReferenceURL: módulo para crear referencias entre nodos.
- Gallery Assist: un módulo que implementa galerías de fotos. He instalado Gallery Assist, Gallery Assist ImageCache, Gallery Assist Lightboxes. En este sitio web se explica con un screencast cómo instalar todo esto.
Una vez instalados todos los módulos deberemos activarlos (/admin/build/modules).
Proceso de configuración
Ya tenemos instalados, activados y en funcionamiento nuestros módulos. Ahora hay que crear el nuevo Content Type (/admin/content/types/). En mi caso, hay dos tipos de nodos que intervienen:
1) Nodo “ficha”, que contendrá como propios los campos: url, cuerpo, foto y como puntero (node reference) la galería de fotos en cuestión.

2) Nodo tipo “gallery” (contiene la galería de fotos en sí misma). Este Content Type se crea de forma automática al instalar Gallery Assist.
A la hora de crear el nodo “ficha”, los Custom Fields quedan asi (click para ampliar la imagen):

En Manage Fields vemos el campo url (Type: text, Name: field_url), el campo foto (Type: File, Name: field_foto) y el campo galleria_fotos (Type: Node reference, Name: field_noderefgalleryassist).
Cuando creé este último campo, tuve que elegir el widget usado durante la creación del nodo. Hay varias opciones para este campo. Yo marco ‘select list’. A continuación una pequeña explicación (en inglés) sobre qué diferencias hay entre cada opción:

Select list
if you don’t have too many nodes to choose from, this can be a great choice; the user can see all of her choices at once and make a decision on which node to reference;
Check boxes/radio buttons
if you need to refer to multiple nodes at once, checkboxes can help; and/or if the list of possibilities is even smaller than needed for a select list (5 to 9 at most), then radio buttons may be your choice;
Autocomplete
this widget works very similar to a freetagging taxonomy selector or the Authored by: field at the bottom of a node form; you start typing, and Drupal will display a list of node titles that match the text you entered; you often only need to type a few letters to find exactly what you need, however, this requires the user to have some idea of what she is looking for; you also have the option to choose whether to search inside the node’s titles, or only at the beginning;
También deberé seleccionar el “tipo de contenidos que pueden ser referenciados” (Content types that can be referenced) y elijo “gallery”. El menú que nos permite realizar esta selección es similar a:

En Display Fields del tipo de nodo “ficha” (admin/content/node-type/ficha/display), prestemos especial atención al Field galleria_fotos, en especial al parámetro Full node, que debe tener seleccionado Teaser. Esto hace que nuestra galería G1 se muestre completa en la “Ficha” F1 con la que guarda relación. Más información sobre esto en el manual de theming complex data drupal.
Creando nodos de ejemplo de tipo “ficha” y “gallery”
A continuación vamos a crear un nuevo nodo “Ficha” con una “gallery” asociada. Para ello primero creo la “gallery”, subo las fotos y guardo el nodo. Después creo una nueva “Ficha”, relleno los campos y selecciono de la lista de opciones la galería que deso enlazar a esta “ficha”.
Dándole estilo
Si habéis seguido los consejos hasta este punto, y no teneis customizada la plantilla de mostrar nodos, veréis algo asi:

Sí, sale, pero no como queremos. Por ello voy a crear dos plantillas personalizadas (custom templates) para mostrar los contenidos como yo deseo, una para la “ficha” y otra para la “gallery”.
* Plantilla para la galería: en /themes/garland/node-gallery_assist.tpl.php con el siguiente contenido:
1 2 3 4 5 6 | <?php // $Id: node.tpl.php,v 1.5 2007/10/11 09:51:29 goba Exp $ ?> <div class="content clear-block"> <?php print $content ?> </div> |
* Plantilla para la ficha: en /themes/garland/node-ficha.tpl.php con el siguiente contenido:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php // $Id: node-ficha.tpl.php,v 1.0 2010/07/05 08:39:36 miguelm Exp $ ?> <?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?> <div id="maincontainer" style="margin-left: 50px;"> <br /> <!-- para poner algo en la zona superior <div id="topsection"> <div class="innertube"><h1>CSS Liquid Layout #2.1- (Fixed-Fluid)</h1></div> </div>--> <div id="contentwrapper" style="float: left; width: 100%;"> <div id="contentcolumn" style="margin-left: 200px; > <div class="innertube" style="margin:10px"> <?php /* para mostrar el cuerpo del nodo */ echo $node->content['body']['#value']; ?> </div> </div> </div> <div id="leftcolumn" style="float: left; width: 200px; margin-left: -100%; font-size:"> <div class="innertube"> <?php /* para mostrar la imagen del campo field_foto */echo theme('imagefield_image', $node->field_foto[0], "", "", array('width' => '200'), $getsize = FALSE); ?> <br /> <?php /* para mostrar la URL */ echo l(t('Visita la web de '.$title), $node->field_url[0]['safe'], array('class' => 'active'));?> </div> </div> </div> <?php echo $node->field_noderefgalleryassist[0]['view']; ?> |
Ahora, si recargamos el nodo de la Ficha, veremos que queda como nosotros queríamos:

Espero que os haya sido útil
CSS Layout examples
Usually I find myself answering to questions like “how do I set up a two column layout with fixed/fluid width?” and so on.
Well, for all of you who have issues with layouts, take a look at dynamicdrive.com.
For instance, here you can find several CSS configurations for two column layouts”.
[Errno 13] Permission denied: ‘/root/.python-eggs’ [SOLVED]
A few days ago I had to install MySQLdb. The installation is quite simple:
# tar -xzvf MySQL-python-1.2.2.tar.gz # cd MySQL-python-1.2.2 # python setup.py build # python setup.py install
But then I checked a page which had to use this python module (MySQLdb) and… oops, it did not work:
Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python <b>egg cache</b>: [Errno 13] Permission denied: '/root/.python-eggs' The Python egg cache directory is currently set to: /root/.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory.
The problem was obviously that apache user did not have rights to write into /root/.python-eggs so the page crashed. A simple export of that variable pointing to a directory into which apache user can write will do the trick *temporarily*
# export PYTHON_EGG_CACHE=/var/www/.python-eggs/But I wanted this variable to be *permanently* set to that dir… so I thought a “SetEnv” in apache configuration would do the job. But it did not.
Two different fixes
1) Assuming your test server runs newer Invenio with mod_wsgi, you can try http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonEggs
or its equivalent for mod_python.
2) Otherwise you can always install Python modules uncompressed, for mod_wsgi or mod_python, then the egg decompression would not be needed upon runtime, so no problem with privileges. If packages such as MySQLdb were installed as Python eggs, and the directory setup is done so that Apache user cannot decompress them upon Apache startup, an error like the one shown above is usually seen.
This can be solved by simply installing the problematic module uncompressed:
$ cd /Library/Python/2.3/site-packages/ (or /usr/lib64/python2.4/site-packages/ or wherever your site-packages are) $ file MySQL_python-1.2.2-py2.3-macosx-10.4-i386.egg $ unzip -t MySQL_python-1.2.2-py2.3-macosx-10.4-i386.egg $ mv MySQL_python-1.2.2-py2.3-macosx-10.4-i386.egg foo.zip $ mkdir MySQL_python-1.2.2-py2.3-macosx-10.4-i386.egg $ cd MySQL_python-1.2.2-py2.3-macosx-10.4-i386.egg/ $ unzip ../foo.zip $ rm ../foo.zip
Working nice and smoooth
Utilizando ECLIPSE para programar python en entorno git
A modo de chuleta, una vez más, os pongo los pasos necesarios para trabajar con Eclipse, EGit y PyDev.
1. Instalar Eclipse Classic.
2. Iniciar Eclipse, y deberías ver una pantalla similar a:

3. Instalar PyDev desde Eclipse. Para ello, en la pantalla anterior, pulsa sobre la flecha de la derecha. Aparecerá una pantalla de este tipo:

A continuación ve al menú Help -> Install new software.

Selecciona “Add” y añade la siguiente URL en el campo “Location”:
http://pydev.org/updates

Selecciona la opción “PyDev for Eclipse”. No selecciones la opción “PyDev Mylyn Integration”. Solo queda pulsar “siguiente, siguiente, siguiente” y reiniciar eclipse.
4. Configurar PyDev desde Eclipse:
Ve al menú “window -> preferences”, expande “PyDev” y selecciona “Python Interpreter”. Deberías ver algo asi:

Debes añadir un nuevo intérprete, indicando la ruta donde tienes instalado python:


Selecciona todos MENOS el PySrc y python31.zip. Pulsa ok tantas veces como sea necesario y termina el proceso. Ya estás listo para programar en python usando eclipse.
5. Instalar EGit desde Eclipse
El proceso para instalar egit es muy similar al descrito en el paso 3, simplemente usa la siguiente url en el campo “location”:
http://download.eclipse.org/egit/updates
6. Escribiendo tu primer programa python:
Ve al menú “Window > Open Perspective > Other…” y elige “Pydev”, entonces haz click en ‘ok’. Si te fijas en la esquina superior derecha verás que la perspectiva ha cambiado de “java” a “pydev”


7. Creando un proyecto nuevo:
Ve a “File > New > Pydev Project” para empezar un asistente.
En la siguiente pantalla, introduce el nombre del proyecto y selecciona como tipo “python 3.0″. Asegúrate de que las opciones “create default ‘src’ folder” y “add it to the pythonpath?” están seleccionadas. Haz click en Finish.


8. Creando un módulo nuevo:
“File → New → Pydev Module”

Si miras en el “Package Explorer” verás un icono con tu nuevo fichero dentro de la carpeta ‘src’ (carpeta que creó Eclipse cuando hiciste el proyecto en el paso anterior).

9. Ejecución de tu primer programa:
Vamos a hacer un “hello world” en python. Para ello simplemente escribe print(‘Hello, World!’) en tu fichero. Guárdalo (ctrl+S) y para ejecutarlo, simplemente ve a “run as > python run”:

10. Añadir tus ficheros a repositorio GIT:
Seleccionado el proyecto que deseamos añadir, pulsamos botón derecho y “Team -> Share Project”

Marcamos la opción GIT y pulsamos “next”:

Seleccionamos el proyecto a añadir y pulsamos Create para crear el nuevo repositorio GIT:

A continuación pulsamos “Finish”:

El proyecto está marcado ahora con el texto “[MASTER]“, que indica que los ficheros pertenecen a la rama principal del repositorio GIT. Los interrogantes al lado de algunos archivos (en la imagen los archivos .classpath y .project) indican que esos archivos no pertecen aun al repositorio git:

Para hacer que pertenezcan (y se cambie el interrogante por un signo “+”) debemos trackear el proyecto. Para ello seleccionamos el proyecto, botón derecho, “Team > Track”

Es muy probable que tengamos ficheros que NO deseemos que se añadan al track. Para ello creamos un fichero llamado .gitignore e introducimos aquéllos ficheros que NO deseamos que pertenezcan. Imaginemos que todos ellos estan en una carpeta llamada ignoredfolder. Pues en el fichero .gitignore escribiremos ignoredfolder. A continuación añadimos .gitignore al control de versiones.
Podemos añadir exclusiones más generales (por ejemplo si nuestra configuración de una BD, nombres de usuarios y passwords estan en un fichero llamado .settings en todos nuestros proyectos, o queremos excluir todos los ficheros .zip) podemos utilizar el menu: Preferences > Team > IgnoredResources

Ahora debemos hacer un commit de los cambios. Para ello Team > Commit:

Debes insertar un mensajes explicando tus cambios. La primera linea (separada por una linea en blanco) se convertirá en el “short log” para este commit. Por defecto el autor y el committer se cogen del fichero .gitconfig de tu directorio home del proyecto. Puedes, además, marcar “Add Signed-off-by” para añadir un tag Signed-off-by. Al enviar cambios de otros autores puede ser conveniente alterar el campo autor para insertar los datos de nombre y mail del autor. Pulsa commit para enviar los cambios.

Ahora han cambiado los “+” que aparecían al lado de los archivos por otro icono:

Para mostrar el HISTORIAL de un fichero, puedes pulsar botón derecho y luego “Team > Show Local History”:

Esto es lo básico. Podéis leer mucho más en los enlaces de abajo
___________
Más información sobre pydev y eclipse (en inglés) en http://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-python-configuration.htm.
Más información sobre egit para eclipse (en inglés) en http://wiki.eclipse.org/EGit
Burp suite, foxy proxyand mod_rewrite
Currently I am attending a workshop on Designing Secure Wep Apps and there I learned about Burp suite and Foxy proxy (standard).
What is Burp Suite?
Burp Suite is an integrated platform for attacking web applications. It contains all of the Burp tools with numerous interfaces between them designed to facilitate and speed up the process of attacking an application. All tools share the same robust framework for handling HTTP requests, persistence, authentication, upstream proxies, logging, alerting and extensibility.
Burp Suite allows you to combine manual and automated techniques to enumerate, analyse, scan, attack and exploit web applications. The various Burp tools work together effectively to share information and allow findings identified within one tool to form the basis of an attack using another.
Key features unique to Burp Suite include:
* Detailed analysis and rendering of requests and responses.
* One-click transfer of interesting requests between tools.
* Site map showing information accumulated about target applications in tree and table form.
* Ability to “passively” spider an application in a non-intrusive manner, with all requests originating from the user’s browser.
* Suite-level target scope configuration, driving numerous individual tool actions.
* Fully fledged web vulnerability scanner. [Pro version only]
* Ability to save and restore state. [Pro version only]
* FIPS-compliant statistical analysis of session token randomness.
* Utilities for decoding and comparing application data.
* A range of engagement tools, to make your work faster and more effective. [Pro version only]
* Suite-wide search function. [Pro version only]
* Support for custom client and server SSL certificates.
* Extensibility via the IBurpExtender interface.
* Centrally configured settings for upstream proxies, web and proxy authentication, and logging.
* Tools can run in a single tabbed window, or be detached in individual windows.
* Runs in both Linux and Windows.
What is Foxy Proxy?
FoxyProxy is a set of proxy management tools for Firefox, Thunderbird, Seamonkey, and Songbird. There are three editions available (basic, standard, plus). Both basic and standard are free. I use standard.
More coming next days!
Creando un repositorio GIT a partir de las fuentes
De cara al desarrollo de aplicaciones es muy interesante tener algún software de control de versiones, tipo Subversion o GIT.
Os comento a modo de “chuleta” cómo hacer esto desde las fuentes.
Para ello, algunas consideraciones preliminares:
Servidor y SO: Linux myserver.com 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Archivos de código: /soft/cds-invenio
Versión de GIT: git-1.6.6.2 (instalado desde las fuentes)
Asumo que la instalación de GIT es simple y podéis hacerla vosotros mismos sin ayuda. Hay muchísimos manuales indicando cómo hacerlo (usad google).
Una vez instalado GIT, procedemos:
# Creamos el archivo de configuracion del gitweb.... [root@aneto cds-invenio]#vi /etc/gitweb.conf # ---------------------------------------------------------------------------- # # gitweb.conf # # Configuration file for the web interface to GIT. # # This file is a Perl script that is executed by the gitweb interface # after the defaults are set. To override a setting, just uncomment # it here and set it to the appropriate value. # # Core git executable to use. # This can just be "git" if your webserver has a sensible PATH. #our $GIT = "/path/to/git"; # Absolute fs-path which will be prepended to the project path. # This is where your GIT repositories live in. # ESTA VARIABLE ES FUNDAMENTAL!!! our $projectroot = "/soft/git"; # Target of the home link on top of all pages. #our $home_link = $my_uri || "/"; # String of the home link on top of all pages. our $home_link_str = "view projects"; # Name of your site or organization to appear in page titles. # Replace this with something more descriptive for clearer bookmarks. #our $site_name = "" # Filename of HTML text to include at top of each page. # Must be an absolute filename (i.e., not relative to htdocs). #our $site_header = ""; # HTML text to include at home page. # Must be an absolute filename (i.e., not relative to htdocs). #our $home_text = "/gitweb/indextext.html"; # Filename of HTML text to include at bottom of each page. # Must be an absolute filename (i.e., not relative to htdocs). #our $site_footer = ""; # URI of the stylesheet to use. our $stylesheet = "/git/gitweb.css"; # URI of GIT logo (72x27 size). our $logo = "/git/git-logo.png"; # URI of GIT favicon, assumed to be image/png type. our $favicon = "/git/git-favicon.png"; # URI and label (title) of GIT logo link. #our $logo_url = "http://git.or.cz/"; #our $logo_label = "git homepage"; # Source of projects list. #our $projects_list = ""; # Show repository only if this file exists. # Only effective if this variable evaluates to true. #our $export_ok = ""; # Only allow viewing of repositories also shown on the overview page. #our $strict_export = ""; # List of git base URLs used for URL to where fetch project from, # i.e. full URL is "$git_base_url/$project" #our @git_base_url_list = grep { $_ ne '' } ("/some/url"); # --------------------------------------------------------------------------------
Entonces añadimos al archivo de configuración de Apache algunas líneas útiles (el directorio /var/www/cgi-git/gitweb y /var/www/html/git deben existir):
[root@aneto cds-invenio]# vi /etc/httpd/conf/httpd.conf # Añadir: Alias /gitweb "/var/www/cgi-bin/gitweb/" <Directory "/var/www/cgi-bin/gitweb"> Options Indexes FollowSymlinks ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> Alias /git "/var/www/html/git" <Directory "/var/www/html/git"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
Y procedemos a reinicar apache y crear el nuevo repositorio GIT…
[root@aneto cds-invenio]#/etc/init.d/httpd restart [root@aneto cds-invenio]# cd /soft/cds-invenio [root@aneto cds-invenio]# git init [root@aneto cds-invenio]# git add . [root@aneto cds-invenio]# git commit -m "inicialización del repositorio"
Una vez hecho esto, editamos algunos archivos de los que GIT ha creado (añadir información a ‘description’ y a ‘config’).
[root@aneto cds-invenio]# vi /soft/cds-invenio/description [root@aneto cds-invenio]# vi /soft/cds-invenio/config -------------------------------------------------------- [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true worktree = /soft/cds-invenio owner = "Miguel Martin"
A continuación clonamos sólo los datos de GIT en un fichero .git:
[root@aneto cds-invenio]# cd /soft/cds-invenio/ [root@aneto cds-invenio]# git clone --bare cdsinvenio cdsinvenio.git
Podemos probar a cargar en nuestro servidor esta url: http://myserver.com/cgi-bin/gitweb.cgi y ver si aparece algo… Puede que se produzcan fallos con gitweb.js si está en el directorio /cgi-bin/gitweb… si es el caso podemos editar gitweb.cgi y modificar la RUTA al gitweb.js.
# Editamos el gitweb.cgi porque hay fallos en el JS: [root@aneto cds-invenio]# vi /var/www/cgi-bin/gitweb/gitweb.cgi # URI of stylesheets our @stylesheets = ("/var/www/cgi-bin/gitweb/gitweb.css"); # URI of a single stylesheet, which can be overridden in GITWEB_CONFIG. our $stylesheet = undef; # URI of GIT logo (72x27 size) our $logo = "/var/www/cgi-bin/gitweb/git-logo.png"; # URI of GIT favicon, assumed to be image/png type our $favicon = "/var/www/cgi-bin/gitweb/git-favicon.png"; # URI of gitweb.js (JavaScript code for gitweb) our $javascript = "/git/gitweb.js"; # URI and label (title) of GIT logo link #our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/"; #our $logo_label = "git documentation"; our $logo_url = "http://git-scm.com/"; our $logo_label = "git homepage";
Y ahora copiamos el js a su lugar…
#Copiamos el Js a /var/www/html/git cp /var/www/cgi-bin/gitweb.js /var/www/html/git/
# Hacemos un PUSH de todo…
[root@aneto teresa]# git push –all /soft/git/cdsinvenio.git
Y voilá! Nuestro repositorio git con todo accesible desde http://myserver.com/cgi-bin/gitweb.git
Algunos enlaces interesantes…
link 1 (en)
link 2 (en)
link 3 (es)
link 4 (es)
vBA news module customization (avoid topic links display)
A client’s vBulletin board uses vbadvaced news module to display posts from a hidden forum. Every post is wrapped with adv_portal_module_wrapper.
My client did not want the topic links to be displayed, so he asked me to hack the code to achieve this.
Change adv_portal_module_wrapper
The adv_portal_module_wrapper you will find in you ACP —> style manager —> in the drop down for which ever style your working on pick edit templates —> vbadvanced cmps templates —> adv_portal_module_wrapper (should be located halfway down in the list of templates)
However you might want to copy that template and make a new one in case you need the default, you can add one by ACP —> style manager —> the add template. copy and paste your adv_portal_module_wrapper contents in for a starting point.
The following is the original code of adv_portal_module_wrapper:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | $mods[formcode]
<div style="padding-bottom:$vba_style[portal_vspace]px">
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat" colspan="$mods[colspan]">
<if condition="$vba_style['portal_collapsemods']">
<a href="#top" onclick="return toggle_collapse('module_$mods[collapse]')" style="float:$stylevar[right]"><img alt="" border="0" id="collapseimg_module_$mods[collapse]" src="$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif" /></a>
</if>
<span class="smallfont"><strong>$vba_style[portal_blockbullet] <if condition="$mods['link']"><a href="$mods[link]">$mods[title]</a><else />$mods[title]</if></strong></span></td>
</tr>
</thead>
<tbody id="collapseobj_module_$mods[collapse]" style="$modcollapse">
<if condition="$show['tablerow']">
<tr>
<td class="$bgclass">
$modulehtml
</td>
</tr>
<else />
$modulehtml
</if>
</tbody>
</table>
</div>
<if condition="$show['endform']"></form></if> |
I noticed the links where being created with the $mods[title] (refer to line 11). So where is this variable defined? Thanks to grep linux command I found out where it was assigned a value:
/includes/vba_cmps_include_top.php
/modules/news.php
In /modules/news.php there is this line, which gave me the clue on how to solve this issue
$mods['title'] = ($news['prefix'] ? $news['prefix'] : '') . ' <a href="' . $vbulletin->options['bburl'] . '/showthread.php?' . $vbulletin->session->vars['sessionurl'] . 't=' . $news['threadid'] . '">' . $news['title'] . '</a>';
So I thought I’d change the $mods['title'] call in adv_portal_module_wrapper to $news['title'], so my resulting copy of adv_portal_module_wrapper is called adv_portal_module_wrapper_miguel and is like follows (the only thing changed is line 11):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | $mods[formcode]
<!-- adv_portal_module_wrapper_miguel -->
<div style="padding-bottom:$vba_style[portal_vspace]px">
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat" colspan="$mods[colspan]">
<if condition="$vba_style['portal_collapsemods']">
<a href="#top" onclick="return toggle_collapse('module_$mods[collapse]')" style="float:$stylevar[right]"><img alt="" border="0" id="collapseimg_module_$mods[collapse]" src="$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif" /></a>
</if>
<span class="smallfont"><strong>$vba_style[portal_blockbullet] $news[title]</strong></span></td>
</tr>
</thead>
<tbody id="collapseobj_module_$mods[collapse]" style="$modcollapse">
<if condition="$show['tablerow']">
<tr>
<td class="$bgclass">
$modulehtml
</td>
</tr>
<else />
$modulehtml
</if>
</tbody>
</table>
</div>
<if condition="$show['endform']"></form></if> |










