Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1.  
  2. <?php
  3. function sql_proteccion($Variable) {
  4. $MalasCosas = array('--',
  5. "'",
  6. 'SELECT',
  7. 'UPDATE',
  8. 'ONION',
  9. 'union',
  10. 'UNION',
  11. 'DROP',
  12. 'drop',
  13. 'table',
  14. 'SET',
  15. 'set'
  16. );
  17. foreach ($MalasCosas as $Mala) {
  18. if (strpos(strtolower($Variable), strtolower($Mala)) !== false) {
  19. die("<h4>SQL Injection string detected. htmlentities(strtolower($Mala)) . "'</h4>");
  20. }
  21. }
  22. }
  23. function xss_proteccion($Variable) {
  24. $MalasCosas = array('<img',
  25. 'img>',
  26. 'document.cookie',
  27. 'onerror()',
  28. 'script>',
  29. '<script',
  30. 'alert()'
  31. );
  32. foreach ($MalasCosas as $Mala) {
  33. if (strpos(strtolower($Variable), strtolower($Mala)) !== false) {
  34. die("<h4>XSS String detected '". htmlentities(strtolower($Mala)) . "'</h4>");
  35. }
  36. }
  37. }
  38. $DefinedVARS = get_defined_vars();
  39. foreach ($DefinedVARS['_COOKIE'] as $key => $value) {
  40. xss_proteccion($value);
  41. sql_proteccion($value);
  42. }
  43. foreach ($DefinedVARS['_POST'] as $key => $value) {
  44. xss_proteccion($value);
  45. sql_proteccion($value);
  46. }
  47. foreach ($DefinedVARS['_GET'] as $key => $value) {
  48. xss_proteccion($value);
  49. sql_proteccion($value);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement