Hacking 40 Websites in 7 minutes

Last summer I started learning about information security and hacking. Over the last year I’ve played in various wargames, capture the flag and penetration testing simulations, continuously improving my hacking skills and learning new things about ‘how to make computers deviate from their expected behavior’.

Long story short, my experience was always limited to simulated environments, and since I consider myself a white-hat hacker (aka one of the good guys) I never stuck my nose into other peoples’ businesses — quite literally. Continue reading Hacking 40 Websites in 7 minutes

Consulta para Validar Vigencias con MySQL (SQL)

Esto puede parecer una locura pero a mas de uno puede resultarle de ayuda. Muchos caen en el error durante la validación y es una de quebrarse la cabeza. Es por eso que les propongo una solución:

  1. SELECT * FROM cupones WHERE DATE(vigencia_ini)<=DATE(‘2017-07-31’) AND DATE(vigencia_fin)>=DATE(‘2017-07-31’);

1-2017-03-10 -> 2017-05-10
2-2017-03-15 -> 2017-06-15
3-2017-03-30 -> 2017-07-30
4-2017-03-30 -> 2017-07-30
5-2017-03-30 -> 2017-07-30

En este ejemplo con la fecha que envió no obtendría resultado alguno, por que excede la vigencia fin.
Si cambio la fecha a 2017-07-15 obtendríamos los registros: 3,4,5

La explicación rápidamente es que la fecha de la vigencia inicial debe ser menor o igual a la fecha a validar. Y la fecha de vigencia final debe ser mayor o igual a la fecha a validar. Así de sencillo, tómense su tiempo para la reflexión.


Disable auto save in JetBrains IDE’s (IntelliJ IDEA, PhpStorm, more)

JetBrains provides the following IDE software:

  • IntelliJ IDEA
  • PhpStorm
  • PyCharm
  • RubyMine
  • WebStorm
  • AppCode
  • CLion

Google also provides Android Studio which is powered by the IntelliJ platform.

If you come from a different IDE such as Eclipse, you will be unpleasantly surprised to find that JetBrains-branded IDEs automatically save everything the moment you look away. The proponents argue that as you work on your project, you should not have to worry about saving files. But to others, this auto-save behavior which is enabled by default is a curse that catches them by surprise, and a shocking departure from the workflow they are very much used to.

You can change the behavior by altering some settings.
After the change:

  • Modifications are no longer automatically saved when you’re just editing.
  • They are saved when you press Ctrl+S.
  • They are saved when you build, compile or run.
  • Refactoring that affect files that are not open are still automatically saved without opening those files.

But first, some caveats:

  • There is no Save for individual tabs. The shortcut Ctrl+S is for “Save All” which will save all modified tabs/files. Be careful and remember this.
  • The “modified” indicator on the tab is slightly different. Instead of something obvious like a real asterisk next to the file name or a color change, the indicator is a subtle asterisk image that appears on top of the file icon (in the tab bar). You may have to look a bit longer at the tab to notice it.
  • Closing a tab with a modified file will not ask you whether to save or discard the changes. Instead the file is maintained in “Local History” in a modified state. When you open the file again, your changes (along with undo-redo history) are retrieved from the Local History. The actual file itself is not saved with your modifications.
  • There is no option to revert changes to the state of file on disk in the IDE user interface.
    • You can force a revert quickly by touching the file (or simply editing it insignificantly in an external editor and saving it) and then switching to the IDE. It will prompt how to resolve the conflict, on which you can select “Load File System Changes”.
    • You can also undo your edits until the asterisk disappears, or revert to an older revision in VCS > Local History. (Note that “File > Synchronize” option acts similar to “Save All” and is not a way to revert.)

How to disable auto-save:

  1. Go to File > Settings (Ctrl+Alt+S).
  2. Go to Appearance & Behavior > System Settings.
  3. Make sure the two are unchecked:
    • Save files on frame deactivation
    • Save files automatically if application is idle for x sec.
  4. Go to Editor > General > Editor Tabs
  5. Put a checkmark on “Mark modified files with asterisk”
  6. (Optional but recommended) Under “Tab Closing Policy”, select “Close non-modified files first”. You may also want to increase the number of allowed tabs.
  7. Click Apply > OK.

That’s it.

JetBrains IDEs are built around the idea that workflows should be centered around a VCS (version control system) where files are logical abstractions of changes, and that VCS should not be an afterthought as it is in the kind of workflows we are used to in other IDEs and programs – manually saving changes to a file in disk, then separately committing changes to VCS. Thus the IDEs come with instant auto-save and a built-in VCS called “Local History”.

However, many of us are not used to this kind of behavior and would want to retain our workflows centered around manually saving edits to a file in disk. Though unfortunately JetBrains IDEs don’t allow us to truly revert to such a workflow (see caveats), at least we can come close with the above setting changes.

src: TheHunk

Redondear numeros medios y enteros

El siguiente código esta hecho en javascript, pero independientemente de eso puedes convertirlo a cualquier plataforma que manejes.

El objetivo básicamente es que si el decimal es menor a .5 se redondea hacia abajo. En caso de ser .5 queda igual y en caso de ser mayor a .5 se redondea hacia arriba (el siguiente entero).

  1. var num = 2.34;
  3. // Elegant way
  4. Math.__proto__.redondeo = function(num){
  5.      return ((num % 1 == .5 ? num : (num % 1 < .5 ? Math.floor(num) : Math.round(num))));
  6. };
  7. alert(“Result: “ + Math.redondeo(num));
  9. // Nasty method
  10. alert((num % 1 == .5 ? num : (num % 1 < .5 ? Math.floor(num) : Math.round(num))));

Ejecutar Procedimientos Almacenados MySQL en Laravel

Hace unos meses se me presento un problema con el que estuve luchando por algunas horas. El problema era como demonios ejecutar un Procedimiento Almacenado de MySQL usando Laravel.
Cabe mencionar que soy un novato en el uso de este Framework y que ademas no me gusta, prefiero usar algo mas sencillo y austero como SlimFramework. Después de estar a prueba y error descubrí por Internet (lo mas seguro que en StackOverflow) la solución, y siento no poder citar la fuente original, ya hace tiempo de eso, no guarde el link, si no mas bien quiero compartirles la solución…

Continue reading Ejecutar Procedimientos Almacenados MySQL en Laravel

Crontab Linux: Basic and Useful Examples

An experienced Linux sysadmin knows the importance of running the routine maintenance jobs in the background automatically.

Linux Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.

This article is part of the on-going Productivity Tips For Geeks series. In this article, let us review 15 awesome examples of crontab job scheduling. Continue reading Crontab Linux: Basic and Useful Examples

Empezando con Bower

Bower, el gestor de dependencias para el desarrollo web frontend que te ayudara con la tarea de instalar y mantener actualizadas las librerías y frameworks en tus proyectos.

Utilizando bower evitamos el proceso manual de descarga de plugins, librerias y mas. De igual manera la actualizacion de los mismos es un proceso tan facil que “ni lo habremos notado”.

Instalacion de Bower

Bower esta construido en nodejs asi que se instala facilmente de la siguiente manera:

npm install -g bower

Continue reading Empezando con Bower

Manejando Ajax en Angular con Laravel

Les comparto el error que acabo de solucionar y me costo algo de tiempo, cabe señalar que nunca había tenido acercamientos con Angular, solo le ayude a un compañero.

El problema surgió al obtener una respuesta desde laravel 4.1 tras haber hecho la petición mediante ajax. Como se maneja el retorno de status nunca entraba por el success. Y probé si tenia la función .error y que creen??? SI LO TENIA xD Continue reading Manejando Ajax en Angular con Laravel

Hay mas felicidad en dar que en recibir.