Reputation: 475
I am trying to figure out how can I call php functions running on remote of shoretel IP phone .
I can access it through browser by simple IP and it is flash player script but I want to do few things programmatically and I don't find any help to do the same.
The flash player app is calling following api https:///gateway.php?PHPSESSID=6432fc5f0999d0f4536fced79b95
and in payload of this it is calling php function like LSRoom_Remoting.getHeaderInfo
I am trying but getting error like "Malformed AMF message"
Here is the code
static void Main(string[] args)
{
ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
var content = new StringContent("LSRoom_Remoting.getBoardID", Encoding.UTF8, "application/x-amf");
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Accept","*/*");
client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
client.DefaultRequestHeaders.Add("Accept-Language", "en-US,en;q=0.9");
client.DefaultRequestHeaders.Add("Connection", "keep-alive");
//client.DefaultRequestHeaders.Add("Content-Length", "47");
//client.DefaultRequestHeaders.Add("Content-Type", "application/x-amf");
client.DefaultRequestHeaders.Add("Cookie", "PHPSESSID=3cbc7ff268e80e78e1458a4adfdd1f56");
client.DefaultRequestHeaders.Add("DNT", "1");
client.DefaultRequestHeaders.Add("Host", "10.6.32.21");
client.DefaultRequestHeaders.Add("Referer", "https://10.6.32.21/interface/ls_interface.swf");
client.DefaultRequestHeaders.Add("Origin", "https://10.6.32.21");
client.DefaultRequestHeaders.Add("X-Requested-With", "ShockwaveFlash/32.0.0.114");
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36");
var result = client.PostAsync(string.Format("https://10.6.32.21/gateway.php?PHPSESSID={0}", "3cbc7ff268e80e78e1458a4adfdd1f56"), content).Result;
//var result = client.DownloadString("https://10.6.32.21/interface/interface.php?uniqueKey=152322314997139&brand=shoretel&key=");
var obj = result.Content.ReadAsStringAsync();
Console.WriteLine(result.Content.ToString());
Console.ReadKey();
}
}
What i am doing wrong?
Upvotes: 0
Views: 147
Reputation: 76849
it seems likely, that the PHPSESSID
is long expired, while not using one from a recent request; because the default timeout is 15 minutes. in case it had not yet been expired, you still have to build a proper AMF
message, which consist of a header and a body. there is a library for that: amfphp, which at least should provide some clue how it should look alike, despite it is written in PHP
.
Upvotes: 0