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

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Temas
Páginas: [1] 2 3 4
1  Programación / Scripting / Admin Panel Finder [By 2Fac3R] en: 29 Julio 2015, 21:09 pm
Les dejo este Admin Panel Finder en Python (acabo de publicar uno en PHP jeje) espero les sea de utilidad.

Código
  1. # -----------------------------#
  2.                        # Admin Panel Finder By 2Fac!  #
  3.                        #         v1.0 2013            #
  4.                        #                              #
  5.                        #          UnderC0de           #
  6.                        # -----------------------------#
  7.  
  8.  
  9. import os, sys, httplib
  10.  
  11. os.system("clear")
  12. panel = ["/admin1.php", "/admin1.html", "/admin2.php", "/admin2.html", "/yonetim.php", "/yonetim.html",
  13. "/yonetici.php", "/yonetici.html", "/ccms/", "/ccms/login.php", "/ccms/index.php", "/maintenance/",
  14. "/webmaster/", "/adm/", "/configuration/", "/configure/", "/websvn/", "/admin/", "/admin/account.php",
  15. "/admin/account.html","/admin/index.php","/admin/index.html", "/admin/login.php", "/admin/login.html",
  16. "/admin/home.php", "/admin/controlpanel.html", "/admin/controlpanel.php", "/admin.php", "/admin.html",
  17. "/admin/cp.php", "/admin/cp.html", "/cp.php", "/cp.html", "/administrator/", "/administrator/index.html",
  18. "/administrator/index.php", "/administrator/login.html", "/administrator/login.php",
  19. "/administrator/account.html", "/administrator/account.php", "/administrator.php", "/administrator.html",
  20. "/login.php", "/login.html", "/modelsearch/login.php", "/moderator.php", "/moderator.html",
  21. "/moderator/login.php", "/moderator/login.html", "/moderator/admin.php", "/moderator/admin.html",
  22. "/moderator/", "/account.php", "/account.html", "/controlpanel/","/admincontrol.php","/admincontrol.html",
  23. "/adminpanel.php","/adminpanel.html","/admin1.asp","/admin2.asp","/yonetim.asp","/yonetici.asp",
  24. "/admin/account.asp","/admin/index.asp","/admin/login.asp","/admin/home.asp","/admin/controlpanel.asp",
  25. "/admin.asp","/admin/cp.asp","/cp.asp","/administrator/index.asp","/administrator/login.asp",
  26. "/administrator/account.asp","/administrator.asp","/login.asp","/modelsearch/login.asp","/moderator.asp",
  27. "/moderator/login.asp","/moderator/admin.asp","/account.asp","/controlpanel.asp","/admincontrol.asp",
  28. "/adminpanel.asp","/fileadmin/","/fileadmin.php","/fileadmin.asp","/fileadmin.html","/administration/",
  29. "/administration.php","/administration.html","/sysadmin.php","/sysadmin.html","/phpmyadmin/","/myadmin/",
  30. "/sysadmin.asp","/sysadmin/","/ur-admin.asp","/ur-admin.php","/ur-admin.html","/ur-admin/","/Server.php",
  31. "/Server.html","/Server.asp","/Server/","/wp-admin/","/administr8.php","/administr8.html","/administr8/",
  32. "/administr8.asp","/webadmin/","/webadmin.php","/webadmin.asp","/webadmin.html","/administratie/","/admins/",
  33. "/admins.php","/admins.asp","/admins.html","/administrivia/","/Database_Administration/","/WebAdmin/",
  34. "/useradmin/","/sysadmins/","/admin1/","/system-administration/","/administrators/","/pgadmin/","/directadmin/",
  35. "/staradmin/","/ServerAdministrator/","/SysAdmin/","/administer/","/LiveUser_Admin/","/sys-admin/","/typo3/",
  36. "/panel/","/cpanel/","/cPanel/","/cpanel_file/","/platz_login/","/rcLogin/","/blogindex/","/formslogin/",
  37. "/autologin/","/support_login/","/meta_login/","/manuallogin/","/simpleLogin/","/loginflat/","/utility_login/",
  38. "/showlogin/","/memlogin/","/members/","/login-redirect/","/sub-login/","/wp-login/","/login1/","/dir-login/",
  39. "/login_db/","/xlogin/","/smblogin/","/customer_login/","/UserLogin/","/login-us/","/acct_login/",
  40. "/admin_area/","/bigadmin/","/project-admins/","/phppgadmin/","/pureadmin/","/sql-admin/","/radmind/",
  41. "/openvpnadmin/","/wizmysqladmin/","/vadmind/","/ezsqliteadmin/","/hpwebjetadmin/","/newsadmin/","/adminpro/",
  42. "/Lotus_Domino_Admin/","/bbadmin/","/vmailadmin/","/Indy_admin/","/ccp14admin/","/irc-macadmin/",
  43. "/banneradmin/","/sshadmin/","/phpldapadmin/","/macadmin/","/administratoraccounts/","/admin4_account/",
  44. "/admin4_colon/","/radmind-1/","/Super-Admin/","/AdminTools/","/cmsadmin/","/SysAdmin2/","/globes_admin/",
  45. "/cadmins/","/phpSQLiteAdmin/","/navSiteAdmin/","/server_admin_small/","/logo_sysadmin/","/server/",
  46. "/database_administration/","/power_user/","/system_administration/","/ss_vms_admin_sm/","/administrador",
  47. "/administracion","/moderacion","/moderador","/phpMyAdmin/","/phpmyadmin/","/PMA/","/admin/","/dbadmin/",
  48. "/mysql/","/myadmin/","/phpmyadmin2/","/phpMyAdmin2/","/phpMyAdmin-2/","/php-my-admin/","/phpMyAdmin-2.2.3/",
  49. "/phpMyAdmin-2.2.6/","/phpMyAdmin-2.5.1/","/phpMyAdmin-2.5.4/","/phpMyAdmin-2.5.5-rc1/",
  50. "/phpMyAdmin-2.5.5-rc2/","/phpMyAdmin-2.5.5/","/phpMyAdmin-2.5.5-pl1/","/phpMyAdmin-2.5.6-rc1/",
  51. "/phpMyAdmin-2.5.6-rc2/","/phpMyAdmin-2.5.6/","/phpMyAdmin-2.5.7/","/phpMyAdmin-2.5.7-pl1/",
  52. "/phpMyAdmin-2.6.0-alpha/","/phpMyAdmin-2.6.0-alpha2/","/phpMyAdmin-2.6.0-beta1/","/phpMyAdmin-2.6.0-beta2/",
  53. "/phpMyAdmin-2.6.0-rc1/","/phpMyAdmin-2.6.0-rc2/","/phpMyAdmin-2.6.0-rc3/","/phpMyAdmin-2.6.0/",
  54. "/phpMyAdmin-2.6.0-pl1/","/phpMyAdmin-2.6.0-pl2/","/phpMyAdmin-2.6.0-pl3/","/phpMyAdmin-2.6.1-rc1/",
  55. "/phpMyAdmin-2.6.1-rc2/","/phpMyAdmin-2.6.1/","/phpMyAdmin-2.6.1-pl1/","/phpMyAdmin-2.6.1-pl2/",
  56. "/phpMyAdmin-2.6.1-pl3/","/phpMyAdmin-2.6.2-rc1/","/phpMyAdmin-2.6.2-beta1/","/phpMyAdmin-2.6.2-rc1/",
  57. "/phpMyAdmin-2.6.2/","/phpMyAdmin-2.6.2-pl1/","/phpMyAdmin-2.6.3/","/phpMyAdmin-2.6.3-rc1/",
  58. "/phpMyAdmin-2.6.3/","/phpMyAdmin-2.6.3-pl1/","/phpMyAdmin-2.6.4-rc1/","/phpMyAdmin-2.6.4-pl1/",
  59. "/phpMyAdmin-2.6.4-pl2/","/phpMyAdmin-2.6.4-pl3/","/phpMyAdmin-2.6.4-pl4/","/phpMyAdmin-2.6.4/",
  60. "/phpMyAdmin-2.7.0-beta1/","/phpMyAdmin-2.7.0-rc1/","/phpMyAdmin-2.7.0-pl1/","/phpMyAdmin-2.7.0-pl2/",
  61. "/phpMyAdmin-2.7.0/","/phpMyAdmin-2.8.0-beta1/","/phpMyAdmin-2.8.0-rc1/","/phpMyAdmin-2.8.0-rc2/",
  62. "/phpMyAdmin-2.8.0/","/phpMyAdmin-2.8.0.1/","/phpMyAdmin-2.8.0.2/","/phpMyAdmin-2.8.0.3/",
  63. "/phpMyAdmin-2.8.0.4/","/phpMyAdmin-2.8.1-rc1/","/phpMyAdmin-2.8.1/","/phpMyAdmin-2.8.2/",
  64. "/phpMyAdmin-3.4.6-rc1/","/phpMyAdmin-3.4.5/","/phpMyAdmin-3.4.4/","/phpMyAdmin-3.3.10.4/",
  65. "/phpMyAdmin-3.4.3.2/","/phpMyAdmin-3.3.10.3/","/phpMyAdmin-3.4.3.1/","/phpMyAdmin-3.4.3/",
  66. "/phpMyAdmin-3.4.2/","/phpMyAdmin-3.4.1/","/phpMyAdmin-3.3.10.1/","/phpMyAdmin-3.4.0/","/phpMyAdmin-3.3.10/",
  67. "/phpMyAdmin-2.1.0/","/phpMyAdmin-2.0.5/","/phpMyAdmin-1.3.0/","/phpMyAdmin-1.1.0/","/phpMyAdmin-3.3.9.2/",
  68. "/phpMyAdmin-2.11.11.3/","/phpMyAdmin-3.3.9.1/","/phpMyAdmin-3.3.9/","/phpMyAdmin-3.3.8.1/",
  69. "/phpMyAdmin-2.11.11.1/","/phpMyAdmin-3.3.8/","/phpMyAdmin-3.3.7/","/phpMyAdmin-2.11.11/",
  70. "/phpMyAdmin-3.3.6/","/phpMyAdmin-3.3.5.1/","/phpMyAdmin-2.11.10.1/","/sqlmanager/","/mysqlmanager/","/p/m/a/",
  71. "/PMA2005/","/pma2005/","/phpmanager/","/php-myadmin/","/phpmy-admin/","/webadmin/","/sqlweb/","/websql/",
  72. "/webdb/","/mysqladmin/","/mysql-admin/"]
  73.  
  74. def h():
  75.    print """
  76.                        # -----------------------------#
  77.                        # Admin Panel Finder By 2Fac!  #
  78.                        #         v1.0 2013            #
  79.                        #                              #
  80.                        #        UnderC0de.Org         #
  81.                        # -----------------------------#
  82.    """
  83.  
  84. h()
  85.  
  86. def uso():
  87.    print "\n Sintaxis : ",sys.argv[0]," <host> \n"
  88.  
  89. def greets():
  90.    print """
  91.  
  92.    \t\tGr33tz to:
  93.  
  94.    \nxt3mp, arcangel_nigth, ANTRAX, 11Sep, Kr34t0r, GAMARRA, SkippyCreammy,
  95.    \nv1c0_h4ck, w4rning, etc, etc .
  96.    \n\t\t\t Underc0de.Org"""
  97.  
  98. def res(url,path):
  99.    con = httplib.HTTPConnection(url)
  100.    con.request("GET",path)
  101.    return con.getresponse().status  
  102.  
  103. def buscar(url):
  104.    print "\n Searching...\n\n"
  105.    for path in panel:
  106.        try:
  107.            code = res(url,path)
  108.            if code ==200:
  109.                print "FOUND --> "+url+path
  110.        except(KeyboardInterrupt):
  111.            uso()
  112.        except:
  113.            pass
  114.  
  115. if len(sys.argv) != 2 :
  116.    uso()
  117.  
  118. else:
  119.    buscar(sys.argv[1])
  120.  
  121. greets()

Espero que les sea de utilidad  ;D
Zalu2
2  Seguridad Informática / Nivel Web / Form-Tampering PoC en: 29 Julio 2015, 21:06 pm
Siguiendo con la práctica y los POC que he estado realizando, me doy cuenta que en esta sección, una de las cosas que falta es este bug llamado "Form Tampering", ya hay bastante información sobre XSS, SQLi, webshells, etc, etc. Así que empecemos.

FORM TAMPERING

Este metodo consiste en modificar los datos "ocultos" del formulario que use la web victima para algun beneficio, en este ejemplo, veremos un simple (bastante sencillo xD) ejemplo sobre un "carrito de compra", para modificar los precios de los productos.

codigo.php
Código
  1. <?php
  2. // Form tampering bug PoC
  3. $presupuesto = 100;
  4. $compra = strip_tags($_POST['producto']);
  5. function correcto(){
  6.    global $compra;
  7.    echo "Felicidades $compra comprado correctamente";
  8. }
  9. if(isset($_POST['producto']) && !empty($_POST['producto'])){
  10.    if($presupuesto >= $_POST['v_botella']){
  11.        correcto();
  12.    }else if ($presupuesto >= $_POST['v_cervesa']){
  13.        correcto();
  14.    }else{
  15.        echo "Lo sentimos, no tienes los fondos suficientes";
  16.    }
  17. }else{
  18.    if(isset($_POST['send'])){
  19.        die("Debes seleccionar un producto");
  20.    }
  21.    echo "Tu presupuesto es : $presupuesto";
  22. ?>
  23. <form action="" method="POST">
  24.    <select name="producto">
  25.        <option value="Botella"> Botella </option>
  26.        <option value="Cerveza"> Cervesa </option>
  27.    </select>
  28.    <input type="hidden" name="v_botella" value="500">
  29.    <input type="hidden" name="v_cervesa" value="200">
  30.    <input type="submit" name="send" value="Comprar!">
  31. </form>
  32. <?}?>

Como podemos observar, tenemos los precios de los productos en un atributo "hidden". Bien, ¿Cómo podemos aprovecharnos de eso?.


MODIFICANDO CABECERAS HTTP

Lo que vamos a hacer, es "sniffear" lo que nuestro navegador manda al servidor (cabeceras http), vamos a hacer esto con el http live headers (Add-on de Firefox). Despues de instalarlo en nuestro navegador, vamos a la página donde tenemos alojado nuestro PoC y abrimos el add-on, hacemos una petición simplemente "tratando" de comprar un producto y nos damos cuenta que en el live headers nos ha salido la petición http que hemos hecho.

Algo así:

Citar
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1/bugs/formtamp.php
Content-Type: application/x-www-form-urlencode2d
Content-Length: 60

Y:

Citar
producto=Botella&v_botella=500&v_cervesa=200&send=Comprar%21

Ahora vemos que podemos modificar los valores de los productos, cambiamos a 0 y le damos a repetir/replay

Citar
producto=Botella&v_botella=00&v_cervesa=00&send=Comprar%21

Y vuala!  ::) , hemos comprado el producto   ;)

Espero les sea de ayuda, cualquier duda, comentario y/o sugerencia publiquen aquí mismo.
Zalu2
3  Programación / PHP / [PHP] Admin Panel Finder en: 29 Julio 2015, 20:59 pm
Creo que un buscador de panel de administración es muy importante a la hora de  :silbar: ya saben  :rolleyes:  así que les dejo este que lo tengo desde hace mucho.


Código
  1. <?php
  2. $list['front'] ="admin
  3. adm
  4. admincp
  5. admcp
  6. cp
  7. modcp
  8. moderatorcp
  9. adminare
  10. admins
  11. cpanel
  12. controlpanel";
  13. $list['end'] = "admin1.php
  14. admin1.html
  15. admin2.php
  16. admin2.html
  17. yonetim.php
  18. yonetim.html
  19. yonetici.php
  20. yonetici.html
  21. ccms/
  22. ccms/login.php
  23. ccms/index.php
  24. maintenance/
  25. webmaster/
  26. adm/
  27. configuration/
  28. configure/
  29. websvn/
  30. admin/
  31. admin/account.php
  32. admin/account.html
  33. admin/index.php
  34. admin/index.html
  35. admin/login.php
  36. admin/login.html
  37. admin/home.php
  38. admin/controlpanel.html
  39. admin/controlpanel.php
  40. admin.php
  41. admin.html
  42. admin/cp.php
  43. admin/cp.html
  44. cp.php
  45. cp.html
  46. administrator/
  47. administrator/index.html
  48. administrator/index.php
  49. administrator/login.html
  50. administrator/login.php
  51. administrator/account.html
  52. administrator/account.php
  53. administrator.php
  54. administrator.html
  55. login.php
  56. login.html
  57. modelsearch/login.php
  58. moderator.php
  59. moderator.html
  60. moderator/login.php
  61. moderator/login.html
  62. moderator/admin.php
  63. moderator/admin.html
  64. moderator/
  65. account.php
  66. account.html
  67. controlpanel/
  68. controlpanel.php
  69. controlpanel.html
  70. admincontrol.php
  71. admincontrol.html
  72. adminpanel.php
  73. adminpanel.html
  74. admin1.asp
  75. admin2.asp
  76. yonetim.asp
  77. yonetici.asp
  78. admin/account.asp
  79. admin/index.asp
  80. admin/login.asp
  81. admin/home.asp
  82. admin/controlpanel.asp
  83. admin.asp
  84. admin/cp.asp
  85. cp.asp
  86. administrator/index.asp
  87. administrator/login.asp
  88. administrator/account.asp
  89. administrator.asp
  90. login.asp
  91. modelsearch/login.asp
  92. moderator.asp
  93. moderator/login.asp
  94. moderator/admin.asp
  95. account.asp
  96. controlpanel.asp
  97. admincontrol.asp
  98. adminpanel.asp
  99. fileadmin/
  100. fileadmin.php
  101. fileadmin.asp
  102. fileadmin.html
  103. administration/
  104. administration.php
  105. administration.html
  106. sysadmin.php
  107. sysadmin.html
  108. phpmyadmin/
  109. myadmin/
  110. sysadmin.asp
  111. sysadmin/
  112. ur-admin.asp
  113. ur-admin.php
  114. ur-admin.html
  115. ur-admin/
  116. Server.php
  117. Server.html
  118. Server.asp
  119. Server/
  120. wp-admin/
  121. administr8.php
  122. administr8.html
  123. administr8/
  124. administr8.asp
  125. webadmin/
  126. webadmin.php
  127. webadmin.asp
  128. webadmin.html
  129. administratie/
  130. admins/
  131. admins.php
  132. admins.asp
  133. admins.html
  134. administrivia/
  135. Database_Administration/
  136. WebAdmin/
  137. useradmin/
  138. sysadmins/
  139. admin1/
  140. system-administration/
  141. administrators/
  142. pgadmin/
  143. directadmin/
  144. staradmin/
  145. ServerAdministrator/
  146. SysAdmin/
  147. administer/
  148. LiveUser_Admin/
  149. sys-admin/
  150. typo3/
  151. panel/
  152. cpanel/
  153. cPanel/
  154. cpanel_file/
  155. platz_login/
  156. rcLogin/
  157. blogindex/
  158. formslogin/
  159. autologin/
  160. support_login/
  161. meta_login/
  162. manuallogin/
  163. simpleLogin/
  164. loginflat/
  165. utility_login/
  166. showlogin/
  167. memlogin/
  168. members/
  169. login-redirect/
  170. sub-login/
  171. wp-login/
  172. login1/
  173. dir-login/
  174. login_db/
  175. xlogin/
  176. smblogin/
  177. customer_login/
  178. UserLogin/
  179. login-us/
  180. acct_login/
  181. admin_area/
  182. bigadmin/
  183. project-admins/
  184. phppgadmin/
  185. pureadmin/
  186. sql-admin/
  187. radmind/
  188. openvpnadmin/
  189. wizmysqladmin/
  190. vadmind/
  191. ezsqliteadmin/
  192. hpwebjetadmin/
  193. newsadmin/
  194. adminpro/
  195. Lotus_Domino_Admin/
  196. bbadmin/
  197. vmailadmin/
  198. Indy_admin/
  199. ccp14admin/
  200. irc-macadmin/
  201. banneradmin/
  202. sshadmin/
  203. phpldapadmin/
  204. macadmin/
  205. administratoraccounts/
  206. admin4_account/
  207. admin4_colon/
  208. radmind-1/
  209. Super-Admin/
  210. AdminTools/
  211. cmsadmin/
  212. SysAdmin2/
  213. globes_admin/
  214. cadmins/
  215. phpSQLiteAdmin/
  216. navSiteAdmin/
  217. server_admin_small/
  218. logo_sysadmin/
  219. server/
  220. database_administration/
  221. power_user/
  222. system_administration/
  223. ss_vms_admin_sm/
  224. adminarea/
  225. bb-admin/
  226. adminLogin/
  227. panel-administracion/
  228. instadmin/
  229. memberadmin/
  230. administratorlogin/
  231. admin/admin.php
  232. admin_area/admin.php
  233. admin_area/login.php
  234. siteadmin/login.php
  235. siteadmin/index.php
  236. siteadmin/login.html
  237. admin/admin.html
  238. admin_area/index.php
  239. bb-admin/index.php
  240. bb-admin/login.php
  241. bb-admin/admin.php
  242. admin_area/login.html
  243. admin_area/index.html
  244. admincp/index.asp
  245. admincp/login.asp
  246. admincp/index.html
  247. webadmin/index.html
  248. webadmin/admin.html
  249. webadmin/login.html
  250. admin/admin_login.html
  251. admin_login.html
  252. panel-administracion/login.html
  253. nsw/admin/login.php
  254. webadmin/login.php
  255. admin/admin_login.php
  256. admin_login.php
  257. admin_area/admin.html
  258. pages/admin/admin-login.php
  259. admin/admin-login.php
  260. admin-login.php
  261. bb-admin/index.html
  262. bb-admin/login.html
  263. bb-admin/admin.html
  264. admin/home.html
  265. pages/admin/admin-login.html
  266. admin/admin-login.html
  267. admin-login.html
  268. admin/adminLogin.html
  269. adminLogin.html
  270. home.html
  271. rcjakar/admin/login.php
  272. adminarea/index.html
  273. adminarea/admin.html
  274. webadmin/index.php
  275. webadmin/admin.php
  276. user.html
  277. modelsearch/login.html
  278. adminarea/login.html
  279. panel-administracion/index.html
  280. panel-administracion/admin.html
  281. modelsearch/index.html
  282. modelsearch/admin.html
  283. admincontrol/login.html
  284. adm/index.html
  285. adm.html
  286. user.php
  287. panel-administracion/login.php
  288. wp-login.php
  289. adminLogin.php
  290. admin/adminLogin.php
  291. home.php
  292. adminarea/index.php
  293. adminarea/admin.php
  294. adminarea/login.php
  295. panel-administracion/index.php
  296. panel-administracion/admin.php
  297. modelsearch/index.php
  298. modelsearch/admin.php
  299. admincontrol/login.php
  300. adm/admloginuser.php
  301. admloginuser.php
  302. admin2/login.php
  303. admin2/index.php
  304. adm/index.php
  305. adm.php
  306. affiliate.php
  307. adm_auth.php
  308. memberadmin.php
  309. administratorlogin.php
  310. admin/admin.asp
  311. admin_area/admin.asp
  312. admin_area/login.asp
  313. admin_area/index.asp
  314. bb-admin/index.asp
  315. bb-admin/login.asp
  316. bb-admin/admin.asp
  317. pages/admin/admin-login.asp
  318. admin/admin-login.asp
  319. admin-login.asp
  320. user.asp
  321. webadmin/index.asp
  322. webadmin/admin.asp
  323. webadmin/login.asp
  324. admin/admin_login.asp
  325. admin_login.asp
  326. panel-administracion/login.asp
  327. adminLogin.asp
  328. admin/adminLogin.asp
  329. home.asp
  330. adminarea/index.asp
  331. adminarea/admin.asp
  332. adminarea/login.asp
  333. panel-administracion/index.asp
  334. panel-administracion/admin.asp
  335. modelsearch/index.asp
  336. modelsearch/admin.asp
  337. admincontrol/login.asp
  338. adm/admloginuser.asp
  339. admloginuser.asp
  340. admin2/login.asp
  341. admin2/index.asp
  342. adm/index.asp
  343. adm.asp
  344. affiliate.asp
  345. adm_auth.asp
  346. memberadmin.asp
  347. administratorlogin.asp
  348. siteadmin/login.asp
  349. siteadmin/index.asp
  350. ADMIN/
  351. paneldecontrol/
  352. login/
  353. cms/
  354. admon/
  355. ADMON/
  356. administrador/
  357. ADMIN/login.php
  358. panelc/
  359. ADMIN/login.html";
  360. function template() {
  361. echo '
  362. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  363. <html xmlns="http://www.w3.org/1999/xhtml">
  364. <head>
  365. <meta **********="Content-Type" *********"text/html; charset=utf-8" />
  366. <title>Admin page Finder </title>
  367. <style type="text/css">
  368. h1.technique-two {
  369.        width: 795px; height: 120px;
  370.        background: url(http://x0rg.org/styles/blackbox_red/imageset/site_logo.gif) no-repeat top center;
  371.        margin: 0 auto;
  372. }
  373. body{
  374.    background: #070707;
  375.    margin: 0;
  376.    padding: 0;
  377.    padding-top: 10px;
  378.    color: #FFF;
  379.    font-family: Calibri;
  380.    font-size: 13px;
  381. }
  382. a{
  383.    color: #FFF;
  384.    text-decoration: none;
  385.    font-weight: bold;
  386. }
  387. .wrapper{
  388.    width: 1000px;
  389.    margin: 0 auto;
  390. }
  391. .tube{
  392.    padding: 10px;
  393. }
  394. .red{
  395.    width: 998px;
  396.    border: 1px solid #e52224;
  397.    background: #191919;
  398.    color: #e52224
  399. }
  400. .red input{
  401.    background: #000;
  402.    border: 1px solid #e52224;
  403.    color: #FFF;
  404. }
  405. .blue{
  406.    float: left;
  407.    width: 1000px;
  408.    border: 1px solid #1d7fc3;
  409.    background: #191919;
  410.    color: #1d7fc3;
  411. }
  412. .green{
  413.    float: left;
  414.    width: 1000px;
  415.    border: 1px solid #5fd419;
  416.    background: #191919;
  417.    color: #5fd419;
  418. }
  419. </style>
  420. <script type="text/javascript">
  421. <!--
  422. function insertcode($text, $place, $replace)
  423. {
  424.    var $this = $text;
  425.    var logbox = document.getElementById($place);
  426.    if($replace == 0)
  427.        document.getElementById($place).innerHTML = logbox.innerHTML+$this;
  428.    else
  429.        document.getElementById($place).innerHTML = $this;
  430. //document.getElementById("helpbox").innerHTML = $this;
  431. }
  432. -->
  433. </script>
  434. </head>
  435. <body>
  436. <br />
  437. <br />
  438. <h1 class="technique-two">
  439.  
  440.  
  441.  
  442. </h1>
  443.  
  444. <div class="wrapper">
  445. <div class="red">
  446. <div class="tube">
  447. <form action="" method="post" name="xploit_form">
  448. URL:<br /><input type="text" name="xploit_url" value="'.$_POST['xploit_url'].'" style="width: 100%;" /><br /><br />
  449. 404string:<br /><input type="text" name="xploit_404string" value="'.$_POST['xploit_404string'].'" style="width: 100%;" /><br /><br />
  450. <span style="float: right;"><input type="submit" name="xploit_submit" value="go for it" align="right" /></span>
  451. </form>
  452. <br />
  453. </div> <!-- /tube -->
  454. </div> <!-- /red -->
  455. <br />
  456. <div class="green">
  457. <div class="tube" id="rightcol">
  458. Verificat: <span id="verified">0</span> / <span id="total">0</span><br />
  459. Found ones:<br />
  460. </div> <!-- /tube -->
  461. </div> <!-- /green -->
  462. <br clear="all" /><br />
  463. <div class="blue">
  464. <div class="tube" id="logbox">
  465. <br />
  466. <br />
  467. Admin page Finder <br /><br />
  468. </div> <!-- /tube -->
  469. </div> <!-- /blue -->
  470. </div> <!-- /wrapper -->
  471. <br clear="all">';
  472. }
  473. function show($msg, $br=1, $stop=0, $place='logbox', $replace=0) {
  474.    if($br == 1) $msg .= "<br />";
  475.    echo "<script type=\"text/javascript\">insertcode('".$msg."', '".$place."', '".$replace."');</script>";
  476.    if($stop == 1) exit;
  477.    @flush();@ob_flush();
  478. }
  479. function check($x, $front=0) {
  480.    global $_POST,$site,$false;
  481.    if($front == 0) $t = $site.$x;
  482.    else $t = 'http://'.$x.'.'.$site.'/';
  483.    $headers = get_headers($t);
  484.    if (!eregi('200', $headers[0])) return 0;
  485.    $data = @file_get_contents($t);
  486.    if($_POST['xploit_404string'] == "") if($data == $false) return 0;
  487.    if($_POST['xploit_404string'] != "") if(strpos($data, $_POST['xploit_404string'])) return 0;
  488.    return 1;
  489. }
  490.  
  491. // --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  492. template();
  493. if(!isset($_POST['xploit_url'])) die;
  494. if($_POST['xploit_url'] == '') die;
  495. $site = $_POST['xploit_url'];
  496. if ($site[strlen($site)-1] != "/") $site .= "/";
  497. if($_POST['xploit_404string'] == "") $false = @file_get_contents($site."d65897f5380a21a42db94b3927b823d56ee1099a-this_can-t_exist.html");
  498. $list['end'] = str_replace("\r", "", $list['end']);
  499. $list['front'] = str_replace("\r", "", $list['front']);
  500. $pathes = explode("\n", $list['end']);
  501. $frontpathes = explode("\n", $list['front']);
  502. show(count($pathes)+count($frontpathes), 1, 0, 'total', 1);
  503. $verificate = 0;
  504. foreach($pathes as $path) {
  505.    show('Checking '.$site.$path.' : ', 0, 0, 'logbox', 0);
  506.    $verificate++; show($verificate, 0, 0, 'verified', 1);
  507.    if(check($path) == 0) show('not found', 1, 0, 'logbox', 0);
  508.    else{
  509.        show('<span style="color: #00FF00;"><strong>found</strong></span>', 1, 0, 'logbox', 0);
  510.        show('<a href="'.$site.$path.'">'.$site.$path.'</a>', 1, 0, 'rightcol', 0);
  511.    }
  512. }
  513. preg_match("/\/\/(.*?)\//i", $site, $xx); $site = $xx[1];
  514. if(substr($site, 0, 3) == "www") $site = substr($site, 4);
  515. foreach($frontpathes as $frontpath) {
  516.    show('Checking <!-- m --><a class="postlink" href="http://&#38;#39;.$frontpath.&" onclick="window.open(this.href);return false;">http://&#38;#39;.$frontpath.&</a><!-- m -->#39;.'.$site.'/ : ', 0, 0, 'logbox', 0);
  517.    $verificate++; show($verificate, 0, 0, 'verified', 1);
  518.    if(check($frontpath, 1) == 0) show('not found', 1, 0, 'logbox', 0);
  519.    else{
  520.        show('<span style="color: #00FF00;"><strong>found</strong></span>', 1, 0, 'logbox', 0);
  521.        show('<a href="http://'.$frontpath.'.'.$site.'/">'.$frontpath.'.'.$site.'</a>', 1, 0, 'rightcol', 0);
  522.    }
  523.  
  524. }
  525. ?>

Creditos a http://x0rg.org   ;-) espero les sirva como a mi.
Zalu2
4  Programación / PHP / [PHP] Is online? v3.0 (tool) en: 29 Julio 2015, 20:57 pm
Con la idea de seguir mejorando los códigos, les comparto otro que he modificado y mejorado.
Código
  1. <!DOCTYPE html>
  2. <title> Is online? v3.0 By 2Fac3R</title>
  3. <style>
  4.        body,html{
  5.                background-color:black;
  6.                color:green;
  7.        }
  8.        #ok{
  9.                font-weight:bold;
  10.        }
  11.        #bad{
  12.                font-weight:bold;
  13.                color:red;
  14.        }
  15. </style>
  16. <center>
  17.        <pre>
  18. .___         ________         .__  .__            _________
  19. |   | ______ \_____  \   ____ |  | |__| ____   ___\_____   \
  20. |   |/  ___/  /   |   \ /    \|  | |  |/    \_/ __ \ /   __/
  21. |   |\___ \  /    |    \   |  \  |_|  |   |  \  ___/|   |  
  22. |___/____  > \_______  /___|  /____/__|___|  /\___  >___|  
  23.         \/          \/     \/             \/     \/<___>  
  24.        </pre>
  25.  
  26. <form action="" method="POST">
  27.        URL: <input type="text" name="page" value="http://">
  28.        <input type="submit" name="send" value="Comprobar!">
  29. </form> <br> <i>By 2Fac3R</i> <br> <br>
  30.  
  31.  
  32. <?php
  33. /*
  34.                 ¿Is online? 3.0 By 2Fac3R
  35.         Verificar si un servidor web esta online
  36.                                                                                          */
  37.  
  38. function verificar($url)
  39. {
  40.    $url = htmlentities($url);
  41.        if(filter_var($url,FILTER_VALIDATE_URL) or filter_var($url,FILTER_VALIDATE_IP)){
  42.                echo fopen($url,'r') ? "$url <div id='ok'>Online</div>" : "$url <div id='bad'>Offline</div>";
  43.        }else{
  44.                echo '<script>alert("URL/IP no valida!");window.location=""</script>';
  45.        }
  46. }
  47.  
  48.  
  49. if(!empty($_POST['page'])){
  50.     verificar($_POST['page']);
  51. }
  52. ?>
  53.  
  54. <br><b>Gr33tz to:</b> <br> <br>
  55.  
  56.   xt3mp, arcangel_nigth, ANTRAX, 11Sep, Kr34t0r, GAMARRA, SkippyCreammy, v1c0_h4ck <br>
  57.   w4rning, Snifer, arthusu, Kodeinfect, [Q]3rV[0], WilyXem, m3x1c0h4ck, etc, etc, etc ... <br> <br>
  58.   <a href="http://www.underc0de.org"><b>Underc0de.Org</b></a>
  59.   </center>
  60.  

Espero le den utilidad.
Zalu2
5  Programación / PHP / [ENG] Validation (Hashphp.org) en: 29 Julio 2015, 20:54 pm
Validating User Input

As many of you might be aware, one of the staples of any web application security is to make sure that data passed to you from the user won't break your application or otherwise damage your data. Just like you'd check to see who is at the door of your house before you let them in, you'd check user supplied data to see if it is acceptable for whatever you intend to use it for.

Another reason to validate input is simply because you can provide more intuative responses to the user. They may hit a letter by accident while typing in a number. It is far more clear to the user if you inform them that they've made a mistake and allow them to correct it, rather than have the application break, or worse, have the application continue with an unexpected result.

In PHP, user input arrives as one of two types: an array, or a string. Since the most common form of validation involves checking to see if the user has provided a valid integer representation inside one of the string values, we will focus on this point.

What Could Possibly Happen If I Don't?

Well, it largely depends on what your application is doing. It could be as simple as throwing a big ugly error, but it could also be a lot worse. Take the following highly insecure code example:

Código
  1. <?php
  2.  
  3. $user_id = 1;
  4. $connection = mysql_connect('myserver.com', 'username', 'password');
  5. mysql_select_db('my_database', $connection);
  6. $query = "SELECT secret_data FROM mytable WHERE string_col = '{$_GET['string_col']}' AND int_col = {$_GET['int_col']} AND user_id={$user_id}";
  7. $result = mysql_query($query);
  8. $row = mysql_fetch_assoc($result);
  9.  
  10. ?>

This piece of code seems simple enough. Open a connection to 'myserver.com', and select a row from 'mytable'. What could possibly go wrong? As it turns out, quite a lot. This particular piece of code has two very distinct problems which we'll look at.

First off, we're not validating the user input at all. This is a problem in cases where the program expects a certain kind of input and we don't explicitly check for that input. I've purposefully labeled the columns "int_col" and "string_col" to let you know what types they are in the table. Notice that one is specifically an integer. Now, if the user enters a non-integer value in to that column, the query will error.

What not to do

Many people will be tempted to use one or more of the following when faced with validating integers:

    Cast the input to INT
    Use ctype_digit()
    Use is_numeric()

These are all the wrong ways to approach this problem.

Why casting to INT is bad

Casting to INT is often not a good idea from the standpoint that the behaviour is confusing to the user. For example if they accidentally enter the value "123r5" casting to INT will make this value "123". This could lead to results that simply don't make sense from the user's perspective. It is a much better idea to reject the input and ask them to enter a whole number.

Why ctype_digit() is bad

ctype_digit() has two main flaws when dealing with integer validation:

    It is incapable of dealing with signed numbers, so we can't validate negative values
    If the number is cast to an INT, it will treat the values from 0 - 255 as a character rather than a number

Why is_numeric() is bad

Many people reach for is_numeric() thinking this is a good approach, and it will seem to work just fine. However the problem with is_numeric() isn't that it can't detect an integer, it is that it detects a lot more than just integers. All of the following are valid numbers to is_numeric():

    1
    1.123
    0xFF
    +0123.45e6

See the problem? If we really want just an integer, this function is too broad.

So, how do I fix it?

The best way to fix this sort of validation issue is to use php's filter library. This library is designed to help you check and sanitize user input. For example, we could change our application to use filter_var() and it might look like this:

Código
  1. <?php
  2.  
  3. // do some validation first!
  4. if (filter_var($_GET['int_col'], FILTER_VALIDATE_INT) === false) {
  5.  die('You must enter a valid integer!');
  6. }
  7.  
  8. $user_id = 1;
  9. $connection = mysql_connect('myserver.com', 'username', 'password');
  10. mysql_select_db('my_database', $connection);
  11. $query = "SELECT secret_data FROM mytable WHERE string_col = '{$_GET['string_col']}' AND int_col = {$_GET['int_col']} AND user_id={$user_id}";
  12. $result = mysql_query($query);
  13. $row = mysql_fetch_assoc($result);
  14.  
  15. ?>
  16.  

Now if we try to enter anything but a number for $_GET['int_col'] it won't get to the point where it asks MySQL for data. These kinds of validations are perfect for form data, and can allow you to decide to render the form again with errors to inform the user that they have made a mistake, and to try again. However, we're not quite finished here just yet. There is a remaining problem. The dreaded SQL injection.

What Is an SQL Injection Attack?



An SQL injection attack is when a user injects SQL commands in to an unprotected SQL query. This can lead to a number of issues, including modifying rows you didn't intend for the user to modify, dropped tables, deleted rows, and access to possibly sensitive data. It is critical that you learn and understand how these attacks work. SQL injection attacks are arguably the most common way PHP websites get exploited. The importance can not be overstated.

Initially, in code, the part where we build our query looks like this:

Código
  1. <?
  2. $query = "SELECT secret_data FROM mytable WHERE string_col = '{$_GET['string_col']}' AND int_col = {$_GET['int_col']} AND user_id={$user_id}";
  3. ?>

If I call: http://mysite.com/my_vulnerable_file.php?string_col=some_data%27+OR+1%3D1+--+&int_col=1 then:

    $_GET['string_col'] has a value of "some_data' OR 1=1 -- "
    $_GET['int_col'] has a value of "1"
    $user_id has a value of "1" (we set this in code, it is not a user supplied value)

When the code gets to the point where it builds the query, it winds up looking something like this:

Código
  1. SELECT secret_data FROM mytable WHERE string_col = 'some_data' OR 1=1 -- ' and int_col = 1 and user_id = 1

Notice the double dash. This is a mysql comment token, and it will cause everything after it to be ignored. To MySQL, the query now looks like this:

Código
  1. SELECT secret_data FROM mytable WHERE string_col = 'some_data' OR 1=1
  2.  
Which is clearly now ignoring our $user_id variable, and the int_col clause in favour of what the attacker has chosen. You can probably imagine how bad this could get if instead of a SELECT the query happens to be an UPDATE or DELETE. Depending on the database library, it may also allow multiple queries to be specified in the same string, meaning the innocent SELECT could also have an entirely new query piggy-backed on to it.

How to Deal With Injection Attacks

So, we started off protecting our integer value, but what about the string value? Technically, a string could be any sequence of characters. If your program needs to allow them to be anything, we still have to protect our code. So how do we do this?

As with many things, there are several ways to deal with this problem depending on what database library you're using. To start off, we'll look at the standard mysql library used in the previous examples. The best way to avoid injection attacks when dealing with the standard mysql library, is to escape your parameters. We can do this with mysql_real_escape_string().

For example:

Código
  1. <?php
  2.  
  3. // do some validation first!
  4. if (filter_var($_GET['int_col'], FILTER_VALIDATE_INT) === false) {
  5.  die('You must enter a valid integer!');
  6. }
  7.  
  8. $user_id = 1;
  9. $connection = mysql_connect('myserver.com', 'username', 'password');
  10. mysql_select_db('my_database', $connection);
  11. // escape parameters after the database connection is open because it asks the database how to escape things
  12. $escaped_int_col = mysql_real_escape_string($_GET['int_col']);
  13. $escaped_string_col = mysql_real_escape_string($_GET['string_col']);
  14. $query = "SELECT secret_data FROM mytable WHERE string_col = '{$escaped_string_col}' AND int_col = {$escaped_int_col} AND user_id={$user_id}";
  15. $result = mysql_query($query);
  16. $row = mysql_fetch_assoc($result);
  17.  
  18. ?>

So what's happening here? Consider our previous example where the attacker was sending a malicious string.

    some_data' OR 1=1 --

now becomes

    some_data\' OR 1=1 --

See the subtle difference? The "\" character makes it so that the quote in the string is now harmless, and instead of closing the value prematurely it will just be a part of the string. This is just one of the many bad characters mysql_real_escape_string() will fix for you.

Using Prepared Statements to Stop Injection Attacks

We've stopped the injection attack! Hurray! But what if there were an easier, better way to do all this? The good news is, there is! PHP comes with another database library to deal with MySQL. It is called PHP Data Objects or PDO for short. This library can use drivers for many different database types, and supports a very important feature known as prepared statements, sometimes also known as parametrized queries.

So what do these prepared statements do? Well, quite a lot. They allow us to design our query ahead of time and to put placeholders in the areas where our user supplied data will go. Then when we ask the library to inject the values, it automatically escapes them for us. Consider this example:
Código
  1. <?php
  2.  
  3. // do some validation first!
  4. if (filter_var($_GET['int_col'], FILTER_VALIDATE_INT) === false) {
  5.  die('You must enter a valid integer!');
  6. }
  7.  
  8. $dsn = 'mysql:dbname=my_database;host=myserver.com';
  9. $username = 'username';
  10. $password = 'password';
  11. $user_id = 1;
  12.  
  13. // Set up PDO
  14. $pdo = new PDO($dsn, $username, $password);
  15. // Our parametrized query using placeholders.  No need for quotes around values, it will do this for us.
  16. $query = "SELECT secret_data FROM mytable WHERE string_col = ? AND int_col = ? AND user_id = ?";
  17. // our input values in order for the place holders.  No need to escape, it will do it for us!
  18. $parameters = array($_GET['string_col'], $_GET['int_col'], $user_id);
  19. // Prepare the query
  20. $statement = $pdo->prepare($query);
  21. // execute the query with our parameters
  22. $statement->execute($parameters);
  23. // Get the first returned row
  24. $row = $statement->fetch(PDO::FETCH_ASSOC);
  25.  
  26. ?>

Not only is this method much cleaner, but we can't forget to escape our parameters because PDO is kind enough to do it for us.

Another advantage of prepared statements is that you can use the prepared statement over and over by simply replacing the parameters and executing it again. Many servers detect that you're doing this, and even make the query faster by performing server-side optimizations.

Fuente/Source: http://wiki.hashphp.org/Validation
6  Programación / Programación C/C++ / [ESTRUCTURA DE DATOS] Listas doblemente ligadas [C++] en: 29 Julio 2015, 20:50 pm
Buenas!

Resulta que he estado estudiando en la universidad las estructuras de datos en C++, y me gustaría compartirles algunos códigos que he estado haciendo en este tiempo, son códigos más que nada de la escuela. He buscado información al respecto en internet, y la mayoria (por no decir todos) están hechos en C (los que he visto en español), utilizan estructuras con struct y no objetos en C++, así que sirve que alimentamos el internet y el foro  ;D .

No les voy a mostrar teoría sobre el tema, eso se los dejo a su búsqueda.

listas.h
Código
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #ifndef __LISTAS_H_INCLUDED__
  6. #define __LISTAS_H_INCLUDED__
  7.  
  8. class Nodo{
  9.  
  10. private:
  11.    int dato;
  12.    Nodo *sig;
  13.    Nodo *ant;
  14. public:
  15.    Nodo(void) { sig = ant = NULL; }
  16.  
  17.    Nodo( int x , Nodo* s = NULL , Nodo* a = NULL )
  18.    {
  19.        dato = x;
  20.        sig = s;
  21.        ant = a;
  22.    }
  23.  
  24.    // SETTERS
  25.    void setDato(int x) { dato = x; }
  26.    void setAnt(Nodo *a) { ant = a; }
  27.    void setSig(Nodo *s) { sig = s; }
  28.  
  29.    // GETTERS
  30.    int getDato()  { return dato;}
  31.    Nodo *getAnt() { return ant; }
  32.    Nodo *getSig() { return sig; }
  33.  
  34. };
  35.  
  36. class Lista
  37. {
  38. private:
  39.    Nodo *lista; // ancla
  40. public:
  41.    Lista(void) { Inicializar(); } // CONSTRUCTOR
  42.  
  43.    // METODOS BASICOS
  44.  
  45.    Nodo *Primero() { return lista; }
  46.    Nodo *Siguiente(Nodo *pos) { return pos->getSig(); }
  47.    Nodo *Anterior(Nodo *pos) { return pos->getAnt(); }
  48.  
  49.    Nodo *Ultimo() {
  50.        Nodo *aux = lista;
  51.  
  52.        if ( !Vacia() ) { while ( aux->getSig() ) { aux = aux->getSig(); } }
  53.        return aux;
  54.    }
  55.  
  56.    // METODOS DE LA LISTA
  57.    void Inicializar() { lista = NULL; }
  58.    bool Vacia() { return lista==NULL; }
  59.    void Mostrar();
  60.    void Insertar(int x, Nodo* pos = NULL);
  61. };
  62.  
  63.  
  64. void Lista::Insertar(int x, Nodo* pos)
  65. {
  66.    Nodo* aux;
  67. Nodo* temp_n = new Nodo(x);
  68.  
  69. if ( Vacia() ){
  70. lista = temp_n;
  71.  
  72. }else{
  73. if ( pos == Primero() ){
  74. aux = Primero();
  75. aux->setAnt(temp_n);
  76.  
  77. temp_n->setSig(aux);
  78. lista = temp_n;
  79.  
  80. }else if ( pos == NULL ){
  81.  
  82. aux = Ultimo();
  83. aux->setSig(temp_n);
  84. temp_n->setAnt(aux);
  85.  
  86. }else{
  87. aux = Primero();
  88.  
  89. while ( aux ){
  90. if ( aux == pos ){
  91. Anterior(aux)->setSig( temp_n );
  92.  
  93. temp_n->setAnt( Anterior(aux) );
  94. temp_n->setSig( aux );
  95.  
  96. aux->setAnt( temp_n );
  97.  
  98. }else {
  99.    aux = aux->getSig();
  100.                }
  101. }
  102. }
  103. }
  104. }
  105.  
  106. void Lista::Mostrar()
  107. {
  108.    Nodo* aux;
  109.  
  110.    Primero();
  111.    aux = lista;
  112. if ( !Vacia() ){
  113. while ( aux ){
  114.            cout << aux ->getDato();
  115.            cout << "\n";
  116.            aux = aux ->getSig();
  117. }
  118. }
  119. }
  120.  
  121. #endif
  122.  
  123.  

main.cpp
Código
  1. #include <iostream>
  2. #include "listas.h"
  3.  
  4. using namespace std;
  5.  
  6. int main(void)
  7. {
  8.    Lista numeros; // Mi lista
  9.    char opc; // Opcion del menu
  10.    int n; // dato a insertar
  11.  
  12.    do{
  13.        cout << "\n \n  LISTAS DOBLEMENTE LIGADAS: ";
  14.        cout << "\n *- MENU -* ";
  15.        cout << "\n 1. AGREGAR A LA LISTA . ";
  16.        cout << "\n 2. MOSTRAR LOS DATOS . ";
  17.        cout << "\n 3. SALIR . ";
  18.        cout << "\n         _> ";
  19.        cin >> opc;
  20.  
  21.        switch(opc){
  22.        case '1':
  23.            cout << "\n AGREGANDO DATOS A LA LISTA . ";
  24.            cout << "\n INGRESE EL VALOR NUMERICO . ";
  25.            cout << "\n         _> ";
  26.            cin >> n;
  27.            numeros.Insertar(n);
  28.            cout << " --> < Guardado correctamente > " << endl;
  29.            break;
  30.        case '2':
  31.            if(numeros.Vacia())
  32.            {
  33.                cout << "\n < No hay registros!. > ";
  34.                break;
  35.            }
  36.  
  37.            cout << "\n \n DATOS GUARDADOS EN LA LISTA: \n ";
  38.            numeros.Mostrar();
  39.            break;
  40.        case '3':
  41.            cout << " - < Saliendo!...... >" << endl;
  42.            break;
  43.        default:
  44.            cout << " - < Opcion incorrecta!, intente de nuevo. >" << endl;
  45.            break;
  46.  
  47.        }
  48.  
  49.    }while(opc!='3');
  50.  
  51.    cin.ignore();
  52.    return 0;
  53. }
  54.  
  55.  

Espero que les sea de utilidad, y son bienvenidas sus criticas y/o comentarios  8)
Zalu2!



Buenas!

Hace poco cree un tema sobre un en C++, pues quería compartirles otro código que no lo hice para la escuela y por lo tanto me dió más tiempo de currarmelo más y agregarle más métodos  ;D .

Código
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #define ASCENDENTE 1
  5. #define DESCENDENTE 0
  6.  
  7. class nodo
  8. {
  9. private:
  10.    int valor;
  11.    nodo *siguiente;
  12.    nodo *anterior;
  13.  
  14.    friend class lista;
  15.  
  16. public:
  17.    nodo(int v, nodo *sig = NULL, nodo *ant = NULL) // CONSTRUCTOR
  18.    {
  19.        valor = v;
  20.        siguiente = sig;
  21.        anterior = ant;
  22.    }
  23.    // SETTERS
  24.    void setAnterior(nodo *ant) { anterior = ant; }
  25.    void setSiguiente(nodo *sig) { siguiente = sig; }
  26.  
  27.    // GETTERS
  28.    int getValor() { return valor; }
  29.    nodo *getSiguiente() { return siguiente; }
  30.    nodo *getAnterior() { return anterior; }
  31. };
  32.  
  33.  
  34. class lista
  35. {
  36. private:
  37.    nodo  *plista; // ANCLA
  38.  
  39. public:
  40.    lista(){ plista = NULL; } // CONSTRUCTOR
  41.  
  42.    ~lista(); // DESTRUCTOR
  43.  
  44.    // METODOS DE LA LISTA
  45.    void Insertar(int v);
  46.    void Borrar(int v);
  47.    bool ListaVacia() { return plista == NULL; }
  48.    void Mostrar(int);
  49.  
  50.    // METODOS DE POSICION
  51.    void Siguiente() { if(plista) plista = plista->getSiguiente(); }
  52.    void Anterior() { if(plista) plista = plista->getAnterior(); }
  53.    void Primero() {  while(plista && plista->getAnterior()) plista = plista->getAnterior(); }
  54.    void Ultimo() {  while(plista && plista->getSiguiente()) plista = plista->getSiguiente(); }
  55.    int ValorActual() { return plista->valor; }
  56.  
  57. };
  58.  
  59. lista::~lista() // VACIAMOS LA LISTA
  60. {
  61.   nodo *aux;
  62.  
  63.   Primero();
  64.   while(plista) {
  65.      aux = plista;
  66.      plista = plista->getSiguiente();
  67.      delete aux;
  68.   }
  69. }
  70.  
  71. void lista::Insertar(int v)
  72. {
  73.    nodo *nuevo;
  74.  
  75.    Primero();
  76.    // Si la lista está vacía
  77.    if(ListaVacia() || plista->getValor() > v)
  78.    {
  79.      nuevo = new nodo(v, plista);
  80.      if(!plista) plista = nuevo;
  81.      else plista->setAnterior(nuevo);
  82.    }
  83.    else
  84.    {
  85.      while(plista->getSiguiente() && plista->getSiguiente()->getValor() <= v) Siguiente();
  86.      // Creamos un nuevo nodo después del nodo actual
  87.      nuevo = new nodo(v, plista->getSiguiente(), plista);
  88.      plista->setSiguiente(nuevo);
  89.      if(nuevo->getSiguiente()) nuevo->getSiguiente()->setAnterior(nuevo);
  90.    }
  91. }
  92.  
  93. void lista::Borrar(int v)
  94. {
  95.   nodo *nodo;
  96.  
  97.   nodo = plista;
  98.   while(nodo && nodo->getValor() < v) nodo = nodo->getSiguiente();
  99.   while(nodo && nodo->getValor() > v) nodo = nodo->getAnterior();
  100.  
  101.   if(!nodo || nodo->getValor() != v) return;
  102.   // Borrar el nodo
  103.  
  104.   if(nodo->getAnterior()) // no es el primer elemento
  105.      nodo->getAnterior()->setSiguiente(nodo->getSiguiente());
  106.   if(nodo->getSiguiente()) // no el el último nodo
  107.      nodo->getSiguiente()->setAnterior(nodo->getAnterior());
  108.   delete nodo;
  109. }
  110.  
  111. void lista::Mostrar(int orden)
  112. {
  113.    nodo *nodo;
  114.    if(orden == ASCENDENTE)
  115.    {
  116.        Primero();
  117.        nodo = plista;
  118.        while(nodo)
  119.        {
  120.        cout << nodo->getValor() << "-> ";
  121.        nodo = nodo->getSiguiente();
  122.        }
  123.    }
  124.    else
  125.    {
  126.        Ultimo();
  127.        nodo = plista;
  128.        while(nodo)
  129.        {
  130.            cout << nodo->getValor() << "-> ";
  131.            nodo = nodo->getAnterior();
  132.        }
  133.    }
  134.    cout << endl;
  135. }
  136.  
  137. int main(void) {
  138.    lista Lista;
  139.  
  140.    Lista.Insertar(20);
  141.    Lista.Insertar(10);
  142.    Lista.Insertar(40);
  143.    Lista.Insertar(30);
  144.  
  145.    Lista.Mostrar(ASCENDENTE);
  146.    Lista.Mostrar(DESCENDENTE);
  147.  
  148.    Lista.Primero();
  149.    cout << "Primero: " << Lista.ValorActual() << endl;
  150.  
  151.    Lista.Ultimo();
  152.    cout << "Ultimo: " << Lista.ValorActual() << endl;
  153.  
  154.    Lista.Borrar(10);
  155.    Lista.Borrar(15);
  156.    Lista.Borrar(45);
  157.    Lista.Borrar(40);
  158.  
  159.    Lista.Mostrar(ASCENDENTE);
  160.    Lista.Mostrar(DESCENDENTE);
  161.  
  162.    return 0;
  163. }
  164.  

Espero que les guste y les sirva, cualquier duda y/o comentario me lo hacen saber  ::).

Zalu2!
7  Programación / Programación C/C++ / [ESTRUCTURA DE DATOS] Árbol binario [C++] en: 29 Julio 2015, 20:48 pm
Buenas!.

Otro tema muy importante en la estructura de datos son el manejo de árboles binarios, les comparto un ejemplo que hice para la escuela del tema, está hecho para un sistema de vuelos, por lo tanto uso la clase Pasajeros , pero ustedes pueden usar el tipo de dato que quieran almacenar en el árbol.

Código
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #include "Pasajero.h"
  6.  
  7. #ifndef __arbolbinario_H_INCLUDED__
  8. #define __arbolbinario_H_INCLUDED__
  9.  
  10.  
  11. class Nodo
  12. {
  13. private:
  14.    Pasajero *dato;
  15.    Nodo *izq; //enlace izquierdo
  16.    Nodo *der; //enlace derecho
  17.  
  18. public:
  19.    Nodo(Pasajero *info); // CONSTRUCTOR
  20.    ~Nodo(); // DESTRUCTOR
  21.  
  22.    // METODOS GET
  23.    Pasajero *getPasajero() { return dato;}
  24.    Nodo *getIzq() { return izq;}
  25.    Nodo *getDer() { return der;}
  26.  
  27.    // METODOS SET
  28.    void setIzq(Nodo *i) { izq = i;}
  29.    void setDer(Nodo *d) { der = d;}
  30.  
  31. };
  32.  
  33. Nodo::Nodo(Pasajero *info)
  34. {
  35.    dato = info;
  36.    izq = NULL;
  37.    der = NULL;
  38. }
  39.  
  40. Nodo::~Nodo()
  41. { }
  42.  
  43. class ArbolBinario
  44. {
  45.    private:
  46.        Nodo *raiz;
  47.        Nodo *Insertar(Nodo*,Pasajero*);
  48.        Nodo *Borrar(Nodo*, Pasajero*);
  49.        void preOrden(Nodo*);
  50.        void inOrden(Nodo*);
  51.        void postOrden(Nodo*);
  52.    public:
  53.        ArbolBinario();
  54.        Nodo *getRaiz() { return raiz;} // testing method
  55.        void Crear(Pasajero*);
  56.        void Recorridos(int);
  57.        void Eliminar(int);
  58.        Pasajero *Buscar(string, Nodo*);
  59.  
  60.        ~ArbolBinario();
  61. };
  62.  
  63. ArbolBinario::ArbolBinario(){
  64.    raiz = NULL;
  65. }
  66.  
  67. Nodo* ArbolBinario::Insertar(Nodo *p, Pasajero *q){
  68.    if(p == NULL){
  69.        p = new Nodo(q);
  70.    }
  71.    else{
  72.        string a = p -> getPasajero()-> getApellido(); // Primera letra del apellido que esta en la raiz
  73.  
  74.        if(q->getApellido()[0] <= a[0])
  75.        {
  76.            p->setIzq( Insertar(p->getIzq(),q) );
  77.  
  78.        }
  79.        else{
  80.            p->setDer( Insertar(p->getDer(),q) );
  81.        }
  82.    }
  83.  
  84.    return p;
  85. }
  86.  
  87. void ArbolBinario::Crear(Pasajero *q)
  88. {
  89.     raiz = Insertar(raiz,q);
  90. }
  91.  
  92. void ArbolBinario::preOrden(Nodo *p){
  93.    if(p != NULL){
  94.        cout << "\n " << p->getPasajero()->getApellido();
  95.        preOrden(p->getIzq());
  96.        preOrden(p->getDer());
  97.    }
  98. }
  99.  
  100. void ArbolBinario::inOrden(Nodo *p){
  101.    if(p != NULL){
  102.        inOrden(p->getIzq());
  103.        cout << "\n " << p->getPasajero()->getApellido();
  104.        inOrden(p->getDer());
  105.    }
  106. }
  107.  
  108. void ArbolBinario::postOrden(Nodo *p){
  109.    if(p != NULL){
  110.        cout << " \n " << p->getPasajero()->getApellido();
  111.        postOrden(p->getIzq());
  112.        postOrden(p->getDer());
  113.    }
  114. }
  115.  
  116. void ArbolBinario::Recorridos(int tipo){
  117.    switch(tipo){
  118.        case 1:
  119.            preOrden(raiz);
  120.        break;
  121.  
  122.        case 2:
  123.            inOrden(raiz);
  124.        break;
  125.  
  126.        case 3:
  127.            postOrden(raiz);
  128.        break;
  129.  
  130.        default:
  131.            cout << " - Error! opcion invalida!. -" << endl;
  132.  break;
  133.    }
  134. }
  135.  

Espero que les sea de utilidad!.

Para más información véase -> Árbol binario de búsqueda

Zalu2!
8  Programación / Programación C/C++ / [Métodos de ordenamiento] QuickSort [C++] en: 29 Julio 2015, 20:47 pm
Buenas!.

El método de ordenamiento quicksort es un método muy eficaz a la hora de ordenar datos, les comparto un código que implemente en un proyecto escolar, está basado para ordenar fechas de salida de vuelos, pero ustedes pueden implementarlo para ordenar cualquier otro tipo de dato.

Código
  1. void QuickSortF( N_Vuelo** arr, int izq, int der ){
  2. int g, h, medio;
  3. N_Vuelo *pivote, *aux;
  4. medio = ( izq + der )/2;
  5. pivote = arr[medio];
  6. g = izq;
  7. h = der;
  8.  
  9. while( g <= h ){
  10.  
  11. while ( arr[g]->getDato()->getFS(1) < pivote->getDato()->getFS(1) ) { g++; }
  12. while ( pivote->getDato()->getFS(1) < arr[h]->getDato()->getFS(1) ) { h--; }
  13.  
  14. if( g <= h ){
  15. aux = arr[g];
  16. arr[g] = arr[h];
  17. arr[h] = aux;
  18. g++;
  19. h--;
  20. }
  21. }
  22.  
  23. if ( izq < h ) { QuickSortF(arr, izq, h); }
  24. if ( g < der ) { QuickSortF(arr, g, der); }
  25. }
  26.  

En los condicionales if iría la condición de ordenamiento de el tipo de dato que quieras implementar, cualquier duda y/o comentario hazmelo saber!.

Zalu2
9  Programación / PHP / Conversor de textos By 2Fac3R v4.0 en: 29 Julio 2015, 20:46 pm
Buenas!

He estado dandole vueltas a mis códigos (más que nada para no oxidarme) y creo que se pueden seguir mejorando los códigos, lo comparto con ustedes por si a alguien le es de utilidad.

Código
  1.  
  2. <title> Conversor de textos By 2Fac3R v4.0</title>
  3.  
  4. <form action="" method="POST">
  5. <select name="convertir">
  6. <option value="bin2hex"> BinToHex </option>
  7. <option value="encode"> Encode </option>
  8. <option value="decode"> Decode </option>
  9. <option value="gzinflate"> gzinflate </option>
  10. <option value="utf-7"> Encode UTF-7</option>
  11. <option value="ASCII"> ASCII </option>
  12. <option value="MD5"> MD5 </option>
  13. <option value="SHA1"> SHA1 </option>
  14. <option value="Base64_encode"> Base64 encode</option>
  15. <option value="Base64_decode"> Base64 decode</option>
  16. <option value="bindec"> Binario To Decimal</option>
  17. <option value="mcrypt">mcrypt</option>
  18. </select>
  19. <input type="text" name="str">
  20. <input type="submit" name="enviado" value="Convertir!">
  21. </form>
  22.  
  23. <?php
  24. /*
  25.  * Conversor de textos
  26.  * .- Underc0de.org -.
  27.  *   v4.0 2015
  28.  * Autor: 2Fac3R
  29.  *
  30.  * Gr33tz to:
  31.  *
  32.  * xt3mp, arcangel_nigth, EddyW, ANTRAX, 11Sep, Kr34t0r, GAMARRA, SkippyCreammy, v1c0_h4ck, w4rning, Snifer,
  33.  * arthusu, Kodeinfect, [Q]3rV[0], WilyXem, m3x1c0h4ck, etc, etc...
  34.  *
  35.  * */
  36.  
  37.  
  38. function convertir($a, $string){ // a : eleccion, string:texto
  39.  
  40. switch($a){
  41. case 'bin2hex':
  42. $res = bin2hex($string);
  43. break;
  44. case 'encode':
  45. $res = urlencode($string);
  46. break;
  47. case 'gzinflate':
  48. $res = gzinflate($string);
  49. case 'decode':
  50. $res = htmlentities(urldecode($string));
  51. break;
  52. case 'utf-7':
  53. $res = mb_convert_encoding($string,'UTF-7');
  54. break;
  55. case 'ASCII':
  56. for($i=0;$i<strlen($string);$i++){
  57. $obt=ord($string[$i]);
  58. $ascii=$obt.',';
  59. }
  60. $res = $ascii;
  61. break;
  62. case 'MD5':
  63. $res = md5($string);
  64. break;
  65. case 'SHA1':
  66. $res = sha1($string);
  67. break;
  68. case 'Base64_encode':
  69. $res = base64_encode($string);
  70. break;
  71. case 'Base64_decode':
  72. $res = base64_decode($string);
  73. break;
  74. case 'bindec':
  75. $res = bindec($string);
  76. break;
  77. case 'mcrypt':
  78. $res = crypt($string);
  79. break;
  80. default:
  81. die("Ha habido un error <a href=''> Regresar! </a>");
  82. break;
  83. }
  84. return $res;
  85. }
  86.  
  87. if(!empty($_POST['enviado']) && isset($_POST['str']))
  88. {
  89. echo '<b>Original:</b> '.htmlentities($_POST['str']).' </br></br>';
  90. echo '<textarea rows=4 cols=50>' .convertir($_POST['convertir'],$_POST['str']).'</textarea>';
  91. }
  92.  
  93. ?>
  94.  
  95.  

Comentarios, criticas, consejos son bienvenidos.
Zalu2!
10  Programación / PHP / [Tool] Convertidor de textos By 2Fac3R v2.0 en: 14 Marzo 2012, 04:40 am
Bueno, pues he hecho una segunda version de esta tool, la cual me ha servido en bastantes cosas que he hido haciendo y decido compartirla. La version 1 la pueden encontrar en este misma web/foro.

Código
  1. <title> Conversor de string By 2Fac3R v2.0 </title>
  2. <?php
  3. /*
  4. Conversor de string By 2Fac3R v2.0
  5.   http://breaksecurity.blogspot.com/
  6.     */
  7. $string = $_POST['str'];
  8. $conv = $_POST['convertir'];
  9. function res($func){
  10. global $string;
  11. echo "Resultado: <br> <textarea cols='80' rows='5'>".$func."</textarea><br>";
  12. echo "Normal: <b>".htmlentities($string)."</b> <br>";
  13. echo "<a href=''> Regresar! </a>";
  14. }
  15. if(isset($string) && !empty($string)){
  16. switch($conv){
  17. case 'bin2hex':
  18. res(bin2hex($string));
  19. break;
  20. case 'encode':
  21. res(urlencode($string));
  22. break;
  23. case 'decode':
  24. res(htmlentities(urldecode($string)));
  25. break;
  26. case 'utf-7':
  27. res(mb_convert_encoding($string,'UTF-7'));
  28. break;
  29. case 'ASCII':
  30. echo "Resultado: <br><textarea>";
  31. for($i=0;$i<strlen($string);$i++){
  32. $obt=ord($string[$i]);
  33. $ascii=$obt.',';
  34. echo $ascii;
  35. }
  36. echo "</textarea><br> Normal: <b>".htmlentities($string)."</b><br><a href=''> Regresar! </a>";
  37. break;
  38. case 'MD5':
  39. res(md5($string));
  40. break;
  41. case 'SHA1':
  42. res(sha1($string));
  43. break;
  44. case 'Base64_encode':
  45. res(base64_encode($string));
  46. break;
  47. case 'Base64_decode':
  48. res(base64_decode($string));
  49. break;
  50. case 'bindec':
  51. res(bindec($string));
  52. break;
  53. default:
  54. die("Ha habido un error <a href=''> Regresar! </a>");
  55. break;
  56. }
  57. }else{
  58. if(isset($_POST['send'])){?>
  59. <script>alert("Campo de texto vacio");</script>
  60. <noscript>Campo de texto vacio <br> <font color="RED"> Activa el javascript para una mejor visualizacion </font></noscript>
  61. <?}?>
  62. <!-- Conversor de string By 2Fac3R v2.0 -->
  63. <form action="" method="POST">
  64. <select name="convertir">
  65. <option value="bin2hex"> BinToHex </option>
  66. <option value="encode"> Encode </option>
  67. <option value="decode"> Decode </option>
  68. <option value="utf-7"> Encode UTF-7</option>
  69. <option value="ASCII"> ASCII </option>
  70. <option value="MD5"> MD5 </option>
  71. <option value="SHA1"> SHA1 </option>
  72. <option value="Base64_encode"> Base64 encode</option>
  73. <option value="Base64_decode"> Base64 decode</option>
  74. <option value="bindec"> Binario To Decimal</option>
  75. </select>
  76. <input type="text" name="str">
  77. <input type="submit" name="send" value="Convertir!">
  78. </form>
  79. <?}?>

Espero les sirva, cualquier bug, comentario y/o critica son bienvenidos ;D
Zalu2
Páginas: [1] 2 3 4
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines