summaryrefslogtreecommitdiffstats
path: root/tool/getCFDomainFromList.php
diff options
context:
space:
mode:
authorusascreeningsocialmedia <usa@screening.socialmedia>2019-06-03 14:49:32 +0000
committerusascreeningsocialmedia <usa@screening.socialmedia>2019-06-03 14:49:32 +0000
commit9dfe871fd84a49aaf272f4f5671721939ea33837 (patch)
treee47afa2c229ddb5d0dfd9735a662981333568c48 /tool/getCFDomainFromList.php
parentd8e642012fd98e9de52a28ad44dbff30436634dc (diff)
downloadcloudflare-tor-9dfe871fd84a49aaf272f4f5671721939ea33837.tar
cloudflare-tor-9dfe871fd84a49aaf272f4f5671721939ea33837.tar.gz
cloudflare-tor-9dfe871fd84a49aaf272f4f5671721939ea33837.tar.lz
cloudflare-tor-9dfe871fd84a49aaf272f4f5671721939ea33837.tar.xz
cloudflare-tor-9dfe871fd84a49aaf272f4f5671721939ea33837.zip
Upload files to 'tool'
Diffstat (limited to 'tool/getCFDomainFromList.php')
-rw-r--r--tool/getCFDomainFromList.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tool/getCFDomainFromList.php b/tool/getCFDomainFromList.php
new file mode 100644
index 00000000..82f69f95
--- /dev/null
+++ b/tool/getCFDomainFromList.php
@@ -0,0 +1,35 @@
+<?php
+/*
+WTFPL License
+
+ Run `php -f getCFDomainFromList.php` and wait for result.
+
+ This script will read INPUT_DOMAINS and add domain to OUTPUT_RESULT
+ if the target is in Cloudflare domain lists.
+
+*/
+
+ignore_user_abort(true);
+set_time_limit(0);
+
+// INPUT_DOMAINS EOF = must LF
+define('INPUT_DOMAINS', 'example.mdn_basedom_list.txt');// _base_ domain list to scan
+define('DIR_CFDOMAINS', 'split/');// path to /split/ directory (Cloudflare Domains)
+define('OUTPUT_RESULT', 'example.mastodon_cf.txt');// result
+
+if (!file_exists(DIR_CFDOMAINS.'cloudflare_0.txt')){print 'Edit DIR_CFDOMAINS';exit;}
+if (!file_exists(INPUT_DOMAINS)){print 'INPUT_DOMAINS not found';exit;}
+
+$result=array();
+
+foreach(explode("\n",file_get_contents(INPUT_DOMAINS)) as $line){
+ if (strlen($line)<4){continue;}
+ $letter=substr($line,0,1);
+ if (!preg_match("/^([a-z0-9]{1})$/",$letter)){continue;}
+ print $letter.'='.$line."\n";
+ if (in_array($line,explode("\n",file_get_contents(DIR_CFDOMAINS.'cloudflare_'.$letter.'.txt')))){$result[]=$line;}
+}
+
+print count($result)." found\n";
+file_put_contents(OUTPUT_RESULT,implode("\n",$result));
+print 'done';