alexmontoanelli

a place to have some fun..

Trick: listando todos os comandos de uma IOS Cisco

Dica básica pra saber todos os comandos de uma IOS Cisco, útil quando sabemos oque queremos mas não sabemos onde encontrar, dá pra combinar com pipes para filtrar.

Exemplos:

#lista todas as configurações do opção router-map
Router#show parser dump route-map
#lista todas as opcoes do menu interface filtrando por ospf
show parser dump interface | include ospf

Abraços

January 25th, 2010 by alexm

Mapeando e usando as teclas múltimidias no linux

Tento instalado os utilitários xev e xmodmap, execute o comando abaixo no console, e aperte as teclas múltimida do seu teclado em sequência.

A saída do comando abaixo será o código da tecla.

xev | sed -n 's/^.*keycode *\([0-9]\+\).*$/keycode \1 = /p'

Após pressionar as teclas, temos seus respectivos códigos e então podemos mapea-las no linux criando um arquivo com a seguinte estrutura:

keycode 144 = F13
keycode 145 = F14

lembre-se de trocar o keycode, no caso 144, pelo resultado obtido ao pressionar as suas teclas múltimidia. Note que o f13, f14 é simbólico.

Após isso salve o arquivo em um local de fácil acesso por exemplo: ~/.xmodmap e execute:

xmodmap ~/.xmodmap

Agora no kde, abra o útilitário ‘keyboard and mouse’ no System Settings, e em Standard e Global Keyboard Shortcuts, você pode definir as ações para suas novas teclas mapeadas.

Abraço

January 16th, 2010 by alexm

Configurando o ‘scroll’ no touchpad com Linux

Abaixo a configuração do xorg.conf para que o touchpad funcione com o recurso de scroll no linux.

Para utilizar, espera-se que touchpad já esta funcionando e paara rolar as páginas, basta deslizar
o dedo na vertical, no lado direito do touch!

Depois de alterado o /etc/X11/xorg.conf, basta reiniciar o X.

Section "InputDevice"
                Identifier "touchpad"
                Driver "synaptics"
                Option "SHMConfig" "true"
                Option         "SendCoreEvents"
                Option         "Protocol" "auto-dev"
                Option      "Device" "/dev/input/mouse2"
                Option  "TouchpadOff" "0"
                Option  "RTCornerButton" "3"
                Option  "LTCornerButton" "2"
                Option  "TapButton1"    "1"
EndSection

Até!

December 17th, 2009 by alexm

Laboratório Cisco Online

Que tal usar equipamentos Cisco de ponta e de verdade, para simular algumas situações de rede, sem ter
que apelar para um emulador?

É oque propõe a equipe do Packetlife. Um lab como  o da foto abaixo é disponibilizado após você agendar um horário,
onde terá acesso a todos os equipamentos por ssh ou telnet durante o período escolhido.

A parceira é a Netgear que fornece um ‘Console Server’ para acessos aos equipamentos.

A proposta é bastante interessante e vale a pena conferir.

Marquei meu horário na sexta as 12h, depois posto os resultados.

Abraços e bons estudos.

lab_topology_ethernet

December 8th, 2009 by alexm
Posted in outros | 1 Comment »

Configurando redes WPA no Linux

Abaixo segue roteiro básico para você conseguir autenticar em uma rede usando criptografia WPA/WPA2.
Os passos são baseados na distribuição Gentoo, e espera-se que você já tenha sua placa wifi instalada e operacional.

1: instale o pacote wpa_supplicant:  emerge wpa_supplicant
2: edite/crie o arquivo de configuração /etc/wpa_supplicant/wpa_supplicant.conf, com a seguite configuração:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1

network={
 ssid="SSID_DA_REDE"
 psk="CHAVE_PSK_DA_REDE"
 pairwise=TKIP
}

3: edite o arquivo /etc/conf.d/net e adicione o seguinte:

modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext" # For generic wireless
config_wlan0=( "null" )

4: agora crie o script de inicialização: ln -sf /etc/init.d/net.lo /etc/init.d/net.wlan05

5: inicie a rede com /etc/init.d/net.wlan0 start

Existe tambem uma interface gui, que pode ser chamada pelo comando wpa_gui.

Abraços

November 8th, 2009 by alexm
Posted in linux | 1 Comment »

ZendFramework – Usando parâmentros nas Actions

Para quem usa o ZendFramework, em modo MVC, sabe que o modo para pegar uma váriavel  passada por GET/POST/COOKIE, deve ser realizada através dos métodos: getRequest()->getParam(‘nome_da_variavel’), do objeto Zend_Coontroller_Action.

Abaixo mostro uma implementação, que extende a classe Zend_Action para que seja usado os parâmentros no corpo da função.

Hoje você utiliza da seguinte forma:

<?php
class IndexController extends Zend_Controller_Action {

public function indexAction(){

//obterá o parâmentro GET/POST teste
 echo $this->getRequest()->getParam('teste');

}

}

A nova forma será:

<?php
class IndexController extends My_Action {

public function indexAction(string $teste){

//obterá o parâmentro GET/POST teste
 echo $teste;

}

}

Abaixo a classe My_Action.

Abraços

—————

<?php                                                                                                                                  
/**                                                                                                                                    
 * Map request parameters to action method                                                                                             
 * @author Albert Varaksin                                                                                                             
 * @licence public domain                                                                                                              
 */                                                                                                                                    
class My_Action extends Zend_Controller_Action                                                                           
{                                                                                                                                      
 /**                                                                                                                                
 * Dispatch the requested action                                                                                                   
 *                                                                                                                                 
 * @param string $action Method name of action                                                                                     
 * @return void                                                                                                                    
 */                                                                                                                                
 public function dispatch($action)                                                                                                  
 {                                                                                                                                  
 // Notify helpers of action preDispatch state                                                                                  
 $this->_helper->notifyPreDispatch();                                                                                           

 $this->preDispatch();
 if ($this->getRequest()->isDispatched()) {
 if (null === $this->_classMethods) {  
 $this->_classMethods = get_class_methods($this);
 }                                                   

 // preDispatch() didn't change the action, so we can continue
 if ($this->getInvokeArg('useCaseSensitiveActions')
|| in_array($action, $this->_classMethods)) {
 if ($this->getInvokeArg('useCaseSensitiveActions')) {                                       
 trigger_error('Using case sensitive actions without word separators is deprecated;
please do not rely on this "feature"');
 }                                                                                                                             

 $reflMethod = new Zend_Reflection_Method($this, $action);                                                                     
 $actionParams = $reflMethod->getParameters();                                                                                 
 $requestParams = $this->_request->getParams();                                                                                
 $args = array ();                                                                                                             
 foreach ($actionParams as $param)
 {
 // get parameter type
 if (($reflClass = $param->getClass()) instanceof Zend_Reflection_Class) {
 $type = $reflClass->getName();
 } else if ($param->isArray()) {
 $type = 'array';
 } else {
 $type = $param->getType();
 }

 // get passed parameter
 $name = $param->getName();
 if (isset($requestParams[$name])) {
 $value = $requestParams[$name];
 } else if ($param->isDefaultValueAvailable()) {
 $value = $param->getDefaultValue();
 $type = '';
 } else {
 $docBlock = $reflMethod->getDocblock();
 if (($tagRefl = $docBlock->getTag("require_$name"))
instanceof Zend_Reflection_Docblock_Tag) {
 $tryClass = trim($tagRefl->getDescription());
 if (class_exists($tryClass, true))
 throw new $tryClass("Missing value for argument $name");
 else
 throw new Zend_Controller_Action_Exception("Missing value for argument $name");
 }
 $value = null;
 }

 // fix value type
 $basicTypes = array(
 'int', 'integer', 'bool', 'boolean',
 'string', 'array', 'object',
 'double', 'float'
 );
 if (in_array($type, $basicTypes)) settype($value, $type);
 else if (strlen($type) && class_exists($type, true)) $value = new $type($value);

 $args[] = $value;
 }
 // dispatch the action
 call_user_func_array(array($this, $action), $args);
 } else {
 $this->__call($action, array());
 }
 $this->postDispatch();
 }

 // whats actually important here is that this action controller is
 // shutting down, regardless of dispatching; notify the helpers of this
 // state
 $this->_helper->notifyPostDispatch();
 }
}
October 17th, 2009 by alexm

[VideoSet] DJ RicaTelles ClipMix (2009) Vol02

[VideoSet] DJ RicaTelles ClipMix (2009) Vol02
## Este novo VideoSet soma alguns sucessos do Volume 1 + super lançamentos!!! ##

DJ_RicaTelles_ClipMix_2009_Vol02_[HouseSessions].mkv – 350MB
Este arquivo segue um novo padrão escolhido para este e os próximos releases do DJ RicaTelles, qual retrata o melhor custoXbenefício em Áudio e Vídeo para Internet da atualidade, denominado “.MKV” (Matroska); Outro fator adotado é o Set com time aproximado de 30 minutos e o tamanho do arquivo fixo de 350MB para facilitar os downloads.

Baixe agora mesmo o VideoSet Volume 2

emule http mp3

— DJ RicaTelles ClipMix 2009 Volume 2 [House Sessions] —
01 Voxis vs Dj Andi – To The Moon
02 David Deejay ft Dony – So Bizzare
03 Sander Van Doorn vs Robbie Williams – Close My Eyes
04 Edward Maya ft Vika Jigulina – Stereo Love
05 Akcent – That’s My Name
06 Morris – Desire
07 David Deejay ft Dony – Nasty Dream
08 Nick Kamarera ft Deepside Deejays – Beautiful Days
09 Bob Taylor ft Inna – Deja Vu
10 Inna – Love
11 Play and Win – Only
12 Fonzerelli – Dreamin

Abraços

September 22nd, 2009 by alexm
Posted in outros | 1 Comment »

Threads no PHP

Exemplo básico de utilização de threads no PHP

$pid = pcntl_fork();

if ($pid == -1) {

     die('Erro ao lançar thread');

} else if ($pid) {

     // thread principal
     //aguardamos a thread child terminar
     pcntl_wait($status); 

     echo "Processo child terminado\n";

     exit(0);

} else {

     //thread secundario
     //mudamos para um usuário não privilegiado
     posix_setuid(1000);
     posix_setgid(1000);

     //colocamos a thread para fazer algo,
     //ate que uma condição seja satisfeita e ela termine
	$i=0;
	while(true){	

           if (file_exists('/tmp/stop')){
		echo "Terminado thread";
		exit(0);
	   }

	   echo "Iteração : ". ++$i . "\n";
	   sleep(2);

	}

}

 

Mais informações aqui.

Abraços e até.

August 29th, 2009 by alexm
Posted in php | No Comments »

Squid Multiple Remote Denial of Service Vulnerabilities

Bugtraq ID:35812
Class:Unknown
CVE: CVE-2009-2621 – CVE-2009-2622
Remote:Yes
Local:No
Published: Jul 27 2009 12:00AM
Updated: Jul 28 2009 06:15PM

Credit: Alex Montoanelli of www.unetvale.net, Rob Middleton of Centenary Institute, Tuomo Untinen, Ossi Herrala, and Jukka Taimisto from the CROSS project at Codenomicon Ltd.

Vulnerable: Squid Web Proxy Cache 3.1 5,Squid Web Proxy Cache 3.1 4,Squid Webroxy Cache 3.0,Squid Web Proxy Cache 3.1.0.11,Squid Web Proxy Cache 3.1,
Squid Web Proxy Cache 3.0.STABLE7,Squid Web Proxy Cache 3.0.STABLE6,Squid Web Proxy Cache 3.0.STABLE5,Squid Web Proxy Cache 3.0.STABLE4,Squid Web Proxy Cache 3.0.STABLE3,Squid Web Proxy Cache 3.0.STABLE2,Squid Web Proxy Cache 3.0.STABLE16,Squid Web Proxy Cache 3.0.STABLE13,Squid Web Proxy Cache 3.0.STABLE12,Squid Web Proxy Cache 3.0.STABLE1,MandrakeSoft Linux Mandrake 2009.1 x86_64,MandrakeSoft Linux Mandrake 2009.1,MandrakeSoft Linux Mandrake 2009.0 x86_64,MandrakeSoft Linux Mandrake 2009.0,MandrakeSoft Linux Mandrake 2008.1 x86_64,MandrakeSoft Linux Mandrake 2008.1,Debian Linux 5.0 sparc,Debian Linux 5.0 s/390,Debian Linux 5.0 powerpc,Debian Linux 5.0 mipsel,Debian Linux 5.0 mips,Debian Linux 5.0 m68k,Debian Linux 5.0 ia-64,Debian Linux 5.0 ia-32,Debian Linux 5.0 hppa,
Debian Linux 5.0 armel,Debian Linux 5.0 arm,Debian Linux 5.0 amd64,Debian Linux 5.0 alpha,Debian Linux 5.0

Not Vulnerable: Squid Web Proxy Cache 3.1.0.12,Squid Web Proxy Cache 3.0.STABLE17

Reference: SecurityFocus

July 29th, 2009 by alexm
Posted in linux | No Comments »

IPP2P for Recent Kernels

After several hours of work on the code, here is a version that can be compiled
into a new kernel – 2.6.29 to be precise. No compatibility with older versions – sorry –.

http://alexm.unetvale.com.br/ipp2p-0.8.2_KERNEL_2.6.29_1.tar.gz

Later.

July 26th, 2009 by alexm
Posted in linux | 3 Comments »