/** * main * * @args command line args */ function main($argc, $argv) { global $fetion_proxy; global $fetion_debug; $user_mobile = null; $password = null; $sendto_sid = null; $content = null; $send_all = false; $proxy_host = null; $proxy_port = null; // caution, need to change to your own fetion number $mobiledn = 'FIXME'; $passwd = 'FIXME'; $cmcc_fetion_ip = '221.176.31.36'; $cmcc_fetion_pt = '443'; if ($argc < 2) { usage(); return 1; } for ($I = 1; $I < $argc; ++$I) { if ($argv[$I] == '-p') { $fetion_proxy = $argv[++$I]; list($proxy_host, $proxy_port) = split(":", $fetion_proxy, 2); if ($proxy_host === null) { $proxy_host = '10.10.10.10'; } if ($proxy_port === null) { $proxy_port = '8080'; } } else { if ($argv[$I] == '-d') { $fetion_debug = true; } else { if ($argv[$I] == '-a') { $send_all = true; } else { if ($argv[$I] == '-c') { $content = $argv[++$I]; } } } } /* } else { $user_mobile = $argv[$I++]; $password = $argv[$I++]; if (isset($argv[$I])) { $sendto_sid = $argv[$I++]; $content = $argv[$I]; } break; } */ } if ($content === null) { $content = "\n"; $content = sms_get_txt("http://10.10.10.11/GRE.txt", $content); $content = sms_get_txt("http://10.10.10.11/GRE1.txt", $content); //$content = sms_get_news($content); } else { $content = iconv("GBK", "UTF-8", $content); } /*wopwhite login fetion and get ssic and sid*/ $login_info = fetion_login($mobiledn, $passwd); if ($login_info === false) { print "[*] login failed\r\n"; return 1; } $ssic = $login_info['ssic']; $sid = $login_info['sid']; $domain = $login_info['domain']; if ($fetion_debug) { print "[*] https get successful\r\n"; print "[*] ssic={$ssic}\n"; print "[*] sid={$sid}\n"; print "[*] domain={$domain}\n"; } if ($fetion_proxy != null) { $http_tunnel = http_tunnel_connect($proxy_host, $proxy_port, $cmcc_fetion_ip, $cmcc_fetion_pt); if ($http_tunnel === false) { print "[*] http_tunnel failed\r\n"; return 1; } $ok = fetion_register($ssic, $sid, $domain, $passwd, $http_tunnel); if ($ok === false) { print "[*] register failed\r\n"; return 1; } fetion_debug("register successful"); // send sms to wopwhite himself // caution, need to change fetion id to your own number $ok = fetion_send_sms($sid, 'sip:FIXME@fetion.com.cn;p=0000', $content, $http_tunnel); if ($fetion_debug) { print "[*] send sms " . strval($ok ? 'successful' : 'failed') . "\r\n"; } if ($send_all === true) { $buddies = fetion_get_buddy_list_directly($sid, $http_tunnel); if ($buddies === false) { print "[*] get buddy list failed\r\n"; } else { if ($fetion_debug) { print "[buddy_sid] [name]\r\n"; } foreach ($buddies as $buddy_sid => $name) { if ($fetion_debug) { printf(" %35s => %s\r\n", $buddy_sid, $name); } $ok = fetion_send_sms($sid, $buddy_sid, $content, $http_tunnel); if ($fetion_debug) { print "[*] send sms " . strval($ok ? 'successful' : 'failed') . "\r\n"; } } } } } }
/** * main * * @args command line args */ function main($argc, $argv) { global $fetion_proxy; global $fetion_debug; $user_mobile = null; $password = null; $sendto_sid = null; $content = null; if ($argc < 2) { usage(); return 1; } for ($I = 1; $I < $argc; ++$I) { if ($argv[$I] == '-p') { $fetion_proxy = $argv[++$I]; } else { if ($argv[$I] == '-d') { $fetion_debug = true; } else { $user_mobile = $argv[$I++]; $password = $argv[$I++]; if (isset($argv[$I])) { $sendto_sid = $argv[$I++]; $content = $argv[$I]; } break; } } } $login_info = fetion_login($user_mobile, $password); if ($login_info === false) { print "[*] login failed\r\n"; return 1; } $ssic = $login_info['ssic']; $sid = $login_info['sid']; $domain = $login_info['domain']; print "[*] login successful\r\n"; $ok = fetion_http_register($ssic, $sid, $domain, $password); if ($ok === false) { print "[*] register failed\r\n"; return 1; } print "[*] register successful\r\n"; if (empty($sendto_sid) || empty($content)) { $buddies = fetion_get_buddy_list($ssic, $sid); if ($buddies === false) { print "[*] get buddy list failed\r\n"; } else { print " [sid] [name]\r\n"; foreach ($buddies as $sid => $name) { printf(" %35s => %s\r\n", $sid, $name); } } } else { $ok = fetion_http_send_sms($ssic, $sid, $sendto_sid, $content); print "[*] send sms " . strval($ok ? 'successful' : 'failed') . "\r\n"; } }