Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: BigBear en 1 Agosto 2014, 15:57 pm



Título: [C#] PanelFinder 0.3
Publicado por: BigBear en 1 Agosto 2014, 15:57 pm
Un simple programa en C# para buscar el panel de admin en una pagina web.

Una imagen :

(http://doddyhackman.webcindario.com/images/panelfindercsharp.jpg)

Los codigos :

Form1.cs

Código
  1. // PanelFinder 0.3
  2. // (C) Doddy Hackman 2014
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Text;
  10. using System.Windows.Forms;
  11.  
  12. namespace PanelFinder
  13. {
  14.    public partial class Form1 : Form
  15.    {
  16.        public Form1()
  17.        {
  18.            InitializeComponent();
  19.        }
  20.  
  21.        private void button1_Click(object sender, EventArgs e)
  22.        {
  23.  
  24.            List<string> paneles = new List<string> {"admin/admin.asp","admin/login.asp",
  25.    "admin/index.asp",               "admin/admin.aspx",
  26.    "admin/login.aspx",              "admin/index.aspx",
  27.    "admin/webmaster.asp",           "admin/webmaster.aspx",
  28.    "asp/admin/index.asp",           "asp/admin/index.aspx",
  29.    "asp/admin/admin.asp",           "asp/admin/admin.aspx",
  30.    "asp/admin/webmaster.asp",       "asp/admin/webmaster.aspx",
  31.    "admin/",                        "login.asp",
  32.    "login.aspx",                    "admin.asp",
  33.    "admin.aspx",                    "webmaster.aspx",
  34.    "webmaster.asp",                 "login/index.asp",
  35.    "login/index.aspx",              "login/login.asp",
  36.    "login/login.aspx",              "login/admin.asp",
  37.    "login/admin.aspx",              "administracion/index.asp",
  38.    "administracion/index.aspx",     "administracion/login.asp",
  39.    "administracion/login.aspx",     "administracion/webmaster.asp",
  40.    "administracion/webmaster.aspx", "administracion/admin.asp",
  41.    "administracion/admin.aspx",     "php/admin/",
  42.    "admin/admin.php",               "admin/index.php",
  43.    "admin/login.php",               "admin/system.php",
  44.    "admin/ingresar.php",            "admin/administrador.php",
  45.    "admin/default.php",             "administracion/",
  46.    "administracion/index.php",      "administracion/login.php",
  47.    "administracion/ingresar.php",   "administracion/admin.php",
  48.    "administration/",               "administration/index.php",
  49.    "administration/login.php",      "administrator/index.php",
  50.    "administrator/login.php",       "administrator/system.php",
  51.    "system/",                       "system/login.php",
  52.    "admin.php",                     "login.php",
  53.    "administrador.php",             "administration.php",
  54.    "administrator.php",             "admin1.html",
  55.    "admin1.php",                    "admin2.php",
  56.    "admin2.html",                   "yonetim.php",
  57.    "yonetim.html",                  "yonetici.php",
  58.    "yonetici.html",                 "adm/",
  59.    "admin/account.php",             "admin/account.html",
  60.    "admin/index.html",              "admin/login.html",
  61.    "admin/home.php",                "admin/controlpanel.html",
  62.    "admin/controlpanel.php",        "admin.html",
  63.    "admin/cp.php",                  "admin/cp.html",
  64.    "cp.php",                        "cp.html",
  65.    "administrator/",                "administrator/index.html",
  66.    "administrator/login.html",      "administrator/account.html",
  67.    "administrator/account.php",     "administrator.html",
  68.    "login.html",                    "modelsearch/login.php",
  69.    "moderator.php",                 "moderator.html",
  70.    "moderator/login.php",           "moderator/login.html",
  71.    "moderator/admin.php",           "moderator/admin.html",
  72.    "moderator/",                    "account.php",
  73.    "account.html",                  "controlpanel/",
  74.    "controlpanel.php",              "controlpanel.html",
  75.    "admincontrol.php",              "admincontrol.html",
  76.    "adminpanel.php",                "adminpanel.html",
  77.    "admin1.asp",                    "admin2.asp",
  78.    "yonetim.asp",                   "yonetici.asp",
  79.    "admin/account.asp",             "admin/home.asp",
  80.    "admin/controlpanel.asp",        "admin/cp.asp",
  81.    "cp.asp",                        "administrator/index.asp",
  82.    "administrator/login.asp",       "administrator/account.asp",
  83.    "administrator.asp",             "modelsearch/login.asp",
  84.    "moderator.asp",                 "moderator/login.asp",
  85.    "moderator/admin.asp",           "account.asp",
  86.    "controlpanel.asp",              "admincontrol.asp",
  87.    "adminpanel.asp",                "fileadmin/",
  88.    "fileadmin.php",                 "fileadmin.asp",
  89.    "fileadmin.html",                "administration.html",
  90.    "sysadmin.php",                  "sysadmin.html",
  91.    "phpmyadmin/",                   "myadmin/",
  92.    "sysadmin.asp",                  "sysadmin/",
  93.    "ur-admin.asp",                  "ur-admin.php",
  94.    "ur-admin.html",                 "ur-admin/",
  95.    "Server.php",                    "Server.html",
  96.    "Server.asp",                    "Server/",
  97.    "wp-admin/",                     "administr8.php",
  98.    "administr8.html",               "administr8/",
  99.    "administr8.asp",                "webadmin/",
  100.    "webadmin.php",                  "webadmin.asp",
  101.    "webadmin.html",                 "administratie/",
  102.    "admins/",                       "admins.php",
  103.    "admins.asp",                    "admins.html",
  104.    "administrivia/",                "Database_Administration/",
  105.    "WebAdmin/",                     "useradmin/",
  106.    "sysadmins/",                    "admin1/",
  107.    "system-administration/",        "administrators/",
  108.    "pgadmin/",                      "directadmin/",
  109.    "staradmin/",                    "ServerAdministrator/",
  110.    "SysAdmin/",                     "administer/",
  111.    "LiveUser_Admin/",               "sys-admin/",
  112.    "typo3/",                        "panel/",
  113.    "cpanel/",                       "cPanel/",
  114.    "cpanel_file/",                  "platz_login/",
  115.    "rcLogin/",                      "blogindex/",
  116.    "formslogin/",                   "autologin/",
  117.    "support_login/",                "meta_login/",
  118.    "manuallogin/",                  "simpleLogin/",
  119.    "loginflat/",                    "utility_login/",
  120.    "showlogin/",                    "memlogin/",
  121.    "members/",                      "login-redirect/",
  122.    "sub-login/",                    "wp-login/",
  123.    "login1/",                       "dir-login/",
  124.    "login_db/",                     "xlogin/",
  125.    "smblogin/",                     "customer_login/",
  126.    "UserLogin/",                    "login-us/",
  127.    "acct_login/",                   "admin_area/",
  128.    "bigadmin/",                     "project-admins/",
  129.    "phppgadmin/",                   "pureadmin/",
  130.    "sql-admin/",                    "radmind/",
  131.    "openvpnadmin/",                 "wizmysqladmin/",
  132.    "vadmind/",                      "ezsqliteadmin/",
  133.    "hpwebjetadmin/",                "newsadmin/",
  134.    "adminpro/",                     "Lotus_Domino_Admin/",
  135.    "bbadmin/",                      "vmailadmin/",
  136.    "Indy_admin/",                   "ccp14admin/",
  137.    "irc-macadmin/",                 "banneradmin/",
  138.    "sshadmin/",                     "phpldapadmin/",
  139.    "macadmin/",                     "administratoraccounts/",
  140.    "admin4_account/",               "admin4_colon/",
  141.    "radmind-1/",                    "Super-Admin/",
  142.    "AdminTools/",                   "cmsadmin/",
  143.    "SysAdmin2/",                    "globes_admin/",
  144.    "cadmins/",                      "phpSQLiteAdmin/",
  145.    "navSiteAdmin/",                 "server_admin_small/",
  146.    "logo_sysadmin/",                "server/",
  147.    "database_administration/",      "power_user/",
  148.    "system_administration/",        "ss_vms_admin_sm/"
  149. };
  150.  
  151.            DH_Tools tools = new DH_Tools();
  152.  
  153.            String page = textBox1.Text;
  154.            String code = "";
  155.  
  156.            listBox1.Items.Clear();
  157.  
  158.            toolStripStatusLabel1.Text = "[+] Scanning ...";
  159.            this.Refresh();
  160.  
  161.            foreach(string panel in paneles) {
  162.                toolStripStatusLabel1.Text = "[+] Checking : "+panel;
  163.                this.Refresh();
  164.                code = tools.responsecode(page+"/"+panel);
  165.                if (code == "200")
  166.                {
  167.                    listBox1.Items.Add(page + "/" + panel);
  168.                }
  169.            }
  170.  
  171.            if (listBox1.Items.Count == 0)
  172.            {
  173.                MessageBox.Show("Not Found");
  174.            }
  175.  
  176.            toolStripStatusLabel1.Text = "[+] Finished";
  177.            this.Refresh();
  178.  
  179.        }
  180.  
  181.        private void listBox1_DoubleClick(object sender, EventArgs e)
  182.        {
  183.            DH_Tools tools = new DH_Tools();
  184.            tools.console("start " + listBox1.SelectedItem.ToString());
  185.        }
  186.    }
  187. }
  188.  
  189. // The End ?
  190.  

DH_Tools.cs

Código
  1. // Class Name : DH Tools
  2. // Version : Beta
  3. // Author : Doddy Hackman
  4. // (C) Doddy Hackman 2014
  5. //
  6. // Functions :
  7. //
  8. // [+] HTTP Methods GET & POST
  9. // [+] Get HTTP Status code number
  10. // [+] HTTP FingerPrinting
  11. // [+] Read File
  12. // [+] Write File
  13. // [+] GET OS
  14. // [+] Remove duplicates from a List
  15. // [+] Cut urls from a List
  16. // [+] Download
  17. // [+] Upload
  18. // [+] Get Basename from a path
  19. // [+] Execute commands
  20. // [+] URI Split
  21. // [+] MD5 Hash Generator
  22. // [+] Get MD5 of file
  23. // [+] Get IP address from host name
  24. //
  25. // Credits :
  26. //
  27. // Method POST -> https://technet.rapaport.com/Info/Prices/SampleCode/Full_Example.aspx
  28. // Method GET -> http://stackoverflow.com/questions/4510212/how-i-can-get-web-pages-content-and-save-it-into-the-string-variable
  29. // HTTP Headers -> http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.headers%28v=vs.110%29.aspx
  30. // List Cleaner -> http://forums.asp.net/t/1318899.aspx?Remove+duplicate+items+from+List+String+
  31. // Execute command -> http://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C
  32. // MD5 Hash Generator -> http://www.java2s.com/Code/CSharp/Security/GetandverifyMD5Hash.htm
  33. // Get MD5 of file -> http://stackoverflow.com/questions/10520048/calculate-md5-checksum-for-a-file
  34. //
  35. // Thanks to : $DoC and atheros14 (Forum indetectables)
  36. //
  37.  
  38. using System;
  39. using System.Collections.Generic;
  40. using System.Text;
  41.  
  42. using System.Net;
  43. using System.IO;
  44. using System.Text.RegularExpressions;
  45. using System.Security.Cryptography;
  46.  
  47. namespace PanelFinder
  48. {
  49.    class DH_Tools
  50.    {
  51.        public string toma(string url)
  52.        {
  53.            string code = "";
  54.  
  55.            try
  56.            {
  57.                WebClient nave = new WebClient();
  58.                nave.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0";
  59.                code = nave.DownloadString(url);
  60.            }
  61.            catch
  62.            {
  63.                //
  64.            }
  65.            return code;
  66.        }
  67.  
  68.        public string tomar(string url, string par)
  69.        {
  70.  
  71.            string code = "";
  72.  
  73.            try
  74.            {
  75.  
  76.                HttpWebRequest nave = (HttpWebRequest)
  77.                WebRequest.Create(url);
  78.  
  79.                nave.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0";
  80.                nave.Method = "POST";
  81.                nave.ContentType = "application/x-www-form-urlencoded";
  82.  
  83.                Stream anteantecode = nave.GetRequestStream();
  84.  
  85.                anteantecode.Write(Encoding.ASCII.GetBytes(par), 0, Encoding.ASCII.GetBytes(par).Length);
  86.                anteantecode.Close();
  87.  
  88.                StreamReader antecode = new StreamReader(nave.GetResponse().GetResponseStream());
  89.                code = antecode.ReadToEnd();
  90.  
  91.            }
  92.            catch
  93.            {
  94.                //
  95.            }
  96.  
  97.            return code;
  98.  
  99.        }
  100.  
  101.        public string responsecode(string url)
  102.        {
  103.            String code = "";
  104.            try
  105.            {
  106.                HttpWebRequest nave = (HttpWebRequest)WebRequest.Create(url);
  107.                nave.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0";
  108.                HttpWebResponse num = (HttpWebResponse)nave.GetResponse();
  109.  
  110.                int number = (int)num.StatusCode;
  111.                code = Convert.ToString(number);
  112.  
  113.            }
  114.            catch
  115.            {
  116.  
  117.                code = "404";
  118.  
  119.            }
  120.            return code;
  121.        }
  122.  
  123.        public string httpfinger(string url)
  124.        {
  125.  
  126.            String code = "";
  127.  
  128.            try
  129.            {
  130.  
  131.                HttpWebRequest nave1 = (HttpWebRequest)WebRequest.Create(url);
  132.                HttpWebResponse nave2 = (HttpWebResponse)nave1.GetResponse();
  133.  
  134.                for (int num = 0; num < nave2.Headers.Count; ++num)
  135.                {
  136.                    code = code + "[+] " + nave2.Headers.Keys[num] + ":" + nave2.Headers[num] + Environment.NewLine;
  137.                }
  138.  
  139.                nave2.Close();
  140.            }
  141.            catch
  142.            {
  143.                //
  144.            }
  145.  
  146.            return code;
  147.  
  148.        }
  149.  
  150.        public string openword(string file)
  151.        {
  152.            String code = "";
  153.            try
  154.            {
  155.                code = System.IO.File.ReadAllText(file);
  156.            }
  157.            catch
  158.            {
  159.                //
  160.            }
  161.            return code;
  162.        }
  163.  
  164.        public void savefile(string file, string texto)
  165.        {
  166.  
  167.            try
  168.            {
  169.                System.IO.StreamWriter save = new System.IO.StreamWriter(file, true);
  170.                save.Write(texto);
  171.                save.Close();
  172.            }
  173.            catch
  174.            {
  175.                //
  176.            }
  177.        }
  178.  
  179.        public string getos()
  180.        {
  181.            string code = "";
  182.  
  183.            try
  184.            {
  185.                System.OperatingSystem os = System.Environment.OSVersion;
  186.                code = Convert.ToString(os);
  187.            }
  188.            catch
  189.            {
  190.                code = "?";
  191.            }
  192.  
  193.            return code;
  194.        }
  195.  
  196.        public List<string> repes(List<string> array)
  197.        {
  198.            List<string> repe = new List<string>();
  199.            foreach (string lin in array)
  200.            {
  201.                if (!repe.Contains(lin))
  202.                {
  203.                    repe.Add(lin);
  204.                }
  205.            }
  206.  
  207.            return repe;
  208.  
  209.        }
  210.  
  211.        public List<string> cortar(List<string> otroarray)
  212.        {
  213.            List<string> cort = new List<string>();
  214.  
  215.            foreach (string row in otroarray)
  216.            {
  217.  
  218.                String lineafinal = "";
  219.  
  220.                Match regex = Regex.Match(row, @"(.*)\?(.*)=(.*)", RegexOptions.IgnoreCase);
  221.                if (regex.Success)
  222.                {
  223.                    lineafinal = regex.Groups[1].Value + "?" + regex.Groups[2].Value + "=";
  224.                    cort.Add(lineafinal);
  225.                }
  226.  
  227.            }
  228.  
  229.            return cort;
  230.        }
  231.  
  232.        public string download(string url, string savename)
  233.        {
  234.  
  235.            String code = "";
  236.  
  237.            WebClient nave = new WebClient();
  238.            nave.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0";
  239.  
  240.            try
  241.            {
  242.                nave.DownloadFile(url, savename);
  243.                code = "OK";
  244.            }
  245.            catch
  246.            {
  247.                code = "Error";
  248.            }
  249.  
  250.            return code;
  251.        }
  252.  
  253.        public string upload(string link, string archivo)
  254.        {
  255.  
  256.            String code = "";
  257.  
  258.            try
  259.            {
  260.  
  261.                WebClient nave = new WebClient();
  262.                nave.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0";
  263.                byte[] codedos = nave.UploadFile(link, "POST", archivo);
  264.                code = System.Text.Encoding.UTF8.GetString(codedos, 0, codedos.Length);
  265.  
  266.            }
  267.  
  268.            catch
  269.            {
  270.                code = "Error";
  271.            }
  272.  
  273.            return code;
  274.  
  275.        }
  276.  
  277.        public string basename(string file)
  278.        {
  279.            String nombre = "";
  280.  
  281.            FileInfo basename = new FileInfo(file);
  282.            nombre = basename.Name;
  283.  
  284.            return nombre;
  285.  
  286.        }
  287.  
  288.        public string console(string cmd)
  289.        {
  290.  
  291.            string code = "";
  292.  
  293.            try
  294.            {
  295.  
  296.                System.Diagnostics.ProcessStartInfo loadnow = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + cmd);
  297.                loadnow.RedirectStandardOutput = true;
  298.                loadnow.UseShellExecute = false;
  299.                loadnow.CreateNoWindow = true;
  300.                System.Diagnostics.Process loadnownow = new System.Diagnostics.Process();
  301.                loadnownow.StartInfo = loadnow;
  302.                loadnownow.Start();
  303.                code = loadnownow.StandardOutput.ReadToEnd();
  304.  
  305.            }
  306.  
  307.            catch
  308.            {
  309.                code = "Error";
  310.            }
  311.  
  312.            return code;
  313.  
  314.        }
  315.  
  316.        public string urisplit(string url, string opcion)
  317.        {
  318.  
  319.            string code = "";
  320.  
  321.            Uri dividir = new Uri(url);
  322.  
  323.            if (opcion == "host")
  324.            {
  325.                code = dividir.Host;
  326.            }
  327.  
  328.            if (opcion == "port")
  329.            {
  330.                code = Convert.ToString(dividir.Port);
  331.            }
  332.  
  333.            if (opcion == "path")
  334.            {
  335.                code = dividir.LocalPath;
  336.            }
  337.  
  338.            if (opcion == "file")
  339.            {
  340.                code = dividir.AbsolutePath;
  341.                FileInfo basename = new FileInfo(code);
  342.                code = basename.Name;
  343.            }
  344.  
  345.            if (opcion == "query")
  346.            {
  347.                code = dividir.Query;
  348.            }
  349.  
  350.            if (opcion == "")
  351.            {
  352.                code = "Error";
  353.            }
  354.  
  355.            return code;
  356.        }
  357.  
  358.        public string convertir_md5(string text)
  359.        {
  360.            MD5 convertirmd5 = MD5.Create();
  361.            byte[] infovalor = convertirmd5.ComputeHash(Encoding.Default.GetBytes(text));
  362.            StringBuilder guardar = new StringBuilder();
  363.            for (int numnow = 0; numnow < infovalor.Length; numnow++)
  364.            {
  365.                guardar.Append(infovalor[numnow].ToString("x2"));
  366.            }
  367.            return guardar.ToString();
  368.        }
  369.  
  370.        public string md5file(string file)
  371.        {
  372.  
  373.            string code = "";
  374.  
  375.            try
  376.            {
  377.                var gen = MD5.Create();
  378.                var ar = File.OpenRead(file);
  379.                code = BitConverter.ToString(gen.ComputeHash(ar)).Replace("-", "").ToLower();
  380.  
  381.            }
  382.            catch
  383.            {
  384.                code = "Error";
  385.            }
  386.  
  387.            return code;
  388.        }
  389.  
  390.        public string getip(string host)
  391.        {
  392.            string code = "";
  393.            try
  394.            {
  395.                IPAddress[] find = Dns.GetHostAddresses(host);
  396.                code = find[0].ToString();
  397.            }
  398.            catch
  399.            {
  400.                code = "Error";
  401.            }
  402.            return code;
  403.        }
  404.  
  405.    }
  406. }
  407.  
  408. // The End ?
  409.  

Si quieren lo puede bajar de aca (https://sourceforge.net/projects/adminfinder/).