ush.it - a beautiful place

Products

October 1, 2005 at 9:05 pm - 1716 words, reading time ~5 minutes

Eliad

An old script coded by ascii and rhapsody in php, c and perl to automate the download of porn images from known sources.

Un vecchio script programmato da ascii e rhapsody in php, c e perl per scaricare automaticamente immagini pornografiche da sorgenti conosciute.

fortune2mysql

Convert a directory containing fortune files (items are separated by a %) into relational database tables.

Converte una directory contenente file fortune (le frasi sono separate da %) in tabelle mysql.

fortune2pdf

fortune2pdf is a small fortune converter from flat file to a mysql database. fortune2pdf is an offline tool and will create the database once, also the program itself is able to add new flat files using incremental insert.

fortune2pdf e' un piccolo convertitore dei file "fortune" in formato mysql. fortune2pdf e' un tool offline e viene fatto girare una sola volta per ottenere il database, inoltre riconosce se sono stati aggiunti file nella directory dati ed eventualmente aggiunge i nuovi contenuti.

For fast review

http://www_ush_it/team/ascii/web-fortune/
http://www_ush_it/team/ascii/web-fortune/index.phps

Only the structure

http://www_ush_it/team/ascii/web-fortune/fortune_structure.sql

The whole db

These dump are structure + 2 fortune packages (fortune-it-1.99 and fortune-mod-9708). Naturally the tgz is smaller, please save my bandwith : )

http://www_ush_it/team/ascii/web-fortune/fortune.sql
http://www_ush_it/team/ascii/web-fortune/fortune.tgz

Kazzy

Kazzy is a general purpose software to convert a pass phrase to an arbitrary number of integers. This is extremely useful when implementing port knocking script for example.

Last version: 0.1 (download here)

Code: http://www_ush_it/team/ush/web-kazzy/kazzy_0.1.py
Released: 2007-08-21

Kazzy is written in python and ported to perl, php, c and sh for maximum portability.

Kazzy is developed by rampo and ascii.

Quality testing

For a software of this type it's important to generate the same output on every system, regardless it's endianess, interpreter version and architecture. To

Python testcase
curl http://www_ush_it/team/ush/web-kazzy/kazzy_0.1.py -A "Firefox" > kazzy_0.1.py && chmod +x kazzy_0.1.py && ./kazzy_0.1.py && uname -a && python -V && head -n1 kazzy_0.1.py

Linux XXX 2.6.18-hardened-r6XXX #1 PREEMPT Sat Apr 7 06:36:08 CEST 2007 i686 Intel(R) Celeron(R) M processor 1.50GHz GenuineIntel GNU/Linux
Python 2.4.4
#!/usr/bin/python

OpenBSD XXX 4.1 GENERIC#1435 i386
Python 2.4.4
#!/usr/local/bin/python2.4

Ucolorcode

Ucolorcode is an highlight_file() replacement for that hosts than run with PHP_SAFE_MODE On.

function color_code($file){
 if (file_exists($file)) {
  $read = fopen ($file, "r");
  while (!feof ($read)) echo str_replace("\n", "<br />", highlight_string (fgets($read, 1024*4), TRUE));
  fclose ($read);
 } else return FALSE;
}

phplog

phplog e' una piccola funzione che permette di emulare il lavoro di CustomLog di apache. Spontanea la domanda: "E allora cosa me ne faccio?". Semplicemente potresti trovarti su un server su cui non sei root ed in mancanza di access_log (anche se personalmente preferisco access.log) o surrogati. phplog supporta i formati di log common e combined e ti permette di customizzare in maniera indolore la sintassi grazie a variabili predefinite che devi solamente richiamare (per approfondimenti si faccia riferimento alla tabella 1 Log Format).

Last version: 0.1 (download here)

Code: http://www_ush_it/team/ascii/web-phplog/phplog-0.1.phps Released: 2005-11-23 Md5: http://www_ush_it/team/ascii/web-phplog/phplog-0.1.md5 Sha1: http://www_ush_it/team/ascii/web-phplog/phplog-0.1.sha Crc32: http://www_ush_it/team/ascii/web-phplog/phplog-0.1.crc

Utilizzo

1) Posiziona lo script online chiamandolo phplog.php (puoi chiamarlo come vuoi ma l'esempio seguente e' fatto per phplog.php). 2) Includi in seguente codice php nelle pagine che vuoi monitorare. // log using phplog (www_ush_it) include_once 'phplog.php'; phplog(); Nota1: Nel caso in cui ci sia una pagina php che include le altre inserire questo codice solamente nella pagina principale (non accade nulla di catastrofico se ci si sbaglia: la richiesta viene loggata piu' volte). Nota2: Puoi prelevare la funzione dal file e metterla all'interno del file che ti e' piu' congeniale, rispettando i termini di licenza. Nota3: Tieni sempre in considerazione dove si trova phplog.php quando lo includi.

Utilizzo in Wordpress

In aggiornamento.

Limitazioni

Nota che phplog non e' in grado di loggare query che ottengano un HTTP_CODE diverso da 200 (query eseguita con successo) dato che apache non passa queste richieste all'interprete php. Puoi comunque loggare queste query utilizzando la direttiva di apache ErrorDocument in un .htaccess. Di seguito forniamo un workround: .htaccess ErrorDocument 404 /error404.php error404.php < ?php // log using phplog (www_ush_it) include_once 'wp-content/php/phplog.php'; phplog('404'); ?> Ovviamente in questo, ed altri modi, potere tenere traccia di tutti gli errori e visualizzare all'utente una pagina gradevole alla vista che lo avverte dell'inconveniente appena avvenuto.

Table 1 Log Format

$h REMOTE_ADDR $l LOOKUP we will never support identd lookups $u REMOTE_USER $t TIMESTAMP $r REQUEST_METHOD REQUEST_URI SERVER_PROTOCOL $s HTTP_CODE $b SIZE we wan't support this (but you can use OB for this) $R HTTP_REFERER $A HTTP_USER_AGENT

Table 2 Apache vs phplog comparison

apache LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined phplog $LogFormat = "$h $l $u $t \"$r\" $s $b"; // common format $LogFormat = "$h $l $u $t \"$r\" $s $b \"$R\" \"$A\""; // combined format

MyOpenVPN

Italiano: MyOpenVPN e' un modulo per OpenVpn scritto in C che implementa l'autenticazione (username e password) con basedati su MySQL.

English: MyOpenVPN is an OpenVpn module (using native plugin interface) written in C that implements user and password authentication using MySQL.

C Sources

MyOpenVpn.tar.gz (current version)
MyOpenVpn.zip (current version)

TGZ/ZIP Contents

build       - Script used to compile the module
dump.sql    - The MySQL table
myopenvpn.c - The module itself
readme.txt  - A readme file
note.txt    - The above file in italian

How to compile

# unzip myopenvpn.zip
# cd myopenvpn

Now modify myopenvpn.c with the correct MySQL data (aka username, password, ip/hostname of the MySQL server).

# ./build myopenvpn
# mysql -u $user -p < dump.sql

Configuration example

dev tap
tls-server
mode server
lport 5500

; Certs
ca /etc/openvpn/cert/ca.crt # certificate authority
cert /etc/openvpn/cert/server.crt # server certificate
key /etc/openvpn/cert/server.key # server key
dh /etc/openvpn/cert/dh1024.pem # diffie hellman parameters
tls-auth /etc/openvpn/cert/ta.key 0 # TLS authentication

; Module loading
plugin /etc/openvpn/myopenvpn.so
client-cert-not-required
username-as-common-name # enable user/password authentication

; IP Entry
ifconfig 172.16.2.1 255.255.255.0 # ip address of the serber
ifconfig-pool 172.16.2.2 172.16.2.20 255.255.255.0 # ip addresses pushed by the internal dhcp server
push "route-gateway 172.16.2.1" # push the default gateway
push "redirect-gateway" # substitute the old client gateway
push "dhcp-option DNS 172.16.2.1" # push DNS nameserver

; Keepalive
push "ping 10"
push "ping-restart 60"
ping 10
ping-restart 120

; Logging
status /etc/openvpn/status.log
log /etc/openvpn/openvpn.log
verb 4 # verbosity level

Maintainers

Maintained by Giuseppe `lan` Marocchio and Francesco `ascii` Ongaro, copyright USH team 2005-2006 (http://www_ush_it), freeware for personal use, mail us at commerciale AT ush DOT it commercial applications.

Magic commands

tcpdump -ennr 2002.4.31 | awk '{print $2"\t"$6"\t"$3"\t"$8}' | tr -d "," | sed s/":$"//g > mac2ip.txt

Gives you a mac2ip conversion table sniffing local ethernet traffic.

THP USH Wisec DigitalBullets