elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Firma dinámica (Detección ip real y Sistema operativo) PHP
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Firma dinámica (Detección ip real y Sistema operativo) PHP  (Leído 2,485 veces)
el-brujo
ehn
***
Desconectado Desconectado

Mensajes: 21.588


La libertad no se suplica, se conquista


Ver Perfil WWW
Firma dinámica (Detección ip real y Sistema operativo) PHP
« en: 16 Mayo 2012, 11:40 am »

Código
  1. <?php
  2. #
  3. # file: JZOsig.php
  4. # author: AnimAlf
  5. #
  6. # This lines are under the GNU General Public License.
  7. # http://www.gnu.org/copyleft/gpl.html
  8. #
  9. # cph.keldenauto.com
  10. #
  11.  
  12. header( "Content-type: image/PNG" );
  13.  
  14. function RealIPget() {  
  15.  if ( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] != '' ) {
  16.    $client_ip =
  17.      ( !empty( $_SERVER['REMOTE_ADDR' ]) ) ?
  18.        $_SERVER[ 'REMOTE_ADDR' ]
  19.          :
  20.        ( ( !empty($_ENV[ 'REMOTE_ADDR' ]) ) ?
  21.        $_ENV[ 'REMOTE_ADDR' ]
  22.           :
  23.        "unknown" );  
  24.      // los proxys van añadiendo al final de esta cabecera
  25.      // las direcciones ip que van "ocultando". Para localizar la ip real
  26.      // del usuario se comienza a mirar por el principio hasta encontrar
  27.      // una dirección ip que no sea del rango privado. En caso de no
  28.      // encontrarse ninguna se toma como valor el REMOTE_ADDR
  29.      $entries = split( '[, ]' , $_SERVER [ 'HTTP_X_FORWARDED_FOR' ] );
  30.  
  31.      reset( $entries );
  32.      while ( list( , $entry ) = each( $entries ) )
  33.      {
  34.         $entry = trim( $entry );
  35.         if ( preg_match( "/^([0-9]+.[0-9]+.[0-9]+.[0-9]+)/", $entry, $ip_list ) )
  36.         {
  37.            // http://www.faqs.org/rfcs/rfc1918.html
  38.            $private_ip = array(
  39.                  '/^0./',
  40.                  '/^127.0.0.1/',
  41.                  '/^192.168..*/',
  42.                  '/^172.((1[6-9])|(2[0-9])|(3[0-1]))..*/',
  43.                  '/^10..*/');
  44.  
  45.            $found_ip = preg_replace ( $private_ip, $client_ip, $ip_list [ 1 ] );
  46.  
  47.            if ( $client_ip != $found_ip )
  48.            {
  49.               $client_ip = $found_ip;
  50.               break;
  51.            }
  52.         }
  53.      }
  54.   }
  55.   else
  56.   {
  57.      $client_ip =
  58.         ( !empty ( $_SERVER [ 'REMOTE_ADDR' ] ) ) ?
  59.            $_SERVER [ 'REMOTE_ADDR' ]
  60.            :
  61.            ( ( !empty ( $_ENV [ 'REMOTE_ADDR' ] ) ) ?
  62.               $_ENV [ 'REMOTE_ADDR' ]
  63.               :
  64.               "unknown" );
  65.   }
  66.   return $client_ip;  
  67. }
  68.  
  69. function DetectOs () {
  70.  if(eregi( "linux",$_SERVER [ 'HTTP_USER_AGENT' ])){
  71.    $rtnStr = "[GNU/Linux] Saludos a oOOoo TuXeR oOOoo";
  72.  } elseif ( eregi ( "win32", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  73.      eregi ( "Win 9x 4.90", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  74.      eregi ( "windows 2000",$_SERVER ['HTTP_USER_AGENT' ] ) ||
  75.      eregi ( "(windows nt)( ){0,1}(5.0)", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  76.      eregi ( "(windows nt)( ){0,1}(5.1)", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  77.      eregi ( "(win)([0-9]{2})", $_SERVER [ 'HTTP_USER_AGENT' ], $regs ) ||
  78.      eregi ( "(windows) ([0-9]{2})", $_SERVER [ 'HTTP_USER_AGENT' ], $regs ) ||
  79.      eregi ( "(winnt)([0-9]{1,2}.[0-9]{1,2}){0,1}", $_SERVER [ 'HTTP_USER_AGENT' ], $regs ) ||
  80.      eregi ( "(windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1}", $_SERVER [ 'HTTP_USER_AGENT' ], $regs ) ) {
  81.        $rtnStr = "Un Microsoftista por estos lares :))";
  82.  } elseif ( eregi ( "mac", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  83.    $rtnStr = "(¯`·._.·-oOOoo-<[ Macintosh ]>-oOOoo-·._.·´¯)";
  84.  } else {
  85.    if ( eregi ( "(sunos) ([0-9]{1,2}.[0-9]{1,2}){0,1}",$_SERVER ['HTTP_USER_AGENT'],$regs ) ) {
  86.      $rtnStr = "SunOS $regs[2]";
  87.    } elseif ( eregi ( "(beos) r([0-9]{1,2}.[0-9]{1,2}){0,1}", $_SERVER [ 'HTTP_USER_AGENT' ], $regs ) ) {
  88.      $rtnStr = "BeOS $regs[2]";
  89.    } elseif ( eregi ( "freebsd", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  90.      $rtnStr = "FreeBSD";
  91.    } elseif ( eregi ( "openbsd", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  92.      $rtnStr = "OpenBSD";
  93.    } elseif ( eregi ( "irix", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  94.      $rtnStr = "IRIX";
  95.    } elseif ( eregi ( "os/2", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  96.      $rtnStr = "OS/2";
  97.    } elseif ( eregi ( "plan9", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  98.      $rtnStr = "Plan9";
  99.    } elseif ( eregi ( "unix", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  100.      eregi ( "hp-ux", $_SERVER [ 'HTTP_USER_AGENT' ] ) ||
  101.        eregi ( "X11", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  102.        $rtnStr = "Unix";
  103.    } elseif(eregi ( "osf", $_SERVER [ 'HTTP_USER_AGENT' ] ) ) {
  104.      $rtnStr = "OSF";
  105.    } else{$rtnStr = "TuMáquinA";
  106.    $rtnStr = "CyberSurfeando con $rtnStr";
  107.    }
  108.  }
  109.  return $rtnStr;
  110. }
  111.  
  112. $tmpInt = 1;
  113. $linea [ $tmpInt ] = gethostbyaddr ( RealIPget () );
  114. $tmpInt++;
  115. $linea [ $tmpInt ] = DetectOs ();
  116.  
  117. $ancho = 0; $alto = 0;
  118. for ( $a=1; $a<=$tmpInt; $a++ ) {
  119.  $tmpBox= imagettfbbox ( 13,0, "./files/trebucit.ttf", $linea [ $a ] );
  120.  if ( $tmpBox [ 2 ] - $tmpBox [ 0 ] > $ancho )
  121.    $ancho = $tmpBox [ 2 ] - $tmpBox [ 0 ];
  122.  if ( $tmpBox [ 3 ] - $tmpBox [ 5 ] > $alto )
  123.    $alto =  $tmpBox [ 3 ] - $tmpBox[ 5 ];
  124. }
  125.  
  126. $altoTotal =  $alto * $tmpInt;
  127.  
  128. $im = imagecreatefrompng ( "./img/fondo_banner.png" );
  129. list ( $fondo_w, $fondo_h ) = getimagesize ( "./img/fondo_banner.png" );
  130.  
  131. $im_tmp = imagecreatefrompng( "img/M3I4L.png" );
  132. list ( $tux_w, $tux_h ) = getimagesize ( "./img/M3I4L.png" );
  133. imagecopy ( $im, $im_tmp, $fondo_w - $tux_w - 25, $fondo_h - $tux_h + 30, 0, 0, $tux_w, $tux_h );
  134.  
  135. $im_tmp = imagecreatefrompng ( "./img/mosx_banner.png" );
  136. list ( $mac_w, $mac_h ) = getimagesize ( "./img/mosx_banner.png" );
  137. imagecopy ( $im, $im_tmp, $fondo_w/2 - $mac_w + 16 , $fondo_h - $mac_h, 0, 0, $mac_w, $mac_h );
  138.  
  139. $im_tmp = imagecreatefrompng( "img/mosx_tux.png" );
  140. list ( $tux_w, $tux_h ) = getimagesize ( "./img/mosx_tux.png" );
  141. imagecopy ( $im, $im_tmp, $fondo_w - $tux_w, $fondo_h - $tux_h, 0, 0, $tux_w, $tux_h );
  142.  
  143. $im_tmp = imagecreatefrompng( "./img/GNU-Linux.png" );
  144. list ( $tux_w, $tux_h ) = getimagesize ( "./img/GNU-Linux.png" );
  145. imagecopy ( $im, $im_tmp, 0, $fondo_h - $tux_h, 0, 0, $tux_w, $tux_h );
  146.  
  147. $semitrans = imagecolorallocatealpha($im,  0x99, 0x99, 0x99, 0x25);
  148. imagefilledrectangle ( $im, 2, 2, $ancho + 4, $alto * $tmpInt + 6, $semitrans );
  149.  
  150. $b=0;
  151.  
  152. for ( $a=1; $a<=$tmpInt; $a++ ) {
  153.  $b=!$b;
  154.  if ($b) {
  155.    $fontColor = imagecolorallocate( $im, 0, 255, 255 );
  156.    imagettftext ( $im, 13, 0, 4, $alto*$a, $fontColor, "./files/trebucit.ttf", $linea [ $a ] );
  157.  } else {
  158.    $fontColor = imagecolorallocate( $im, 255, 255, 204 );
  159.    imagettftext ( $im, 12, 0, 4, $alto*$a, $fontColor, "./files/trebucit.ttf", $linea [ $a ] );
  160.  }
  161. }
  162.  
  163. $fontColor = imagecolorallocate( $im, 0, 156, 255 );
  164. imagettftext ( $im, 13, 12, 63, $alto*$a + 24, $fontColor, "./files/trebucit.ttf", RealIPget () );
  165.  
  166. //Mostramos el grafico en pantalla
  167. imagepng ( $im );
  168.  
  169. //Liberamos memoria
  170. imagedestroy ( $im );
  171. ?>


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Creacion de firma dinamica
PHP
GreatSaiyan 1 5,069 Último mensaje 2 Octubre 2004, 04:52 am
por Azielito
Firma dinamica Castg! version 1.1 [PHP]
PHP
Castg! 0 2,418 Último mensaje 19 Enero 2011, 00:36 am
por Castg!
Ayuda con Firma dinamica « 1 2 »
PHP
SabaLero0_ 19 8,278 Último mensaje 22 Abril 2011, 02:44 am
por Castg!
Firma dinámica [Castg] - Depurado
PHP
Castg! 1 3,882 Último mensaje 31 Marzo 2012, 11:20 am
por Og.
Duda sobre nmap y detección de sistema operativo
Seguridad
Schaiden 1 2,873 Último mensaje 21 Octubre 2016, 02:29 am
por engel lex
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines