Advertisement
0xCor3

SOCKS5 & PROXY CHECKER [ CLI ]

Jan 5th, 2019
1,940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.85 KB | None | 0 0
  1. <?php
  2. // www.zeldin.link
  3. define("Checked_Folder", "Checked_Proxy"); // SAVED PROXY TO THIS FOLDER.
  4. if(!is_dir(Checked_Folder)){
  5.     mkdir(Checked_Folder) or die("Unable to make dir");
  6. }
  7. function color($opt = 'cyan', $text){
  8.     $green  = "\e[1;92m";
  9.     $cyan   = "\e[1;36m";
  10.     $normal = "\e[0m";
  11.     $blue   = "\e[34m";
  12.     $yellow = "\e[93m";
  13.     $red    = "\e[1;91m";
  14.     switch($opt){
  15.         case 'merah':
  16.             return $red.$text.$normal;
  17.             break;
  18.         case 'hijau':
  19.             return $green.$text.$normal;
  20.             break;
  21.         case 'biru':
  22.             return $blue.$text.$normal;
  23.             break;
  24.         case 'cyan':
  25.             return $cyan.$text.$normal;
  26.             break;
  27.         case 'kuning':
  28.             return $yellow.$text.$normal;
  29.             break;
  30.         case 'normal':
  31.             return $normal.$text.$normal;
  32.             break;
  33.         default:
  34.             return $cyan.$text.$normal;
  35.             break;
  36.     }
  37. }
  38. function Save($title, $text){
  39.     $fopen = fopen($title, "a");
  40.     fwrite($fopen, $text);
  41.     fclose($fopen);
  42. }
  43. function curl($url){
  44.     $ch = curl_init();
  45.     curl_setopt($ch, CURLOPT_URL, $url);
  46.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  47.     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  48.     curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['USER_AGENT']);
  49.     curl_setopt($ch, CURLOPT_TIMEOUT, 23);
  50.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 23);
  51.     $cx = curl_exec($ch);
  52.     if(!$cx){
  53.         return "CURL ERROR : ".curl_error($ch);
  54.     }else{
  55.         return $cx;
  56.     }
  57.     curl_close($ch);
  58. }
  59. echo "[?] SOCKS5 or Normal Proxies? [s/np] : "; $type = trim(fgets(STDIN));
  60. if($type == "s"){
  61.     $title = Checked_Folder."/LiveSocks_".date("d-m-Y").".txt";
  62.     $param = "&proxy_type=socks";
  63. }elseif($type == "np"){
  64.     $title = Checked_Folder."/LiveNP_".date("d-m-Y").".txt";
  65.     $param = "";
  66. }else{
  67.     die("Choose Your Choice!");
  68. }
  69. echo "[#] FILE : "; $f = trim(fgets(STDIN));
  70. if(is_file($f) && file_exists($f)){
  71.     echo "[#] DELIMITER : "; $d = trim(fgets(STDIN));
  72.     $fgc = file_get_contents($f);
  73.     $proxy = explode("\n", $fgc);
  74.     $count = count($proxy);
  75.     echo exec("clear");
  76.     echo "[#] PROXY TOTAL : ".$count."\n";
  77.     $i = 1;
  78.     foreach($proxy as $ipport){
  79.         $s = explode($d, $ipport);
  80.         $ip = trim($s[0]);
  81.         $port = trim($s[1]);
  82.         $get = curl("https://toeyoel-sgb104931.c9users.io/p.php?ip=$ip&port=$port&timeout=20".$param);
  83.         $dcd = json_decode($get, true);
  84.         if($dcd['result']['success'] == true){
  85.             echo color("hijau", "[".$i++."/".$count."] [ LIVE ] | ".$dcd['result']['proxy']['ip'].":".$dcd['result']['proxy']['port']."\n");
  86.             Save($title, $dcd['result']['proxy']['ip'].":".$dcd['result']['proxy']['port']."\n");
  87.         }else{
  88.             echo color("merah", "[".$i++."/".$count."] [ DIE  ] | ".$dcd['result']['proxy']['ip'].":".$dcd['result']['proxy']['port']." | ".$dcd['result']['error']."\n");
  89.         }
  90.     }
  91. }else{
  92.     die("[!] FILE NOT FOUND.");
  93. }
  94. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement