Creando una base de datos en Mysql

December 14, 2007

Creando una base de datos para un cms via consola:

primero creamos la base de datos:

mysql> create database cms;
Query OK, 1 row affected (0.10 sec)

ahora le damos permisos y creamos el usuario y contrasea:

mysql> grant all on cms.* to usuario identified by ‘password’;
Query OK, 0 rows affected (0.00 sec)

confirmamos nuestras bases de datos:

mysql> SHOW DATABASES;
+———-+
| Database |
+———-+
| cms |
| mysql |
| test |
+———-+
3 rows in set (0.00 sec)

listo ahora ya tenemos nuestra base de datos para nuestro cms )


Sysadmin

December 13, 2007


Sysadmin ;)


dd if=/dev/zero of=/dev/hda

December 6, 2007

Wipe out your hard disk from a command line:

dd if=/dev/zero of=/dev/hda


Backup Script

November 25, 2007

#!/bin/sh
# Backup all files under home directory to a single # floppy
# Display message with option to cancel
dialog –title “Backup” –msgbox “Time for backup \ of home directory. \
Insert formatted 3-1/2\” floppy and press \ to start backup or \
to cancel.” 10 50
# Return status of non-zero indicates cancel
if [ “$?” != “0″ ]
then
dialog –title “Backup” –msgbox “Backup was \ canceled at your
request.” 10 50
else
dialog –title “Backup” –infobox “Backup in \ process…” 10 50
cd ~
# Backup using tar; redirect any errors to a
# temporary file
# For multi-disk support, you can use the
# -M option to tar
tar -czf /dev/fd1 . >|/tmp/ERRORS$$ 2>&1
# zero status indicates backup was successful
if [ “$?” = “0″ ]
then
dialog –title “Backup” –msgbox “Backup \
completed successfully.” 10 50
# Mark script with current date and time
touch ~/.backup
else
# Backup failed, display error log
dialog –title “Backup” –msgbox “Backup failed \ — Press

to see error log.” 10 50
dialog –title “Error Log” –textbox /tmp/ERRORS$$ 22 72
fi
fi
rm -f /tmp/ERRORS$$
clear
To run this automatically, I put these lines in my .profile file to call the backup script on login if more than 3 days has elapsed since the last backup was made:

# do a backup if enough time has elapsed
find ~/.backup -mtime +3 -exec ~/.backup \;


Script para Descargar los 6 discos Centos 5

November 25, 2007

#!/bin/bash

#Author: Jamil De Jesus Enríquez Deceano
#Date: Saturday 24 November 2007
#License: GPL

cd /home/kukako
for ((i=1; i< =6; i++))
do
echo “BEGIN DOWNLOAD DISCO $i CENTOS 5″
echo
wget -d -r -c http://altruistic.lbl.gov/mirrors/centos/5.0/isos/i386/CentOS-5.0-i386-bin-”$i”of6.iso
done
echo “Finish download Centos 5 completed !!!”
exit 0


Installing pkgsrc Solaris 10

November 21, 2007

Requirements
Softwares

*
cvs (I used the sunfreeware’s package)

Packages

*
SUNWgccruntime
*
SUNWgcc
*
SUNWhea
*
SUNWgzip
*
SUNWbinutils
*
SUNWsprot
*
SUNWarc
*
SUNWbtool
*
SUNWtoo
*
SUNWscpr
*
SUNWscpu
*
SUNWxcu4
*
SUNWlibmr
*
SUNWlibm
*
SUNWxwinc

I recommand to use softpartitions for both /usr/pkg and /usr/pkgsrc
Get pkgsrc
Via CVS

# export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot
# export CVS_RSH=ssh
# cd /usr
# cvs checkout -P pkgsrc

Installation
Bootstraping
GCC

# export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin
# echo CC=gcc > /etc/mk.conf
# cd /usr/pkgsrc/bootstrap
# ./bootstrap

Sun Studio

# export PATH=/opt/SUNWspro/bin:$PATH
# echo CC=cc > /etc/mk.conf
# echo PKGSRC_COMPILER=sunpro >> /etc/mk.conf
# export CC=cc
# cd /usr/pkgsrc/bootstrap
# ./bootstrap

Usage
Settings

# export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin

Sample

# cd /usr/pkgsrc/pkgtools/pkgfind
# bmake install

Targets
Target Description
show-depends-dir Show dependencies
show-options Show available options for the current port
mk.conf
UID/GID

APACHE_USER=webservd
APACHE_GROUP=webservd
SQUID_USER=webservd
SQUID_GROUP=webservd
MAILMAN_MAILGROUP=nobody

Specify an option for a specific package

PKG_OPTIONS.squid=ssl opt2
PKG_OPTIONS.postfix=pcre sasl tls bdb

Apache stuff

PKG_APACHE=apache2
PKG_PHP=php4

Notes

*
Take a look in /usr/pkgsrc/mk/platform/SunOS.mk for variables you can override with /etc/mk.conf
*
Some packages won’t build in solaris, butt few of them can be easily repaired
*
If you have trouble to build a package, try to set PKG_DEBUG_LEVEL to 1

Troubleshootings
Python

If you have the following error :

Objects/complexobject.c: In function `complex_pow’:
Objects/complexobject.c:469: error: invalid operands to binary ==
Objects/complexobject.c:469: error: wrong type argument to unary minus
Objects/complexobject.c:469: error: invalid operands to binary ==
Objects/complexobject.c:469: error: wrong type argument to unary minus

edit the file ./work/Python-2.3.5/Include/pyport.h, search for

#define Py_HUGE_VAL HUGE_VAL

set it to

#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE
#endif

The following Makefile patch is also available, but didn’t work here :

+.if ${OPSYS} == “SunOS” && ${CC} == “gcc”
+#workaround for bug with Solaris/gcc : __builtin_huge_val is a func. in that
case, but not declare as in Solaris header.
+CONFIGURE_ARGS+= OPT=”${CFLAGS} -D\”Py_HUGE_VAL=__builtin_huge_val()\””
+.else
CONFIGURE_ARGS+= OPT=”${CFLAGS}”
+.endif

netpbm

Makefile.patch

28a29,30
>
>
55a58,61
>
> .if ${OPSYS} == “SunOS” && ${OS_VERSION} == “5.10″
> CFLAGS+= -ansi -D__EXTENSIONS__
> .endif

# cd /usr/pkgsrc/graphics/netpbm
# patch Makefile < Makefile.patch

libtool

If you have strange segfault with libtool, try to change the shebang (the first line) of /usr/pkg/bin/libtool from

#! /bin/ksh

to

#! /usr/bin/bash

libstdc++.la

Use the following to replace libstcd++.la file :

/usr/sfw/lib/libstdc++.la

# libstdc++.la – a libtool library file
# Generated by ltmain.sh – GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=’libstdc++.so.6′

# Names of this library.
library_names=’libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so’

# The name of the static archive.
old_library=’libstdc++.a’

# Libraries that this one depends upon.
dependency_libs=’-lc -lm -L/usr/sfw/lib -lgcc_s’

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=”
dlpreopen=”

# Directory that this library needs to be installed in:
libdir=’/usr/sfw/lib’

/usr/sfw/lib/64/libstdc++.la

# libstdc++.la – a libtool library file
# Generated by ltmain.sh – GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=’libstdc++.so.6′

# Names of this library.
library_names=’libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so’

# The name of the static archive.
old_library=’libstdc++.a’

# Libraries that this one depends upon.
dependency_libs=’-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s’

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=”
dlpreopen=”

# Directory that this library needs to be installed in:
libdir=’/usr/sfw/lib/64′

XML::Parser

This perl module require libexpat, which comes with both Solaris itself and pkgsrc. I don’t why, but if you build the module with the pkgsrc’s libexpat, an error occured while loading libexpat. So, you need to build XML::Parser with the Solaris’s libexpat.

*
Install SUNWsfwhea
*
Edit the following file /usr/pkgsrc/textproc/p5-XML-Parser/Makefile, in order to have something like :

[..]
.include “../../mk/bsd.pkg.mk”

.if ${OPSYS} == “SunOS” && ${OS_VERSION} == “5.10″
MAKE_PARAMS+= EXPATLIBPATH=/usr/sfw/lib
MAKE_PARAMS+= EXPATINCPATH=/usr/sfw/include
.else
MAKE_PARAMS+= EXPATLIBPATH=${BUILDLINK_PREFIX.expat}/lib
MAKE_PARAMS+= EXPATINCPATH=${BUILDLINK_PREFIX.expat}/include
.endif


Show network cards and mac adress Sun eeprom

November 16, 2007

ok>show-nets
ok>select network iface
ok>cd ctrl+y
ok>.properties


Resolucion de DNS en Solaris

November 16, 2007

Comandos para configurar resolucion DNS

etc#> cp nsswitch.dns nsswitch.conf
etc#> cat resolv.conf
nameserver 192.168.1.3
etc #>


Fatboy Slim – Bird of Prey

November 3, 2007

Comment posted by
at 11/4/2007 9:53:53 PM

gran canción de fatboy slim, hace mucho tiempo que buscaba esta canción pero no sabia como se llamaba, gracias dmesg,saludos


Exploit Mitigation Techniques by Theo de Raadt

October 31, 2007

Exploit Mitigation Techniques by Theo de Raadt