Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Exploiter php 5

6,963 views

Published on

Présentation pour l'AFUP Orléans sur les outils de PHP 5

  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Exploiter php 5

  1. 1. Exploiter PHP 5en utilisant tous les outils quil met a disposition
  2. 2. En face de vous...• Jean-François Lépine (jeanfrancois@lepine.pro)• Vice secrétaire de lAFUP• auteur du mémento PHP 5 Industrialisation• http://blog.lepine.pro
  3. 3. Combien dentre vous...• ont entendu parler de la SPL ?• utilisent des fonctions de la SPL ?• ont déjà utilisé des tableaux de taille fixe en PHP ?• ont déjà exécuté du code même après un exit ou un die ?• ont déjà mis un écouteur sur un code pour exécuter une fonction personnalisée tous les n blocs de code ?• ont déjà passé un paramètre (post ou get) de page en page automatiquement ?
  4. 4. Standard PHP Library
  5. 5. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  6. 6. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  7. 7. SPL - des interfaces• Ajouter de nouveaux contrats entre vos objets et PHP• un exemple : Countable. Combien dentre vous ont déjà utilisé Countable ?
  8. 8. SPL - des interfacesclass Batiment {}class Salle implements Countable { public function count() { return 5; }}$batiment = new Batiment;$salle = new Salle;$n1 = sizeof($salle); // 5$n2 = sizeof($batiment) // 1
  9. 9. SPL - des interfaces• Countable• ArrayObject• Iterator• SplObserver / SplSubject• ...
  10. 10. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  11. 11. SPL - des outils Au toload ing !!set_include_path( get_include_path().PATH_SEPARATOR../library/class/);spl_autoload_extensions(.php,.php5,.inc);spl_autoload_register(); Et cest tout !
  12. 12. Autoloading et PSR-0• Les espaces de nom et les classes doivent être préfixées par le nom de fournisseur de code (ex: Zend_)• Chaque séparateur despace de nom (/) et chaque underscore (_) dans le nom dune classe correspond à un changement de dossier• Le nom complet dune classe est suffixé par ".php"• Les noms de classes, espaces de noms... peuvent contenir des minuscules et des majuscules
  13. 13. SPL - des outils• spl_autoload_register()• class_implements()• iterator_to_array()• spl_object_hash()• Classe SplFileInfo• ...
  14. 14. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  15. 15. SPL - des itérateurs• Permet de parcourir un objet, qui représente alors une liste, un ensemble, une pile, une collection...• Lobjet implémente une Interface spécifique$objet = new Exemple;foreach($objet as $o) { ... }
  16. 16. SPL - des itérateursinterface Iterator extends Traversable { function rewind(); Réinitialiser function valid(); Tester function current(); Valeur courante function key(); Clef courante function next(); Avancer}
  17. 17. SPL - des itérateurs• IteratorAggregate•
  18. 18. SPL - Itérateurs et récursivité• RecursiveArrayIterator Les classes respectent le contrat de la récursivite, mais ne limplémentent• RecursiveCachingIterator pas• RecursiveDirectoryIterator• RecursiveRegexIterator terator eratorI• RecursiveTreeIterator R ecu rsiveIt cette réc ursivité impl émente• ...
  19. 19. SPL - Récursivite$arr = array(1, 2, array(3, 4, 5), 6);$obj1 = new RecursiveArrayIterator($arr);foreach($obj1 as $e) { echo $e; };// 12Array6$obj2 = new RecursiveIteratorIterator($obj1);foreach($obj2 as $e) { echo $e; };// 123456
  20. 20. SPL - itérateur -> tableau$obj1 = new MyIterator;print_r(iterator_to_array($obj1));Array( [0] => 1 [1] => 2)
  21. 21. RegexIterator / RecursiveRegexIteratorpreg_match_all() => RegexIterator::ALL_MATCHESpreg_match() => RegexIterator::GET_MATCHpreg_match() => RegexIterator::MATCHpreg_replace() => RegexIterator::REPLACEpreg_split() => RegexIterator::SPLIT Ju ste génial !
  22. 22. RegexIterator : Match$a = new ArrayIterator(array(test 1, another test, test 123));$b = new RegexIterator($a, /^test/, RegexIterator::MATCH);foreach ($b as $value) { echo $value . "n";}// test 1// test 123
  23. 23. RegexIterator : Replace$a = new ArrayIterator(array(test1, test2, test3));$b = new RegexIterator($a, /^(test)(d+)/,RegexIterator::REPLACE);$b>replacement = $2:$1;print_r(iterator_to_array($b));// Array// (// [0] => 1:test// [1] => 2:test// [2] => 3:test// )
  24. 24. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  25. 25. A vous de jouer...Quelles structures de données avez vous lhabitudedutiliser ?
  26. 26. A vous de jouer...Quelles structures de données avez vous lhabitudedutiliser ?• Des piles triées ? • Des conteneurs ? • Des files dattente ? • Des tas ? • Des tableaux ?
  27. 27. SPL - Principales structures de données• Des piles triées ? SplHeap, SplHeapMin, SplHeapMax• Des conteneurs ? SplObjectStorage• Des files dattente ? SplQueue, SplPriorityQueue• Des tas ? SplStack
  28. 28. Exemple : SplObjectStorage$container = new SplObjectStorage;$pierre = new StdClass;$paul = new StdClass;$container->attach($pierre);$container->attach($paul);$container->attach($pierre);$container->attach($pierre);var_dump(sizeof($container)); // 2
  29. 29. Eh ! Et les tableaux ?$array = new SplFixedArray(3);$array[0] = A;$array[1] = B;$array[2] = C;$array->setSize(4); lus performant en lecture !$array[3] = D; Ptry { var_dump($array[10]);} catch(RuntimeException $re) { ...}
  30. 30. Standard PHP Library• des interfaces• des outils• des itérateurs• des structures de données• des exceptions
  31. 31. SPL - Exceptions• LogicException (étend la classe Exception) • BadFunctionCallException • BadMethodCallException • DomainException • InvalidArgumentException • LengthException • OutOfRangeException
  32. 32. SPL - Exceptions• RuntimeException (étend la classe Exception) • OutOfBoundsException • OverflowException • RangeException • UnderflowException • UnexpectedValueException
  33. 33. InvalidArgumentExceptionfunction triple($nombre) { if(!is_int($nombre)) { throw new InvalidArgumentException( Un entier était attendu); } return $nombre * 3;}
  34. 34. SPL - OverflowExceptionclass Voiture{ public function ajouterPassager() { if ($this->nbPassagers > 4) { throw new OverflowException(Voitre pleine); } }}
  35. 35. Quelques outils bons à connaître
  36. 36. appel dynamique de fonctionfunction doAny($a) {} Un callable cest :$func = doAny; • une fonction anonyme$func(1); • une closure • une chaine • un tableaucall_user_func(doAny, 1);
  37. 37. Exécuter une fonction... en dernier• Vraiment en dernier• Après tous les __destruct()• Même après un die() ou un exit() wn_function() register _shutdo
  38. 38. Exécuter une fonction... en dernierregister_shutdown_function(function() { echo je nettoie, je loggue, etc... ;});echo "1n";exit;echo "2n";
  39. 39. Inclure automatiquement des fichiers r est int erprété e fichie• dans le php.ini L auto_prepend_file=/path/ auto_append_file=/path/• Apache Php_value auto_prepend_file /path/
  40. 40. Bufferisationob_start();echo ok; • Fonction de rappel$result = ob_get_contents(); • Compressionob_clean(); (ob_gzhandler)if($result == ok) { echo super !; • Taille du tampon}
  41. 41. Réecriture du tampon de sortieoutput_add_rewrite_var(prenom, jeanfrancois);?><a href="page2.php">page2</a><form method="post" action="page3.php"> <input type="text" name="any" /></form><a href="page2.php?prenom=jeanfrancois">page2</a><form method="post" action="page3.php"> <input type="hidden" name="prenom" value="jeanfrancois" /> <input type="text" name="any" /></form>
  42. 42. Fonction exécutée en cyclesfunction myFunction() { echo demo.PHP_EOL;}declare(ticks=1);register_tick_function(myFunction);echo 1;echo 2; Danger !// demo Pour des be soins précis !// 1demo// 2demo
  43. 43. Cest lheure des questions Merci à vous !

×