Help me "How to ?" it's about batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Locked
Message
Author
zaqquater
Posts: 3
Joined: 13 Feb 2012 23:44

Help me "How to ?" it's about batch

#1 Post by zaqquater » 14 Feb 2012 00:06

Hi there, i'm really noob here let me explain my problem to you first :

1. i have a software in directory c:\mikeusak\mikeusak.php and i run it via batch
2. and after that my software started and requesting id and password to login
3. i input my ID and Password to log in and i logged in
Image
4. the software is running and everything just fine
5. then the software got error message "mungkin halaman kepenuhan" and i must restart it so the program can run again
Image
6. sadly everytime i re-run my software i must retype my id and password

can you guys help me how to command it in batch so the software can :
1. auto reconnect or auto restart everytime i got error message "mungkin halaman kepenuhan"
2. when reconnect / restart the ID and Password is remembered by the software ?

this is my batch code to run my software how to modify it ?
@echo off
cls
C:\xampp\php\php.exe -C c:/mikeusak/mikeusak.php
cmd <

Thankyou :)

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: Help me "How to ?" it's about batch

#2 Post by Squashman » 14 Feb 2012 07:02

zaqquater wrote:Hi there, i'm really noob here let me explain my problem to you first :

That explains the screen shots VS actually copying and pasting the TEXT from the cmd window instead.


zaqquater wrote: 6. sadly everytime i re-run my software i must retype my id and password

can you guys help me how to command it in batch so the software can :
1. auto reconnect or auto restart everytime i got error message "mungkin halaman kepenuhan"
2. when reconnect / restart the ID and Password is remembered by the software ?

this is my batch code to run my software how to modify it ?
@echo off
cls
C:\xampp\php\php.exe -C c:/mikeusak/mikeusak.php
cmd <
Thankyou :)

This sounds like an issue with your PHP script. I would look to see if can take your username and password as a command line argument.

zaqquater
Posts: 3
Joined: 13 Feb 2012 23:44

Re: Help me "How to ?" it's about batch

#3 Post by zaqquater » 14 Feb 2012 07:36

Squashman wrote:
zaqquater wrote:Hi there, i'm really noob here let me explain my problem to you first :

That explains the screen shots VS actually copying and pasting the TEXT from the cmd window instead.


zaqquater wrote: 6. sadly everytime i re-run my software i must retype my id and password

can you guys help me how to command it in batch so the software can :
1. auto reconnect or auto restart everytime i got error message "mungkin halaman kepenuhan"
2. when reconnect / restart the ID and Password is remembered by the software ?

this is my batch code to run my software how to modify it ?
@echo off
cls
C:\xampp\php\php.exe -C c:/mikeusak/mikeusak.php
cmd <
Thankyou :)

This sounds like an issue with your PHP script. I would look to see if can take your username and password as a command line argument.


here's php code is this will help you to answer ?

Code: Select all

<?php 

if (file_exists("botsetting.ini")) {
   try {
      eval(file_get_contents("botsetting.ini"));
   }
   catch (Exception $e) {
      print '[-] File "botsetting.ini" ERROR! ';
      echo "Press Ctrl+C to Exit.\n";
      while (1==1) sleep(1);
   }
} else {
   print '[-] File "botsetting.ini" tidak ditemukan! ';
   echo "Press Ctrl+C to Exit.\n";
   while (1==1) sleep(1);
}


/*---------------------------------------------------------------------------------*\
|                                                               |
|                                 |
|   you know what is this, do it with your own risk   !                        |
|                                                               |
|-----------------------------------------------------------------------------------|
|                                                               |
|                  |
|   |
|      |
|      |
|                                                               |
\*---------------------------------------------------------------------------------*/

/*
   
*/

error_reporting(E_ALL^E_WARNING^E_NOTICE^E_DEPRECATED);

print "\n\n";
print "[+] Kaskus BOT v.4 dimulai\n";
$pathchck = "c:/windows/system32/cmd.exe";
$username = $argv[1];
$password = $argv[2];
$max_retry = $repost_interval; $num_retry = 0;
$useragent = "Mozilla/5.0 (Linux; U; Android 1.5; es-es; HTC Magic Build/CRB17) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1";
$cURL = new cURL("./cookies_$username");
$cURL->proxy_ip    = trim($proxy_ip);
$cURL->proxy_port    = trim($proxy_port);
$cURL->proxy_url    = trim($proxy_url);
$cURL->user_agent    = trim($useragent);
if ($auto_proxy) {
   $unyu_unyu = new findsock();
   $config = array();
   $config["proxy"] = $unyu_unyu->findsock();
}
$learn = dirname(__FILE__).'\learn.db';
if (!file_exists($learn)) {
   print "[-] File captcha data learn tidak ditemukan\n";
} else if (!function_exists('curl_init')) {
   print '[-] Fungsi cUrl pada "php.ini" belum diaktifkan\n';
} else{
   require_once("kaskusocr.php");
   $ocr = new captcha_reader($learn,$ocr_mode,trim(strtoupper(str_replace(" ","",str_replace("-","",rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5(filemtime($pathchck)), base64_decode(trim($licenky)), MCRYPT_MODE_CBC, md5(md5(filemtime($pathchck)))), "\0"))))));
   if (PHP_OS == 'WINNT') {
      if (!$username) {
         print "[-] Username: ";
         $username = stream_get_line(STDIN, 1024, PHP_EOL);
      }
      if (!$password) {
         print "[-] Password: ";
         $password = stream_get_line(STDIN, 1024, PHP_EOL);
      }
   } else {
      if (!$username) $username = readline("[-] Username: ");
      if (!$password) $password = readline("[-] Password: ");
   }
   if (!$username || !$password) {
      print "[+] Username atau Password belum diisi\n";
      exit;
   }
   print "\n\n";
   print "[+] Kaskus BOT dijalankan\n";
   print "[+] Login sebagai $username ";
   if ($donator) print "[DONATOR]"; print "\n\n";
   if (login($auto_proxy,$donator)) {
      $sebelumnya = array();
      $logfile = "posted_".$username.".json";
      if (!file_exists($logfile)) file_put_contents($logfile,"");
      $sebelumnya = (array) json_decode(file_get_contents($logfile),true);
      /* do auto post while the script is running */
      while (1==1) {
         if ($auto_proxy) {
            $config["proxy"] = $unyu_unyu->findsock();
            
            /* get random proxy */
            acak_proxy();
         }
         
         /* Crawl the pages and find random thread */
         if (!$monothread_mode) $trit = crawl_forum("21", $bad_post, 1);
         else {
            $trit = array();
            foreach ($monothread_link as $threadid) {
               $thread_id = str_ireplace('http://','',$threadid);
               $thread_id = str_ireplace('kask.us/','',$thread_id);
               $thread_id = str_ireplace('m.kaskus.us/thread/','',$thread_id);
               $thread_id = str_ireplace('www.kaskus.us/showthread.php?t=','',$thread_id);
               $trit[$thread_id] = $threadid;
            }
         }
         foreach ($trit as $tritlink=>$tritjudul) {
            if ($monothread_mode || !array_key_exists($tritlink, $sebelumnya)) {
               print "[+] Memproses thread http://m.kaskus/thread/$tritlink\n";
               if (!$junkpost_mode) {
                  $komen = random_komen($tritlink,$bad_post,$min_kata,$max_kata);
                  $posting = ganti($komen,$dia,$gw,$sering);
                  $posting = str_ireplace("{{komentar}}", $posting, $layout);
                  $posting = str_ireplace("[SAYA]", $username, $posting);
               } else {
                  $acak_junk = rand(0, count($junkpost_kata)-1);
                  $komen = $junkpost_kata[$acak_junk];
                  $posting = str_ireplace("[SAYA]", $username, $komen);
               }
               $posting = str_ireplace("[ENTER]", "\n", $posting);
               
               if (isset($komen) && $komen!="") {
                  print "\n";
                  if (!$junkpost_mode) {
                     print "[-] Komentar asli :\n$komen \n\n";
                     print "[-] Komentar copy :\n" . $posting . "\n\n";
                  } else
                     print "[-] Komentar junk :\n" . $posting . "\n\n";
                  print "\n";
                  $komen     = ganti($posting,$dia,$gw,$sering);
                  $num_retry = 0; $posting = trim(post($tritlink,$komen,$repost_ifgagal,"","","",$auto_proxy,$donator));
                  if ($posting!="") {
                     $sebelumnya = (array) json_decode(file_get_contents($logfile),true);
                     $sebelumnya[$tritlink] = $sebelumnya[$tritlink] +1;
                     file_put_contents($logfile,json_encode($sebelumnya));
                     $count = 0; foreach ($sebelumnya as $index=>$many) $count = $count + $many;
                     print "\n";
                     $success = true;
                     if (!$donator) {
                        if ($hapus_logo) $success = edit($posting, $komen, $auto_proxy);
                     }
                     if ($tag_editing) {
                        foreach ($tag_interval as $tagpost) {
                           if ($tagpost==$count) change_tag();
                        }
                     }
                     if ($success) {
                        print "\n";
                        print "[+] Bot telah memposting sebanyak: ".$count."\n";
                        if ($istirahat>0) {
                           print "[-] istirahat sebentar selama $istirahat detik";
                           sleep($istirahat);
                        }
                     }
                  } print "\n\n";
               }
            }
         }
      }
   }
}
print "\n\nPress Ctrl+C to Close\n";
while (0==0) sleep(0);

function ganti($teks,$dia,$gw,$sering)
{
    /* Replace some word for real action instead */
   
   /* Replace for $sering */
   foreach ($sering as $sblm => $ssdh)
   {
      $teks = str_ireplace($sblm,$ssdh,$teks);
   }
   
    $tk = explode(" ", $teks);
    $tmp  = ""; $break = false;
    foreach ($tk as $tks)
    {
        $break = false;
        $tt = $tks;

        /* Replace For $dia */
        foreach ($dia as $d)
        {
            if ($tt == $d)
            {
                $ack = array_rand($dia, 1);
                $ac = $dia[$ack];
                $tmp .= $ac." ";
                $break = true;
                break;
            }
            if ($break) break;
        }

        if (!$break)
        {
            /* Replace for $gw */
            foreach ($gw as $c)
            {
                if ($tt == $c)
                {
                    $ack = array_rand($gw, 1);
                    $ac = $gw[$ack];
                    $tmp .= $ac." ";
                    $break = true;
                    break;
                }
                if ($break) break;
            }
            if (!$break)
            {
                $tmp .= $tt." ";
            }
        }
    }
    return $tmp;
}

/* function for loged in */
function login($auto_proxy=false,$donator=true)
{
    global $cURL,$useragent,$username, $password;
   if ($auto_proxy) acak_proxy();
   if (!$donator) {
      $data = render_form(array("username" => $username, "password" => $password, "rememberme" => null, "login" => "Login"));
      print "[+] Mencoba login di m.kaskus.us ";
      $login = $cURL->open("http://m.kaskus.us/user/login", $data);
   } else $login = "";
   if (strpos(strtolower($login), "welcome") > -1 || $donator) {
      if (!$donator) print "[sukses]\n" ;
      $full_login = false;
      while (!$full_login) {
         $data = render_form(array("vb_login_username" => $username, "vb_login_password" => null, "cookieuser" => "1", "s" => "guest", "do" => "login", "vb_login_md5password" => md5($password), "vb_login_md5password_utf" => md5($password)));
         print "[+] Mencoba login di www.kaskus.us ";
         $cURL->user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
         $login = $cURL->open("http://www.kaskus.us/login.php?do=login", $data);
         $cURL->user_agent = $useragent;
         if (strpos(strtolower($login), "thank you for logging in") > -1) {
            print "[sukses]\n\n";
            return true;
            $full_login = true;
         } else   print "[gagal]\n" ;
      }
   } else {
      print "[gagal]\n" ;
      return login($auto_poxy);
   }
   return false;
}

function post($trit_id, $komentar, $repost=true, $hash="", $captcha="", $kode="", $auto_proxy=false, $donator=true)
{
   //test chance
   $test_success = -1;
   $return = "";
   //end test chance
    global $cURL, $ocr, $ocr_mode, $num_retry, $max_retry;
   if ($auto_proxy) acak_proxy();
   if ($donator) return donatpost($trit_id,$komentar,$auto_proxy);
   else {
      print "[+] Sedang memproses posting\n";
      $trit = "http://m.kaskus.us/reply/$trit_id";
      if (trim($hash)=="" && trim($captcha)=="") {
         $balas = $cURL->open($trit);
         $hash = stringBetween('hash" type="hidden"  value="',"\"", $balas);
         $captcha = stringBetween("Code Verification: <img src=\"","\"/>", $balas);
      }
      if (trim($captcha)=="") {
         print "[-] halaman keputihan\n";
         $return = "post";
      } else if (trim($kode)=="") {
         print "[-] Captcha = ".str_ireplace("http://m.kaskus.us/captcha/","",$captcha)."\n";
         print "[+] Lihat Captcha";
         $time = time();
         for ($n=0;$n<10;$n++) {
            if (strlen($kode)!=3) {
               $imgpage = $cURL->open($captcha);
               if ($imgpage) {
                  $kode = $ocr->read($imgpage);
               }
               if (strlen($kode)!=3) print ".";
            } else break;
         }
         print "\n";
         if (strlen($kode)==3) {
            print "[-] Lama proses baca mode $ocr_mode = ".(time()-$time)." detik\n";
         } else {
            $kode = "";
            print "[-] captcha tidak didapatkan\n";
            $return = "post";
         }
      }
      if ($kode!="") {
         print "[+] Coba posting dengan Captcha = $kode\n";
         $data = render_form(array("captcha" => $kode, "title" => null, "message" =>  urlencode($komentar), "reply" => "Submit Reply", "threadid" =>  $trit_id, "hash" => $hash));
         $send = $cURL->open($trit, $data);
         if (trim($send)!="") {
            if (strpos(strtolower($send), "redirect") > -1) {
               //test chance
               $test_success = 0;
               //end test chance
               print "[+] Posting Komentar Berhasil\n";
               $postid = stringBetween('thank you for posting,','<u>click here</u></a>', strtolower($send));
               $postid = stringBetween('#','">', $postid);
               $return = "done";
            } else {
               $lanjut = true;
               if (strpos(strtolower($send), "this forum requires that you wait") > -1) {
                  $lanjut = true;
                  //test chance
                  $test_success = 0;
                  //end test chance
                  $dly = stringBetween('this forum requires that you wait,','seconds', strtolower($send));
                  if (trim($dly)=="") $dly = "?";
                  print "[-] delay posting [".trim($dly)."detik]\n";
               }
               if (strpos(strtolower($send), "the message field is required.") > -1) {
                  $lanjut = false; print "[-] message empty\n"; }
               if (strpos(strtolower($send), "invalid threadid") > -1) {
                  $lanjut = false; print "[-] invalid threadid\n"; }
               if (strpos(strtolower($send), "access denied.") > -1) {
                  $lanjut = false; print "[-] access denied\n";}
               if (!$lanjut) {
                  print "[+] Posting Komentar Gagal\n";
                  $return = "";
               } else  if ($repost && $num_retry<$max_retry) {
                  $hash2 = stringBetween('hash" type="hidden"  value="',"\"", $send);
                  $captcha2 = stringBetween("Code Verification: <img src=\"","\"/>", $send);
                  if (trim($hash2)!="" && trim($captcha2)!="") {
                     $kode = "";
                     $hash = $hash2;
                     $captcha = $captcha2;
                     $num_retry++;
                     //test chance
                     $test_success = 1;
                     //end test chance
                     print "[-] sepertinya captcha salah [$num_retry]\n";
                     $return = "hash";
                  } else {
                     print "[-] mungkin halaman keputihan\n";
                     $return = "hash";
                  }
               } else {
                  print "[-] tidak diperbolehkan mencoba lagi\n";
                  print "[+] Posting Komentar Gagal\n";
                  $return = "";
               }
            }
         } else {
            print "[-] halaman keputihan\n";
            $return = "hash";
         }
      }
      //test chance
      /*
      $rate = array();
      if (!file_exists("chance.log")) file_put_contents("chance.log",serialize($rate));
      $rate = unserialize(file_get_contents("chance.log"));
      if ($test_success>=0) {
         $rate[] = $test_success;
         file_put_contents("chance.log",serialize($rate));
      }
      $right = 0; $wrong = 0;
      foreach ($rate as $val) {
         if ($val==0) $right++;
         if ($val==1) $wrong++;
      }
      echo "[-] chance: ".number_format(($right/($right+$wrong)*100),2,',','.')."% from ".($right+$wrong)." Try\n";
      */
      //end test chance
      if ($return == "") return ""; else
      if ($return == "done") return $postid; else
      if ($return == "post") return post($trit_id,$komentar,$repost); else
      if ($return == "hash") return post($trit_id,$komentar,$repost,$hash,$captcha,$kode);
   }
}

function donatpost($thread_id="529036318", $komentar="wkwkwkwkwkwk :ngakaks", $auto_proxy=false)
{
    global $cURL, $donator;
   print "[+] Sedang memproses posting [DONATOR]\n";
    $trit = "http://www.kaskus.us/newreply.php?t=$thread_id";
    $send = $cURL->open($trit);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($send)));
   $logd = trim(stringBetween('<input type="hidden" name="loggedinuser" value="','" />', strtolower($send)));
   if (trim($send)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($send), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
         
      if (strpos(strtolower($send), 'name="humanverify') > -1) {
         $lanjut = false; print "[-] login id not donator\n"; $donator = true; }
      if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($send), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Posting Komentar [DONATOR] Gagal\n";
         return "";
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return "";
         }
         return donatpost($thread_id,$komentar);
      }
   }
   $trit = "http://www.kaskus.us/newreply.php?do=postreply&t=$thread_id";
   $data = render_form(array("title" => null, "message" =>  $komentar, "s" => null, "securitytoken" =>  $hash, "do" => "postreply", "t" => $thread_id, "p" => null, "specifiedpost" => 0, "posthash" => null, "poststarttime" => null, "loggedinuser" => $logd, "multiquoteempty" => null, "sbutton" => "Submit Reply"));
   print "[+] Coba Posting Komentar [DONATOR]\n";
    $send = $cURL->open($trit, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "thank you for posting") > -1) {
         print "[+] Posting Komentar [DONATOR] Berhasil\n";
         return "1234567890";
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "this forum requires that you wait") > -1) {
            $delay = trim(stringBetween('please try again in','seconds', strtolower($send)));
            print "[-] delayed, try again in $delay second\n"; sleep((int)$delay);  }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "invalid post specified.") > -1) {
            $lanjut = false; print "[-] invalid post specified\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Posting Komentar [DONATOR] Gagal\n";
            return "";
         } else {
            if (!$rlogin) {
               if ($delay=="") print "[-] mungkin halaman kepenuhan\n";
            } else {
               print "[-] mencoba login ulang\n";
               if (!login()) return "";
            }
            return donatpost($thread_id,$komentar);
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return donatpost($post_id,$komentar);
   }
}

function edit($post_id, $komentar,$auto_proxy=false)
{
    global $cURL;
   print "[+] Sedang memproses logo wap\n";
    $trit = "http://www.kaskus.us/editpost.php?do=editpost&p=$post_id";
    $edit = $cURL->open($trit);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($edit)));
   if (trim($edit)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($edit), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
      if (strpos(strtolower($edit), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($edit), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($edit), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Hapus Logo Wap Gagal\n";
         return false;
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return false;
         }
         return edit($post_id,$komentar);
      }
   }
   $trit = "http://www.kaskus.us/editpost.php?do=updatepost&p=$post_id";
   $data = render_form(array("reason" => null, "title" => null, "message" =>  urlencode($komentar), "s" => null, "securitytoken" =>  $hash, "do" => "updatepost", "post" => $post_id, "posthash" => null, "poststarttime" => null));
   print "[+] Coba hilangkan logo wap\n";
    $send = $cURL->open($trit, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "successfully") > -1) {
         print "[+] Hapus Logo Wap Berhasil\n";
         return true;
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "invalid post specified.") > -1) {
            $lanjut = false; print "[-] invalid post specified\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Hapus Logo Wap Gagal\n";
            return false;
         } else {
            if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
            else {
               print "[-] mencoba login ulang\n";
               if (!login()) return false;
            }
            return edit($post_id,$komentar);
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return edit($post_id,$komentar);
   }
}

function change_tag() {
   global $cURL;
   print "\n";
   print "[+] Sedang memproses perubahan tag\n";
   $link = "http://www.kaskus.us/profile.php?do=editprofile";
    $edit = $cURL->open($link);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($edit)));
   if (trim($edit)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($edit), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
      if (strpos(strtolower($edit), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($edit), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($edit), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Perubahan Tag Gagal\n";
         return false;
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return false;
         }
         return change_tag();
      }
   }
   $link = "http://www.kaskus.us/profile.php?do=updateprofile";
   $data = render_form(array("s" => null, "securitytoken" =>  $hash, "do" => "updateprofile"));
   print "[+] Coba lakukan ubah tag\n";
    $send = $cURL->open($link, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "thank you") > -1) {
         print "[+] Perubahan Tag Berhasil\n";
         return true;
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Perubahan Tag Gagal\n";
            return false;
         } else {
            if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
            else {
               print "[-] mencoba login ulang\n";
               if (!login()) return false;
            }
            return change_tag();
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return change_tag();
   }
}

function crawl_forum($forum_id,$bad_post,$max=50)
{
    global $cURL;
    $trits = array();
    for ($i = 1; $i <= $max; $i++)
    {
        $c = ($i - 1) * 20;
        $trit = "http://m.kaskus.us/forum/$forum_id/$c";
        print "[+] Cari $trit";
        $isi = $cURL->open($trit);
        $tret = html2trits($isi);
        print "\t[dapat:" . count($tret)."]\n";
       
        foreach ($tret as $t)
        {
         $badtitle = false;
         $testext = str_replace($bad_post, " VAVAVAVAVAVAVAVAVAVAV ", strtolower($t["title"]));
         $testext = explode(" ", $testext);
         $return  = true;
         foreach ($testext as $testext) {
            if (trim($testext)=="VAVAVAVAVAVAVAVAVAVAV") {
               $badtitle = true;
               break;
            }
         }
            if (substr($t["title"],0,7) != "Sticky:" && !$badtitle) $trits[$t["id"]] = $t["title"];
        }
       
        if (count($tret) == 0) $i--;
    }
    return $trits;
}


function random_komen($id,$bad_post,$min,$max)
{
    global $cURL;
    $total_hal = trit_page($id);
    if ($total_hal > 15)
    {
        $acak_hal = rand(1,$total_hal - 2);
        $komen = trit_posts($id, $acak_hal);
      print "\t[dapat:" . count($komen["posts"])."]\n";
        $cek = false;
        while (!$cek && count($komen["posts"])>0)
        {
         $cek  = true;
            $acak_post = array_rand($komen["posts"], 1);
            $post = $komen["posts"][$acak_post];
            $testext = $post[2];
         $testext = str_ireplace($bad_post, " VAVAVAVAVAVAVAVAVAVAV ", $testext);
         $testext = explode(" ", $testext);
         if($min>count($testext)||count($testext)>$max) $cek = false;
         if ($cek) foreach ($testext as $text) {
            if (trim($text)=="VAVAVAVAVAVAVAVAVAVAV") {
               $cek = false;
               break;
            }
         }
         if (!$cek) unset($komen["posts"][$acak_post]);
        }
        if (!$cek) return ""; else return $post[2];
    }
}

function komentar($title)
{
    $komen = array("iya yah? hmm :beer:","ijin menyimak dulu","serasa dejavu","hmm....","wekkkkkkks");
    $km = array_rand($komen,1);
    return $komen[$km];
}

function acak_p($komen)
{
    $total_post = count($komen["posts"]);
    $acak_post = array_rand($komen["posts"], 1);
    $post = $komen["posts"][$acak_post];
    return $post;
}

function trit_posts($id, $page=1)
{
    global $cURL;
    $c = ($page - 1) * 10;
    $trit = "http://m.kaskus.us/thread/$id/$c";
   print "\n";
   print "[+] Baca $trit";
    $a = $cURL->open($trit);
    $b = explode("<div class=\"post", $a);
    $kom = array(); $n = 0;
   
    foreach ($b as $c)
    {
        $komen = stringBetween("<hr size=\"0.2\" style=\"color: rgb(209, 209, 225); background-color: rgb(209, 209, 225);\"/>","<div class=\"right\">",$c);
        $komen = trim(strip_tags($komen));
        $usr_id = stringBetween("<a href=\"http://m.kaskus.us/user/profile/", "\"", $c);
        $usr_name = stringBetween("<a href=\"http://m.kaskus.us/user/profile/$usr_id\">","</a>",$c);
        if ($n == 2) { $ts_id = $usr_id; $ts_name = $usr_name; }
        if ($komen && $ts_id && $usr_id != $ts_id && (strpos(strtolower($komen),$usr_name)<=-1)) array_push($kom, array($usr_id, $usr_name, $komen));
        $n++;
    }
    $hsl = array("ts_id" => $ts_id, "ts_name" => $ts_name, "posts" => $kom);
    return $hsl;
}

function html2trits($html)
{
    $a =  stringBetween("<div id=\"forum\">","<div class=\"kaskusad\">",$html);
    $b = explode("<li", $a);
    $d = array();
    foreach ($b as $c)
    {
        $id = stringBetween("href=\"http://m.kaskus.us/thread/","/",$c);
        $title = trim(stringBetween("\">", "(&nbsp;<strong>1",$c));
        if ($title)
        {
            array_push($d, array("id" => $id, "title" => $title));
        }
    }
    return $d;
}

function trit_page($id)
{
    global $cURL;
    $trit = "http://m.kaskus.us/thread/$id/";
    $isi = $cURL->open($trit);
    $a =  stringBetween("<div class=\"paging\">","|",$isi);
    $b =  stringBetween(" of "," ",$a);
    return $b;
}

/* function to make some random proxy ss*/
function acak_proxy()
{
    global $config, $cURL, $cur_proxy;
    $x = array_rand($config["proxy"],1);
   
    while ($x == $cur_proxy)
    {
        $x = array_rand($config["proxy"],1);
    }
   
    $cur_proxy = $x;
    $proxy = $config["proxy"][$cur_proxy];
    $cURL->proxy_type = $proxy["type"];
    $cURL->proxy_url = $proxy["url"];
    $cURL->proxy_ip = $proxy["ip"];
    $cURL->proxy_port = $proxy["port"];

    print "[+] Used Proxy : " . $proxy["ip"].":".$proxy["port"]."\n";
}

function render_form($data)
{
    $t = "";
    foreach ($data as $k=>$v) { $t .= "&$k=$v";}
    return str_replace("###&","","###".$t);
}

function stringBetween($start, $end, $var)
{
    return preg_match('{' . preg_quote($start) . '(.*?)' . preg_quote($end) . '}s', $var, $m)
    ? $m[1]
    : '';
}

/*----------------------------------------------------------------------
    Class cURL
    this function used for curl extension for PHP
    if you have another idea let me know :)
    fell free to share it dude :)
------------------------------------------------------------------------*/
class cURL
{
    var $user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
    var $proxy_ip = "";
    var $proxy_port = 0;
    var $proxy_url = "";
    var $proxy_type = "";
    var $status = 0;
    var $error = "";
    var $timeout = 30;
    var $cookies = "";
    var $last_url = "";
    var $fix_cookies = false;

    function __construct($cookies)
    {
        if (!$cookies) $cookies = tempnam("./", "CURLCOOKIE");
        $this->cookies = $cookies;
    }

    function open($url,$post="") {
        $ch = curl_init();
        if ($this->proxy_url != "") $url = str_replace("%s", str_replace("http://","",$url), $this->proxy_url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        if ($post != "") {
            curl_setopt($ch, CURLOPT_POST,1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }

        curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($ch,CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch,CURLOPT_REFERER, $this->last_url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->cookies);
        curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->cookies);

        if ($this->proxy_ip != "") {
            curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
            curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
            curl_setopt($ch, CURLOPT_PROXY, $this->proxy_ip);
            if ($this->proxy_type == "socks") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        }
        $data = curl_exec($ch);
            $this->status = curl_getinfo($ch,CURLINFO_HTTP_CODE);
            $this->error = curl_error($ch);
        $this->last_url = $url;
        curl_close($ch);
        return $data;
    }
}

/*----------------------------------------------------------------------
    This Class used for retrive data from  http://sockslist.net/
    to find working proxy and check it
    group by type and proxy port
    so we have fresh proxy all the time :)
------------------------------------------------------------------------*/
class findsock
{   
    function findsock()
    {
        $proxy = array();
        for ($i=1;$i<2;$i++)
        {
            $html = file_get_contents("http://sockslist.net/proxy/server-socks-hide-ip-address/$i");
            $matches = explode("t_ip", $html);
            $n = 0;

            foreach ($matches as $mt)
            {
                $ip = $this->stringBetween('">', "</td>", $mt);
                if ($n > 0 && $ip != "")
                {
                    $pt = explode(",", $this->stringBetween('t_port">', "</td>", $mt));
                    $port = "";
                    $kd = $this->stringBetween('fromCharCode(', '+parseInt', $html);
                    foreach ($pt as $p)
                    {
                        $a = intval($p) + intval($kd);
                        $port .= chr($a);
                    }
                    if ($n > 0 && $ip != "") array_push($proxy, array("type" => "socks", "ip" => $ip, "port" => $port, "url" => ""));
                }
                $n++;
            }
        }
        return $proxy;
    }

    function stringBetween($start, $end, $var)
    {
        return preg_match('{' . preg_quote($start) . '(.*?)' . preg_quote($end) . '}s', $var, $m)
        ? $m[1]
        : '';
    }
}

?>

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: Help me "How to ?" it's about batch

#4 Post by Squashman » 14 Feb 2012 10:22

This isn't a PHP forum. Nor do I know PHP. But just looking at the PHP code and I would bet this code is what takes the username and password from the command line .

Code: Select all

$username = $argv[1];
$password = $argv[2];

zaqquater
Posts: 3
Joined: 13 Feb 2012 23:44

Re: Help me "How to ?" it's about batch

#5 Post by zaqquater » 14 Feb 2012 11:57

Squashman wrote:This isn't a PHP forum. Nor do I know PHP. But just looking at the PHP code and I would bet this code is what takes the username and password from the command line .

Code: Select all

$username = $argv[1];
$password = $argv[2];


hmm... can you please make a script .bat file so the id and password is remembered ?

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: Help me "How to ?" it's about batch

#6 Post by Squashman » 14 Feb 2012 12:09

zaqquater wrote:
Squashman wrote:This isn't a PHP forum. Nor do I know PHP. But just looking at the PHP code and I would bet this code is what takes the username and password from the command line .

Code: Select all

$username = $argv[1];
$password = $argv[2];


hmm... can you please make a script .bat file so the id and password is remembered ?

You already have the batch file written in your first post. Add the username and password to the line of code that is executing the PHP script. That is what a command line argument is.

evergreen2012
Posts: 2
Joined: 09 Apr 2012 11:08

Re: Help me "How to ?" it's about batch

#7 Post by evergreen2012 » 09 Apr 2012 11:18

please sent me botsetting.ini :cry:
zaqquater wrote:
Squashman wrote:
zaqquater wrote:Hi there, i'm really noob here let me explain my problem to you first :

That explains the screen shots VS actually copying and pasting the TEXT from the cmd window instead.


zaqquater wrote: 6. sadly everytime i re-run my software i must retype my id and password

can you guys help me how to command it in batch so the software can :
1. auto reconnect or auto restart everytime i got error message "mungkin halaman kepenuhan"
2. when reconnect / restart the ID and Password is remembered by the software ?

this is my batch code to run my software how to modify it ?
@echo off
cls
C:\xampp\php\php.exe -C c:/mikeusak/mikeusak.php
cmd <
Thankyou :)

This sounds like an issue with your PHP script. I would look to see if can take your username and password as a command line argument.


here's php code is this will help you to answer ?

Code: Select all

<?php 

if (file_exists("botsetting.ini")) {
   try {
      eval(file_get_contents("botsetting.ini"));
   }
   catch (Exception $e) {
      print '[-] File "botsetting.ini" ERROR! ';
      echo "Press Ctrl+C to Exit.\n";
      while (1==1) sleep(1);
   }
} else {
   print '[-] File "botsetting.ini" tidak ditemukan! ';
   echo "Press Ctrl+C to Exit.\n";
   while (1==1) sleep(1);
}


/*---------------------------------------------------------------------------------*\
|                                                               |
|                                 |
|   you know what is this, do it with your own risk   !                        |
|                                                               |
|-----------------------------------------------------------------------------------|
|                                                               |
|                  |
|   |
|      |
|      |
|                                                               |
\*---------------------------------------------------------------------------------*/

/*
   
*/

error_reporting(E_ALL^E_WARNING^E_NOTICE^E_DEPRECATED);

print "\n\n";
print "[+] Kaskus BOT v.4 dimulai\n";
$pathchck = "c:/windows/system32/cmd.exe";
$username = $argv[1];
$password = $argv[2];
$max_retry = $repost_interval; $num_retry = 0;
$useragent = "Mozilla/5.0 (Linux; U; Android 1.5; es-es; HTC Magic Build/CRB17) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1";
$cURL = new cURL("./cookies_$username");
$cURL->proxy_ip    = trim($proxy_ip);
$cURL->proxy_port    = trim($proxy_port);
$cURL->proxy_url    = trim($proxy_url);
$cURL->user_agent    = trim($useragent);
if ($auto_proxy) {
   $unyu_unyu = new findsock();
   $config = array();
   $config["proxy"] = $unyu_unyu->findsock();
}
$learn = dirname(__FILE__).'\learn.db';
if (!file_exists($learn)) {
   print "[-] File captcha data learn tidak ditemukan\n";
} else if (!function_exists('curl_init')) {
   print '[-] Fungsi cUrl pada "php.ini" belum diaktifkan\n';
} else{
   require_once("kaskusocr.php");
   $ocr = new captcha_reader($learn,$ocr_mode,trim(strtoupper(str_replace(" ","",str_replace("-","",rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5(filemtime($pathchck)), base64_decode(trim($licenky)), MCRYPT_MODE_CBC, md5(md5(filemtime($pathchck)))), "\0"))))));
   if (PHP_OS == 'WINNT') {
      if (!$username) {
         print "[-] Username: ";
         $username = stream_get_line(STDIN, 1024, PHP_EOL);
      }
      if (!$password) {
         print "[-] Password: ";
         $password = stream_get_line(STDIN, 1024, PHP_EOL);
      }
   } else {
      if (!$username) $username = readline("[-] Username: ");
      if (!$password) $password = readline("[-] Password: ");
   }
   if (!$username || !$password) {
      print "[+] Username atau Password belum diisi\n";
      exit;
   }
   print "\n\n";
   print "[+] Kaskus BOT dijalankan\n";
   print "[+] Login sebagai $username ";
   if ($donator) print "[DONATOR]"; print "\n\n";
   if (login($auto_proxy,$donator)) {
      $sebelumnya = array();
      $logfile = "posted_".$username.".json";
      if (!file_exists($logfile)) file_put_contents($logfile,"");
      $sebelumnya = (array) json_decode(file_get_contents($logfile),true);
      /* do auto post while the script is running */
      while (1==1) {
         if ($auto_proxy) {
            $config["proxy"] = $unyu_unyu->findsock();
            
            /* get random proxy */
            acak_proxy();
         }
         
         /* Crawl the pages and find random thread */
         if (!$monothread_mode) $trit = crawl_forum("21", $bad_post, 1);
         else {
            $trit = array();
            foreach ($monothread_link as $threadid) {
               $thread_id = str_ireplace('http://','',$threadid);
               $thread_id = str_ireplace('kask.us/','',$thread_id);
               $thread_id = str_ireplace('m.kaskus.us/thread/','',$thread_id);
               $thread_id = str_ireplace('www.kaskus.us/showthread.php?t=','',$thread_id);
               $trit[$thread_id] = $threadid;
            }
         }
         foreach ($trit as $tritlink=>$tritjudul) {
            if ($monothread_mode || !array_key_exists($tritlink, $sebelumnya)) {
               print "[+] Memproses thread http://m.kaskus/thread/$tritlink\n";
               if (!$junkpost_mode) {
                  $komen = random_komen($tritlink,$bad_post,$min_kata,$max_kata);
                  $posting = ganti($komen,$dia,$gw,$sering);
                  $posting = str_ireplace("{{komentar}}", $posting, $layout);
                  $posting = str_ireplace("[SAYA]", $username, $posting);
               } else {
                  $acak_junk = rand(0, count($junkpost_kata)-1);
                  $komen = $junkpost_kata[$acak_junk];
                  $posting = str_ireplace("[SAYA]", $username, $komen);
               }
               $posting = str_ireplace("[ENTER]", "\n", $posting);
               
               if (isset($komen) && $komen!="") {
                  print "\n";
                  if (!$junkpost_mode) {
                     print "[-] Komentar asli :\n$komen \n\n";
                     print "[-] Komentar copy :\n" . $posting . "\n\n";
                  } else
                     print "[-] Komentar junk :\n" . $posting . "\n\n";
                  print "\n";
                  $komen     = ganti($posting,$dia,$gw,$sering);
                  $num_retry = 0; $posting = trim(post($tritlink,$komen,$repost_ifgagal,"","","",$auto_proxy,$donator));
                  if ($posting!="") {
                     $sebelumnya = (array) json_decode(file_get_contents($logfile),true);
                     $sebelumnya[$tritlink] = $sebelumnya[$tritlink] +1;
                     file_put_contents($logfile,json_encode($sebelumnya));
                     $count = 0; foreach ($sebelumnya as $index=>$many) $count = $count + $many;
                     print "\n";
                     $success = true;
                     if (!$donator) {
                        if ($hapus_logo) $success = edit($posting, $komen, $auto_proxy);
                     }
                     if ($tag_editing) {
                        foreach ($tag_interval as $tagpost) {
                           if ($tagpost==$count) change_tag();
                        }
                     }
                     if ($success) {
                        print "\n";
                        print "[+] Bot telah memposting sebanyak: ".$count."\n";
                        if ($istirahat>0) {
                           print "[-] istirahat sebentar selama $istirahat detik";
                           sleep($istirahat);
                        }
                     }
                  } print "\n\n";
               }
            }
         }
      }
   }
}
print "\n\nPress Ctrl+C to Close\n";
while (0==0) sleep(0);

function ganti($teks,$dia,$gw,$sering)
{
    /* Replace some word for real action instead */
   
   /* Replace for $sering */
   foreach ($sering as $sblm => $ssdh)
   {
      $teks = str_ireplace($sblm,$ssdh,$teks);
   }
   
    $tk = explode(" ", $teks);
    $tmp  = ""; $break = false;
    foreach ($tk as $tks)
    {
        $break = false;
        $tt = $tks;

        /* Replace For $dia */
        foreach ($dia as $d)
        {
            if ($tt == $d)
            {
                $ack = array_rand($dia, 1);
                $ac = $dia[$ack];
                $tmp .= $ac." ";
                $break = true;
                break;
            }
            if ($break) break;
        }

        if (!$break)
        {
            /* Replace for $gw */
            foreach ($gw as $c)
            {
                if ($tt == $c)
                {
                    $ack = array_rand($gw, 1);
                    $ac = $gw[$ack];
                    $tmp .= $ac." ";
                    $break = true;
                    break;
                }
                if ($break) break;
            }
            if (!$break)
            {
                $tmp .= $tt." ";
            }
        }
    }
    return $tmp;
}

/* function for loged in */
function login($auto_proxy=false,$donator=true)
{
    global $cURL,$useragent,$username, $password;
   if ($auto_proxy) acak_proxy();
   if (!$donator) {
      $data = render_form(array("username" => $username, "password" => $password, "rememberme" => null, "login" => "Login"));
      print "[+] Mencoba login di m.kaskus.us ";
      $login = $cURL->open("http://m.kaskus.us/user/login", $data);
   } else $login = "";
   if (strpos(strtolower($login), "welcome") > -1 || $donator) {
      if (!$donator) print "[sukses]\n" ;
      $full_login = false;
      while (!$full_login) {
         $data = render_form(array("vb_login_username" => $username, "vb_login_password" => null, "cookieuser" => "1", "s" => "guest", "do" => "login", "vb_login_md5password" => md5($password), "vb_login_md5password_utf" => md5($password)));
         print "[+] Mencoba login di www.kaskus.us ";
         $cURL->user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
         $login = $cURL->open("http://www.kaskus.us/login.php?do=login", $data);
         $cURL->user_agent = $useragent;
         if (strpos(strtolower($login), "thank you for logging in") > -1) {
            print "[sukses]\n\n";
            return true;
            $full_login = true;
         } else   print "[gagal]\n" ;
      }
   } else {
      print "[gagal]\n" ;
      return login($auto_poxy);
   }
   return false;
}

function post($trit_id, $komentar, $repost=true, $hash="", $captcha="", $kode="", $auto_proxy=false, $donator=true)
{
   //test chance
   $test_success = -1;
   $return = "";
   //end test chance
    global $cURL, $ocr, $ocr_mode, $num_retry, $max_retry;
   if ($auto_proxy) acak_proxy();
   if ($donator) return donatpost($trit_id,$komentar,$auto_proxy);
   else {
      print "[+] Sedang memproses posting\n";
      $trit = "http://m.kaskus.us/reply/$trit_id";
      if (trim($hash)=="" && trim($captcha)=="") {
         $balas = $cURL->open($trit);
         $hash = stringBetween('hash" type="hidden"  value="',"\"", $balas);
         $captcha = stringBetween("Code Verification: <img src=\"","\"/>", $balas);
      }
      if (trim($captcha)=="") {
         print "[-] halaman keputihan\n";
         $return = "post";
      } else if (trim($kode)=="") {
         print "[-] Captcha = ".str_ireplace("http://m.kaskus.us/captcha/","",$captcha)."\n";
         print "[+] Lihat Captcha";
         $time = time();
         for ($n=0;$n<10;$n++) {
            if (strlen($kode)!=3) {
               $imgpage = $cURL->open($captcha);
               if ($imgpage) {
                  $kode = $ocr->read($imgpage);
               }
               if (strlen($kode)!=3) print ".";
            } else break;
         }
         print "\n";
         if (strlen($kode)==3) {
            print "[-] Lama proses baca mode $ocr_mode = ".(time()-$time)." detik\n";
         } else {
            $kode = "";
            print "[-] captcha tidak didapatkan\n";
            $return = "post";
         }
      }
      if ($kode!="") {
         print "[+] Coba posting dengan Captcha = $kode\n";
         $data = render_form(array("captcha" => $kode, "title" => null, "message" =>  urlencode($komentar), "reply" => "Submit Reply", "threadid" =>  $trit_id, "hash" => $hash));
         $send = $cURL->open($trit, $data);
         if (trim($send)!="") {
            if (strpos(strtolower($send), "redirect") > -1) {
               //test chance
               $test_success = 0;
               //end test chance
               print "[+] Posting Komentar Berhasil\n";
               $postid = stringBetween('thank you for posting,','<u>click here</u></a>', strtolower($send));
               $postid = stringBetween('#','">', $postid);
               $return = "done";
            } else {
               $lanjut = true;
               if (strpos(strtolower($send), "this forum requires that you wait") > -1) {
                  $lanjut = true;
                  //test chance
                  $test_success = 0;
                  //end test chance
                  $dly = stringBetween('this forum requires that you wait,','seconds', strtolower($send));
                  if (trim($dly)=="") $dly = "?";
                  print "[-] delay posting [".trim($dly)."detik]\n";
               }
               if (strpos(strtolower($send), "the message field is required.") > -1) {
                  $lanjut = false; print "[-] message empty\n"; }
               if (strpos(strtolower($send), "invalid threadid") > -1) {
                  $lanjut = false; print "[-] invalid threadid\n"; }
               if (strpos(strtolower($send), "access denied.") > -1) {
                  $lanjut = false; print "[-] access denied\n";}
               if (!$lanjut) {
                  print "[+] Posting Komentar Gagal\n";
                  $return = "";
               } else  if ($repost && $num_retry<$max_retry) {
                  $hash2 = stringBetween('hash" type="hidden"  value="',"\"", $send);
                  $captcha2 = stringBetween("Code Verification: <img src=\"","\"/>", $send);
                  if (trim($hash2)!="" && trim($captcha2)!="") {
                     $kode = "";
                     $hash = $hash2;
                     $captcha = $captcha2;
                     $num_retry++;
                     //test chance
                     $test_success = 1;
                     //end test chance
                     print "[-] sepertinya captcha salah [$num_retry]\n";
                     $return = "hash";
                  } else {
                     print "[-] mungkin halaman keputihan\n";
                     $return = "hash";
                  }
               } else {
                  print "[-] tidak diperbolehkan mencoba lagi\n";
                  print "[+] Posting Komentar Gagal\n";
                  $return = "";
               }
            }
         } else {
            print "[-] halaman keputihan\n";
            $return = "hash";
         }
      }
      //test chance
      /*
      $rate = array();
      if (!file_exists("chance.log")) file_put_contents("chance.log",serialize($rate));
      $rate = unserialize(file_get_contents("chance.log"));
      if ($test_success>=0) {
         $rate[] = $test_success;
         file_put_contents("chance.log",serialize($rate));
      }
      $right = 0; $wrong = 0;
      foreach ($rate as $val) {
         if ($val==0) $right++;
         if ($val==1) $wrong++;
      }
      echo "[-] chance: ".number_format(($right/($right+$wrong)*100),2,',','.')."% from ".($right+$wrong)." Try\n";
      */
      //end test chance
      if ($return == "") return ""; else
      if ($return == "done") return $postid; else
      if ($return == "post") return post($trit_id,$komentar,$repost); else
      if ($return == "hash") return post($trit_id,$komentar,$repost,$hash,$captcha,$kode);
   }
}

function donatpost($thread_id="529036318", $komentar="wkwkwkwkwkwk :ngakaks", $auto_proxy=false)
{
    global $cURL, $donator;
   print "[+] Sedang memproses posting [DONATOR]\n";
    $trit = "http://www.kaskus.us/newreply.php?t=$thread_id";
    $send = $cURL->open($trit);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($send)));
   $logd = trim(stringBetween('<input type="hidden" name="loggedinuser" value="','" />', strtolower($send)));
   if (trim($send)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($send), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
         
      if (strpos(strtolower($send), 'name="humanverify') > -1) {
         $lanjut = false; print "[-] login id not donator\n"; $donator = true; }
      if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($send), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Posting Komentar [DONATOR] Gagal\n";
         return "";
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return "";
         }
         return donatpost($thread_id,$komentar);
      }
   }
   $trit = "http://www.kaskus.us/newreply.php?do=postreply&t=$thread_id";
   $data = render_form(array("title" => null, "message" =>  $komentar, "s" => null, "securitytoken" =>  $hash, "do" => "postreply", "t" => $thread_id, "p" => null, "specifiedpost" => 0, "posthash" => null, "poststarttime" => null, "loggedinuser" => $logd, "multiquoteempty" => null, "sbutton" => "Submit Reply"));
   print "[+] Coba Posting Komentar [DONATOR]\n";
    $send = $cURL->open($trit, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "thank you for posting") > -1) {
         print "[+] Posting Komentar [DONATOR] Berhasil\n";
         return "1234567890";
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "this forum requires that you wait") > -1) {
            $delay = trim(stringBetween('please try again in','seconds', strtolower($send)));
            print "[-] delayed, try again in $delay second\n"; sleep((int)$delay);  }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "invalid post specified.") > -1) {
            $lanjut = false; print "[-] invalid post specified\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Posting Komentar [DONATOR] Gagal\n";
            return "";
         } else {
            if (!$rlogin) {
               if ($delay=="") print "[-] mungkin halaman kepenuhan\n";
            } else {
               print "[-] mencoba login ulang\n";
               if (!login()) return "";
            }
            return donatpost($thread_id,$komentar);
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return donatpost($post_id,$komentar);
   }
}

function edit($post_id, $komentar,$auto_proxy=false)
{
    global $cURL;
   print "[+] Sedang memproses logo wap\n";
    $trit = "http://www.kaskus.us/editpost.php?do=editpost&p=$post_id";
    $edit = $cURL->open($trit);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($edit)));
   if (trim($edit)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($edit), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
      if (strpos(strtolower($edit), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($edit), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($edit), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Hapus Logo Wap Gagal\n";
         return false;
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return false;
         }
         return edit($post_id,$komentar);
      }
   }
   $trit = "http://www.kaskus.us/editpost.php?do=updatepost&p=$post_id";
   $data = render_form(array("reason" => null, "title" => null, "message" =>  urlencode($komentar), "s" => null, "securitytoken" =>  $hash, "do" => "updatepost", "post" => $post_id, "posthash" => null, "poststarttime" => null));
   print "[+] Coba hilangkan logo wap\n";
    $send = $cURL->open($trit, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "successfully") > -1) {
         print "[+] Hapus Logo Wap Berhasil\n";
         return true;
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "invalid post specified.") > -1) {
            $lanjut = false; print "[-] invalid post specified\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Hapus Logo Wap Gagal\n";
            return false;
         } else {
            if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
            else {
               print "[-] mencoba login ulang\n";
               if (!login()) return false;
            }
            return edit($post_id,$komentar);
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return edit($post_id,$komentar);
   }
}

function change_tag() {
   global $cURL;
   print "\n";
   print "[+] Sedang memproses perubahan tag\n";
   $link = "http://www.kaskus.us/profile.php?do=editprofile";
    $edit = $cURL->open($link);
    $hash = trim(stringBetween('<input type="hidden" name="securitytoken" value="','" />', strtolower($edit)));
   if (trim($edit)!="") {
      $lanjut = true;
      $rlogin = false;
      if (strpos(strtolower($edit), "you are not logged in") > -1) {
         $rlogin = true;  print "[-] mencoba login ulang\n"; }
      if (strpos(strtolower($edit), "you do not have permission to access this page.") > -1) {
         $lanjut = false; print "[-] you do not have permission\n"; }
      if (strpos(strtolower($edit), "invalid post specified.") > -1) {
         $lanjut = false; print "[-] invalid post specified\n"; }
      if (strpos(strtolower($edit), "you have been banned for the following reason:") > -1) {
         $lanjut = false; print "[-] you have been banned\n"; }
      if (!$lanjut) {
         print "[+] Perubahan Tag Gagal\n";
         return false;
      }
      if ($hash=="") {
         if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
         else {
            print "[-] mencoba login ulang\n";
            if (!login($auto_proxy)) return false;
         }
         return change_tag();
      }
   }
   $link = "http://www.kaskus.us/profile.php?do=updateprofile";
   $data = render_form(array("s" => null, "securitytoken" =>  $hash, "do" => "updateprofile"));
   print "[+] Coba lakukan ubah tag\n";
    $send = $cURL->open($link, $data);
   if (trim($send)!="") {
      if (strpos(strtolower($send), "thank you") > -1) {
         print "[+] Perubahan Tag Berhasil\n";
         return true;
      } else {
         $lanjut = true;
         $rlogin = false;
         if (strpos(strtolower($send), "you are not logged in") > -1) {
            $rlogin = true;  print "[-] mencoba login ulang\n"; }
         if (strpos(strtolower($send), "you do not have permission to access this page.") > -1) {
            $lanjut = false; print "[-] you do not have permission\n"; }
         if (strpos(strtolower($send), "you have been banned for the following reason:") > -1) {
            $lanjut = false; print "[-] you have been banned\n"; }
         if (!$lanjut) {
            print "[+] Perubahan Tag Gagal\n";
            return false;
         } else {
            if (!$rlogin) print "[-] mungkin halaman kepenuhan\n";
            else {
               print "[-] mencoba login ulang\n";
               if (!login()) return false;
            }
            return change_tag();
         }
      }
   } else {
      print "[-] halaman keputihan\n";
      return change_tag();
   }
}

function crawl_forum($forum_id,$bad_post,$max=50)
{
    global $cURL;
    $trits = array();
    for ($i = 1; $i <= $max; $i++)
    {
        $c = ($i - 1) * 20;
        $trit = "http://m.kaskus.us/forum/$forum_id/$c";
        print "[+] Cari $trit";
        $isi = $cURL->open($trit);
        $tret = html2trits($isi);
        print "\t[dapat:" . count($tret)."]\n";
       
        foreach ($tret as $t)
        {
         $badtitle = false;
         $testext = str_replace($bad_post, " VAVAVAVAVAVAVAVAVAVAV ", strtolower($t["title"]));
         $testext = explode(" ", $testext);
         $return  = true;
         foreach ($testext as $testext) {
            if (trim($testext)=="VAVAVAVAVAVAVAVAVAVAV") {
               $badtitle = true;
               break;
            }
         }
            if (substr($t["title"],0,7) != "Sticky:" && !$badtitle) $trits[$t["id"]] = $t["title"];
        }
       
        if (count($tret) == 0) $i--;
    }
    return $trits;
}


function random_komen($id,$bad_post,$min,$max)
{
    global $cURL;
    $total_hal = trit_page($id);
    if ($total_hal > 15)
    {
        $acak_hal = rand(1,$total_hal - 2);
        $komen = trit_posts($id, $acak_hal);
      print "\t[dapat:" . count($komen["posts"])."]\n";
        $cek = false;
        while (!$cek && count($komen["posts"])>0)
        {
         $cek  = true;
            $acak_post = array_rand($komen["posts"], 1);
            $post = $komen["posts"][$acak_post];
            $testext = $post[2];
         $testext = str_ireplace($bad_post, " VAVAVAVAVAVAVAVAVAVAV ", $testext);
         $testext = explode(" ", $testext);
         if($min>count($testext)||count($testext)>$max) $cek = false;
         if ($cek) foreach ($testext as $text) {
            if (trim($text)=="VAVAVAVAVAVAVAVAVAVAV") {
               $cek = false;
               break;
            }
         }
         if (!$cek) unset($komen["posts"][$acak_post]);
        }
        if (!$cek) return ""; else return $post[2];
    }
}

function komentar($title)
{
    $komen = array("iya yah? hmm :beer:","ijin menyimak dulu","serasa dejavu","hmm....","wekkkkkkks");
    $km = array_rand($komen,1);
    return $komen[$km];
}

function acak_p($komen)
{
    $total_post = count($komen["posts"]);
    $acak_post = array_rand($komen["posts"], 1);
    $post = $komen["posts"][$acak_post];
    return $post;
}

function trit_posts($id, $page=1)
{
    global $cURL;
    $c = ($page - 1) * 10;
    $trit = "http://m.kaskus.us/thread/$id/$c";
   print "\n";
   print "[+] Baca $trit";
    $a = $cURL->open($trit);
    $b = explode("<div class=\"post", $a);
    $kom = array(); $n = 0;
   
    foreach ($b as $c)
    {
        $komen = stringBetween("<hr size=\"0.2\" style=\"color: rgb(209, 209, 225); background-color: rgb(209, 209, 225);\"/>","<div class=\"right\">",$c);
        $komen = trim(strip_tags($komen));
        $usr_id = stringBetween("<a href=\"http://m.kaskus.us/user/profile/", "\"", $c);
        $usr_name = stringBetween("<a href=\"http://m.kaskus.us/user/profile/$usr_id\">","</a>",$c);
        if ($n == 2) { $ts_id = $usr_id; $ts_name = $usr_name; }
        if ($komen && $ts_id && $usr_id != $ts_id && (strpos(strtolower($komen),$usr_name)<=-1)) array_push($kom, array($usr_id, $usr_name, $komen));
        $n++;
    }
    $hsl = array("ts_id" => $ts_id, "ts_name" => $ts_name, "posts" => $kom);
    return $hsl;
}

function html2trits($html)
{
    $a =  stringBetween("<div id=\"forum\">","<div class=\"kaskusad\">",$html);
    $b = explode("<li", $a);
    $d = array();
    foreach ($b as $c)
    {
        $id = stringBetween("href=\"http://m.kaskus.us/thread/","/",$c);
        $title = trim(stringBetween("\">", "(&nbsp;<strong>1",$c));
        if ($title)
        {
            array_push($d, array("id" => $id, "title" => $title));
        }
    }
    return $d;
}

function trit_page($id)
{
    global $cURL;
    $trit = "http://m.kaskus.us/thread/$id/";
    $isi = $cURL->open($trit);
    $a =  stringBetween("<div class=\"paging\">","|",$isi);
    $b =  stringBetween(" of "," ",$a);
    return $b;
}

/* function to make some random proxy ss*/
function acak_proxy()
{
    global $config, $cURL, $cur_proxy;
    $x = array_rand($config["proxy"],1);
   
    while ($x == $cur_proxy)
    {
        $x = array_rand($config["proxy"],1);
    }
   
    $cur_proxy = $x;
    $proxy = $config["proxy"][$cur_proxy];
    $cURL->proxy_type = $proxy["type"];
    $cURL->proxy_url = $proxy["url"];
    $cURL->proxy_ip = $proxy["ip"];
    $cURL->proxy_port = $proxy["port"];

    print "[+] Used Proxy : " . $proxy["ip"].":".$proxy["port"]."\n";
}

function render_form($data)
{
    $t = "";
    foreach ($data as $k=>$v) { $t .= "&$k=$v";}
    return str_replace("###&","","###".$t);
}

function stringBetween($start, $end, $var)
{
    return preg_match('{' . preg_quote($start) . '(.*?)' . preg_quote($end) . '}s', $var, $m)
    ? $m[1]
    : '';
}

/*----------------------------------------------------------------------
    Class cURL
    this function used for curl extension for PHP
    if you have another idea let me know :)
    fell free to share it dude :)
------------------------------------------------------------------------*/
class cURL
{
    var $user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
    var $proxy_ip = "";
    var $proxy_port = 0;
    var $proxy_url = "";
    var $proxy_type = "";
    var $status = 0;
    var $error = "";
    var $timeout = 30;
    var $cookies = "";
    var $last_url = "";
    var $fix_cookies = false;

    function __construct($cookies)
    {
        if (!$cookies) $cookies = tempnam("./", "CURLCOOKIE");
        $this->cookies = $cookies;
    }

    function open($url,$post="") {
        $ch = curl_init();
        if ($this->proxy_url != "") $url = str_replace("%s", str_replace("http://","",$url), $this->proxy_url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        if ($post != "") {
            curl_setopt($ch, CURLOPT_POST,1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }

        curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
        curl_setopt($ch,CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch,CURLOPT_REFERER, $this->last_url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt ($ch, CURLOPT_COOKIEJAR, $this->cookies);
        curl_setopt ($ch, CURLOPT_COOKIEFILE, $this->cookies);

        if ($this->proxy_ip != "") {
            curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
            curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
            curl_setopt($ch, CURLOPT_PROXY, $this->proxy_ip);
            if ($this->proxy_type == "socks") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        }
        $data = curl_exec($ch);
            $this->status = curl_getinfo($ch,CURLINFO_HTTP_CODE);
            $this->error = curl_error($ch);
        $this->last_url = $url;
        curl_close($ch);
        return $data;
    }
}

/*----------------------------------------------------------------------
    This Class used for retrive data from  http://sockslist.net/
    to find working proxy and check it
    group by type and proxy port
    so we have fresh proxy all the time :)
------------------------------------------------------------------------*/
class findsock
{   
    function findsock()
    {
        $proxy = array();
        for ($i=1;$i<2;$i++)
        {
            $html = file_get_contents("http://sockslist.net/proxy/server-socks-hide-ip-address/$i");
            $matches = explode("t_ip", $html);
            $n = 0;

            foreach ($matches as $mt)
            {
                $ip = $this->stringBetween('">', "</td>", $mt);
                if ($n > 0 && $ip != "")
                {
                    $pt = explode(",", $this->stringBetween('t_port">', "</td>", $mt));
                    $port = "";
                    $kd = $this->stringBetween('fromCharCode(', '+parseInt', $html);
                    foreach ($pt as $p)
                    {
                        $a = intval($p) + intval($kd);
                        $port .= chr($a);
                    }
                    if ($n > 0 && $ip != "") array_push($proxy, array("type" => "socks", "ip" => $ip, "port" => $port, "url" => ""));
                }
                $n++;
            }
        }
        return $proxy;
    }

    function stringBetween($start, $end, $var)
    {
        return preg_match('{' . preg_quote($start) . '(.*?)' . preg_quote($end) . '}s', $var, $m)
        ? $m[1]
        : '';
    }
}

?>

evergreen2012
Posts: 2
Joined: 09 Apr 2012 11:08

Re: Help me "How to ?" it's about batch

#8 Post by evergreen2012 » 09 Apr 2012 11:20

Please SENT ME botsetting.ini :cry:

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Help me "How to ?" it's about batch

#9 Post by Ed Dyreen » 09 Apr 2012 17:57

'
How does this relates to a DOS batch forum ?

XAMPP Forum
http://www.apachefriends.org/f/

PHP Forum
http://www.php-forum.com/phpforum/

Locked