Commit ed626ff080bbd316c75aca2e1684104bc107a500

Authored by ronan
1 parent 9aeb1f46f2
Exists in master

fbf83778-289d-11e4-b2b0-5311e88ea69f

Showing 2 changed files with 110 additions and 110 deletions

curl.igalerie.php View file @ ed626ff
  1 +<?php
  2 +session_start();
  3 +
  4 +$site = "https://adresse.de.mon.site.igalerie.fr";
  5 +$lien = "/login";
  6 +$lien3 = "/admin/?q=ftp";
  7 +
  8 +$path_cookie = '/tmp/cookie.'.session_id().'.txt';
  9 +if (file_exists(realpath($path_cookie))) unlink($path_cookie);
  10 +if (!file_exists(realpath($path_cookie))) touch($path_cookie);
  11 +
  12 +$curl = curl_init();
  13 +
  14 +$postfields = array();
  15 +
  16 +$postfields['auth_login'] = 'mon.user';
  17 +$postfields['auth_password'] = 'mon.password';
  18 +$postfields['submit'] = 'Valider';
  19 +
  20 +$postfields = http_build_query($postfields);
  21 +
  22 +curl_setopt($curl, CURLOPT_URL, $site.$lien);
  23 +curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
  24 +curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
  25 +curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  26 +curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  27 +curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  28 +curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  29 +curl_setopt($curl, CURLOPT_HEADER, true);
  30 +curl_setopt($curl, CURLOPT_POST, true);
  31 +curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
  32 +curl_setopt($curl, CURLOPT_COOKIESESSION, true);
  33 +
  34 +$return = curl_exec($curl);
  35 +$headers = curl_getinfo($curl);
  36 +
  37 +if (!$headers['http_code'] == '200'){
  38 + echo "Erreur Step 1";
  39 + exit(1);
  40 +}
  41 +
  42 +curl_setopt($curl, CURLOPT_URL, $site.$lien3);
  43 +curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  44 +curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
  45 +curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
  46 +curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  47 +curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  48 +curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  49 +curl_setopt($curl, CURLOPT_HEADER, true);
  50 +curl_setopt($curl, CURLOPT_COOKIESESSION, true);
  51 +
  52 +$return = curl_exec($curl);
  53 +$headers = curl_getinfo($curl);
  54 +
  55 +if (!$headers['http_code'] == '200'){
  56 + echo "Erreur Step 2";
  57 + exit(1);
  58 +}
  59 +
  60 +$dom = new DOMDocument;
  61 +@$dom->loadHTML($return);
  62 +$inputs = $dom->getElementsByTagName('input');
  63 +foreach ($inputs as $input) {
  64 + $cle = $input->getAttribute('name');
  65 + $valeur = "";
  66 + if($cle=="anticsrf"){
  67 + $valeur = $input->getAttribute('value');
  68 + }
  69 + if(!$valeur=="") break;
  70 +}
  71 +
  72 +$postfields = array();
  73 +
  74 +$postfields['publish_images'] = 'on';
  75 +$postfields['anticsrf'] = "$valeur";
  76 +$postfields['action'] = 'scan';
  77 +
  78 +$postfields = http_build_query($postfields);
  79 +
  80 +curl_setopt($curl, CURLOPT_URL, $site.$lien3);
  81 +curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  82 +curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
  83 +curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
  84 +curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  85 +curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  86 +curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  87 +curl_setopt($curl, CURLOPT_HEADER, true);
  88 +curl_setopt($curl, CURLOPT_COOKIESESSION, true);
  89 +curl_setopt($curl, CURLOPT_POST, true);
  90 +curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
  91 +
  92 +$return = curl_exec($curl);
  93 +$headers = curl_getinfo($curl);
  94 +
  95 +if (!$headers['http_code'] == '200'){
  96 + echo "Erreur Step 3";
  97 + exit(1);
  98 +}
  99 +
  100 +@$dom->loadHTML($return);
  101 +$div = $dom->getElementById('ftp_report');
  102 +$ps = $div->getElementsByTagName('p');
  103 +
  104 +foreach ($ps as $p => $value) {
  105 + echo "$value->nodeValue\n";
  106 +}
  107 +
  108 +curl_close($curl);
  109 +
  110 +exit(0);
curl.igalerie.quennec.fr.php View file @ ed626ff
1   -<?php
2   -session_start();
3   -
4   -$site = "https://adresse.de.mon.site.igalerie.fr";
5   -$lien = "/login";
6   -$lien3 = "/admin/?q=ftp";
7   -
8   -$path_cookie = '/tmp/cookie.'.session_id().'.txt';
9   -if (file_exists(realpath($path_cookie))) unlink($path_cookie);
10   -if (!file_exists(realpath($path_cookie))) touch($path_cookie);
11   -
12   -$curl = curl_init();
13   -
14   -$postfields = array();
15   -
16   -$postfields['auth_login'] = 'mon.user';
17   -$postfields['auth_password'] = 'mon.password';
18   -$postfields['submit'] = 'Valider';
19   -
20   -$postfields = http_build_query($postfields);
21   -
22   -curl_setopt($curl, CURLOPT_URL, $site.$lien);
23   -curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
24   -curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
25   -curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
26   -curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
27   -curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
28   -curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
29   -curl_setopt($curl, CURLOPT_HEADER, true);
30   -curl_setopt($curl, CURLOPT_POST, true);
31   -curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
32   -curl_setopt($curl, CURLOPT_COOKIESESSION, true);
33   -
34   -$return = curl_exec($curl);
35   -$headers = curl_getinfo($curl);
36   -
37   -if (!$headers['http_code'] == '200'){
38   - echo "Erreur Step 1";
39   - exit(1);
40   -}
41   -
42   -curl_setopt($curl, CURLOPT_URL, $site.$lien3);
43   -curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
44   -curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
45   -curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
46   -curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
47   -curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
48   -curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
49   -curl_setopt($curl, CURLOPT_HEADER, true);
50   -curl_setopt($curl, CURLOPT_COOKIESESSION, true);
51   -
52   -$return = curl_exec($curl);
53   -$headers = curl_getinfo($curl);
54   -
55   -if (!$headers['http_code'] == '200'){
56   - echo "Erreur Step 2";
57   - exit(1);
58   -}
59   -
60   -$dom = new DOMDocument;
61   -@$dom->loadHTML($return);
62   -$inputs = $dom->getElementsByTagName('input');
63   -foreach ($inputs as $input) {
64   - $cle = $input->getAttribute('name');
65   - $valeur = "";
66   - if($cle=="anticsrf"){
67   - $valeur = $input->getAttribute('value');
68   - }
69   - if(!$valeur=="") break;
70   -}
71   -
72   -$postfields = array();
73   -
74   -$postfields['publish_images'] = 'on';
75   -$postfields['anticsrf'] = "$valeur";
76   -$postfields['action'] = 'scan';
77   -
78   -$postfields = http_build_query($postfields);
79   -
80   -curl_setopt($curl, CURLOPT_URL, $site.$lien3);
81   -curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
82   -curl_setopt($curl, CURLOPT_COOKIEFILE, realpath($path_cookie));
83   -curl_setopt($curl, CURLOPT_COOKIEJAR, realpath($path_cookie));
84   -curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
85   -curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
86   -curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
87   -curl_setopt($curl, CURLOPT_HEADER, true);
88   -curl_setopt($curl, CURLOPT_COOKIESESSION, true);
89   -curl_setopt($curl, CURLOPT_POST, true);
90   -curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
91   -
92   -$return = curl_exec($curl);
93   -$headers = curl_getinfo($curl);
94   -
95   -if (!$headers['http_code'] == '200'){
96   - echo "Erreur Step 3";
97   - exit(1);
98   -}
99   -
100   -@$dom->loadHTML($return);
101   -$div = $dom->getElementById('ftp_report');
102   -$ps = $div->getElementsByTagName('p');
103   -
104   -foreach ($ps as $p => $value) {
105   - echo "$value->nodeValue\n";
106   -}
107   -
108   -curl_close($curl);
109   -
110   -exit(0);