Jump to content

abhivinay

Members
  • Posts

    5
  • Joined

  • Last visited

abhivinay's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi , Could some one help me . I am new to webservices . I have client request like <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header /><v:Body><n0:Mghonttrd id="o0" c:root="1" xmlns:n0="http://mytestwebsite4soap.com"><Mghonttrd i:type="n0:Mghonttrd"><ngtrgs i:type="d:string">444</ngtrgs></Mghonttrd></n0:Mghonttrd></v:Body></v:Envelope> I want server to check the dynamic value of string " ngtrgs" and send the result according to the value by using if condition. suppose if ngtrgs=444 then it should return array('status'=>"active", 'Name'=>"abhi", 'age=>"20", 'class'=>"12"); if ngtrgs= 555 then return array('status'=>"active", 'Name'=>"vinay", 'age=>"19", 'class'=>"12"); server side i have code .... etc., server side code is below <?php require_once './nusoap/lib/nusoap.php'; //Retrieve zip code for textual area //Logic of the web service function Mghonttrd($ngtrgs) { //if ($ngtrgs == "444") { return array('status'=>"active", 'Name'=>"abhi", 'age=>"20", 'class'=>"12"); } } //Register web service function so that clients can access $server = new soap_server(); $server->register('Mghonttrd'); $POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA'])? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; $server->service($POST_DATA); ?> Thankyou
  2. HI i have following file which look for License file and do encryption and decryption of contents then if matches it forward the DB queries . I want to bypass the license check but keep the functionality as it is . I am not php expert please help <?php class FreeSwitch { public $request = array( ); public $cdr_variable = array( ); public $auth_arry = array( ); public $cdrlogdata = NULL; public $flag = 0; public $fh = NULL; public $fhquery = NULL; public $lstr = NULL; public $xmldata = NULL; public $return_array = array( ); public $mac_addr = NULL; public $auth_key = "2513^%edpceswitchv#@)KHGTRESBGFCD(NH^%#@\$%^&*N{}IU?\\|!@gh!12412ast8765%432133df121212x1as21%#&*#&jdh1asa!kdgakjakssjdhshmhsyw092)8@#!@)*9&&%^-+\$#2fyFADhdjshdijs"; public function GetAddress($os_type) { switch( strtolower($os_type) ) { case "linux": $this->forLinux(); break; case "solaris": break; case "unix": break; case "aix": break; default: $this->forWindows(); break; } $temp_array = array( ); foreach( $this->return_array as $value ) { if( preg_match("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $value, $temp_array) ) { $this->mac_addr[] = $temp_array[0]; } } unset($temp_array); return $this->mac_addr; } public function encrypt($string) { $result = ""; for( $i = 0; $i < strlen($string); $i++ ) { $char = substr($string, $i, 1); $keychar = substr($this->auth_key, $i % strlen($this->auth_key) - 1, 1); $char = chr(ord($char) + ord($keychar)); $result .= $char; } return base64_encode($result); } public function decrypt($string) { $result = ""; $string = base64_decode($string); for( $i = 0; $i < strlen($string); $i++ ) { $char = substr($string, $i, 1); $keychar = substr($this->auth_key, $i % strlen($this->auth_key) - 1, 1); $char = chr(ord($char) - ord($keychar)); $result .= $char; } return $result; } public function forWindows() { @exec("ipconfig /all", $this->return_array); if( $this->return_array ) { return $this->return_array; } $ipconfig = $_SERVER["WINDIR"] . "system32ipconfig.exe"; if( is_file($ipconfig) ) { @exec($ipconfig . " /all", $this->return_array); } else { @exec($_SERVER["WINDIR"] . "systemipconfig.exe /all", $this->return_array); } return $this->return_array; } public function forLinux() { @exec("ifconfig ", $this->return_array); return $this->return_array; } public function manageKey() { $this->writelog($this->request["hostmac"]); if( file_exists("license") ) { $dump_linfo = file("license"); $response = json_decode($this->decrypt($dump_linfo[0])); $this->GetAddress(PHP_OS); foreach( $response as $value ) { $linfo[] = trim($value); } $dt = date("Ymd"); if( $linfo[2] <= $dt ) { return 0; } if( $linfo[3] == "00:00:00:00:00:00" ) { return 0; } if( in_array($linfo[3], $this->mac_addr) ) { $reg = $this->getRegNum(); if( $reg < $linfo[0] ) { return 1; } return 0; } } return 0; } public function dialplanstatus() { $this->writelog($this->request["hostmac"]); if( file_exists("license") ) { $dump_linfo = file("license"); $response = json_decode($this->decrypt($dump_linfo[0])); $this->GetAddress(PHP_OS); foreach( $response as $value ) { $linfo[] = trim($value); } $dt = date("Ymd"); if( $linfo[2] <= $dt ) { return 0; } if( $linfo[3] == "00:00:00:00:00:00" ) { return 0; } if( in_array($linfo[3], $this->mac_addr) ) { $calls = $this->runningcall(); if( $calls < $linfo[1] ) { return 1; } return 0; } } return 0; } public function runningcall() { $value = 0; $query = sprintf("SELECT count( DISTINCT uuid) FROM `live_activecall`"); $this->db->query($query); $rs = $this->db->resultset(); foreach( $rs[0] as $key => $value ) { return $value; } return $value; } public function logfile_open() { $this->fh = fopen(LOGFILE, "a"); } public function logfile_openquery() { $this->fhquery = fopen(QUERYLOGFILE, "a"); } public function writelogquey($log) { $log = $log . "\n"; fwrite($this->fhquery, $log); } public function writelog($log) { date_default_timezone_set("Asia/Kolkata"); $datestr = date("M d H:i:s"); $log = "" . $datestr . " :: " . $log . "\n"; fwrite($this->fh, $log); } public function set_requestdata($_REQUEST) { $this->xmldata = serialize($_REQUEST); foreach( $_REQUEST as $key => $value ) { $this->lstr .= "" . "[" . $key . " : " . urldecode($value) . ]"; $this->request[$key] = mysql_real_escape_string(trim(urldecode($value))); } } public function set_flag() { $this->flag = 1; } public function reset_flag() { $this->flag = 0; } public function blank_responce() { $this->responce = "<?xml version=\"1.0\"?>\n <document type=\"freeswitch/xml\">\n <section name=\"dialplan\" description=\"Regex/XML Dialplan\">\n <context name=\"default\"> \n <action application=\"info\"/>\n <action application=\"respond\" data=\"503\"/>\n <action application=\"hangup\"/>\n </context>\n </section>\n </document>"; } public function get_cdrvariable($str) { $str = json_decode(json_encode((array) simplexml_load_string($str)), 1); $this->xmldata = serialize($str); foreach( $str as $key => $value ) { if( $key == "variables" && is_array($value) ) { foreach( $value as $key1 => $value1 ) { $this->cdr_variable[$key1] = mysql_real_escape_string(trim(urldecode($value1))); $this->cdrlogdata .= "" . "[" . $key1 . " : " . urldecode($value1) . "]"; $this->cdrlogdata1 .= "" . $key1 . " : " . urldecode($value1) . "\n"; } } } } public function minute_calculation($rate, $inittine, $credit) { $this->timeout = intVal($credit / $rate); } public function getRegNum() { $value = 0; $query = sprintf("SELECT count(registrations.reg_user) FROM `registrations`"); $this->db->query($query); $rs = $this->db->resultset(); foreach( $rs[0] as $key => $value ) { return $value; } return $value; } } ?>
  3. Thankyou somuch equinix , its working . what if i post multiple values and test value if correct or not and then reply echo . is the below code is correct ?. Please help POST body contains from client is user=8104&pass=1234 <?php ob_start("ob_gzhandler"); switch ($_POST["user"] switch ($_POST["pass"]) { case (8104&1234): echo " test 123 test 456 test 789 "; break; case (8105&5678): echo "test 321 test 654 test 987 "; break; } Please reply ... Thank you
  4. Hi could some one tell what is going on here in this tcp dump . It doesnt seem to be webservices . I got this trace from wireshark . client POST to mypages.info and mypages.info will send the data back . Suppose if the client posts USER as user=8104 and server should reply the below plain data with gzip " test 123 test 456 test 789 " , if user=8105 then server will reply with teh data "test 321 test 654 test 987 " in encoded format . there is no index.php in POST request of client as you can see it from wireshark trace .but it just post to host mypages.info so i guess the index.php is taking care of sending the data to client. Some one can help me with server side index .php code to achieve this ?. POST / HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 Content-Length: 25 Host: MYPAGES.INFO Content-Type: application/x-www-form-urlencoded user=8104&id=dl HTTP/1.1 200 OK Date: Wed, 08 May 2013 16:40:17 GMT Server: Apache/2.2.15 (CentOS) X-Powered-By: PHP/5.4.11 Content-Length: 522 Connection: close Content-Type: text/html; charset=UTF-8 utK,../2.D&XZjAaCi.k.1*$W$R.0'\.v..eS~TaK\e^EXh..x.1wwA$.[*#9.kK.%...?VS;.o*$^{Y.og^.=..#ZH.?TV2 . .\(.W.6.[s.\2.4.+[V5...?G...-*$^$LF6w.a T]2 1.5YE5...?G.k.7;u xU.v>.Eq..:.T;...`..fAxgz.vB.mnL.{.S2...5..0.Z.)E $ #:(A(.W+.. :.Gf."Qv..?...?..:. *(\4.F*x\.$RMiS`[tTYbX[.?L.k.-- V8R]?1^. [P<.)Se..$...d..aUpzz.n.W.<.Nq.B' n.7YE%..VfE@2.(1u.qX.i`U....kL .<..+ZH 4jB%.'w$]}CW7..E*Q k.9.<[[aTHG)\H2F};.A$..hoR.s.F2.5 gY.6..Vo..<.$9u.2.@-iS.z..kL#.cItqw.3.@)i^D;V@".n\eJ.'...)..x.1*$W$R.v/.[q=
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.