summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2015-12-05 17:27:54 +0000
committerFbenas <philbeansburton@gmail.com>2015-12-05 17:27:54 +0000
commitb70aeacf036a6604f6b233576ca68152557189e4 (patch)
tree5967b0b717a974c9733195cc7b854cd8082b3cb9
Add files to allow search of blaupload.\n WIP.
-rw-r--r--config.ini.example2
-rw-r--r--index.php2
-rw-r--r--search.php40
3 files changed, 44 insertions, 0 deletions
diff --git a/config.ini.example b/config.ini.example
new file mode 100644
index 0000000..df9bcf4
--- /dev/null
+++ b/config.ini.example
@@ -0,0 +1,2 @@
+url = http://www.blaupload.co.uk/
+password = password \ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..4166611
--- /dev/null
+++ b/index.php
@@ -0,0 +1,2 @@
+<?php
+echo $_SERVER['HTTP_COOKIE'];
diff --git a/search.php b/search.php
new file mode 100644
index 0000000..8d027a0
--- /dev/null
+++ b/search.php
@@ -0,0 +1,40 @@
+<?php
+
+ $config = false;
+try {
+ if (!is_readable("config.ini")) {
+ throw new Exception('File config.ini does not exist');
+ }
+ if (!$config = parse_ini_file("config.ini")) {
+ throw new Exception('Could not parse ini file');
+ }
+
+ // hash the password
+ $hash = hash("sha256", $config['password']);
+ $curl = curl_init($config["url"]. "?format=json");
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array("Cookie: password=$hash"));
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ $output = json_decode(curl_exec($curl));
+ curl_close($curl);
+
+
+ $search = "abel";
+
+ // Really slow search
+ $results = [];
+ foreach ($output as $upload) {
+ if (strpos($upload->filename, $search) !== false) {
+ $results[] = $config["url"] . "/" . $upload->filename;
+ }
+ }
+
+ // Return results
+ if (empty($results)) {
+ echo "No results found\n";
+ } else {
+ var_dump($results);die();
+ }
+
+} catch (Exception $e) {
+ var_dump($e->getMessage());die();
+} \ No newline at end of file