Jump to content

Archived

This topic is now archived and is closed to further replies.

barkster

GET Response?

Recommended Posts

I'm trying to access our copier at the office which tracks copy jobs, it is using post/get to send and retrieve.  I think I see how it is doing it but I need to try and figure out how to GET the information back from it.  I ran a packet sniffer on it and returned this and trying to find how I can retreive this in php or html?

***GET***
GET /acct/get_acct HTTP/1.1
Host: 192.168.100.35
Content-Type: application/xrx-acct-data
Content-Length: 0
Authorization: Basic YWNjb3VudDpqYm****==

***Response***
HTTP/1.1 200 OK
Date: Wed, 04 Oct 2006 17:35:31 GMT
Server: Webserver
Cache-Control: max-age=0, no-store
Content-Length: 3555
Content-Type: application/xrx-acct-data

4590 1 4594
Thu Jul 27 09:53:10 2006

"XRX_7665:4613"
    accounting-information = 41 4c 41 22 31 36 33 36 36
    accounting-information-avp = "XRX_USERID,ALA"
    accounting-information-avp = "XRX_ACCTID,16366"
    jba-device-name = "VDR538399 "
    job-identifier = "XRX_7665:4613"
    job-owner = "Local User"
    completion-time = 20061004113524
    job-name = "Copy Job 691"
    finishing = "none"
    job-type = copy
    lakes-number-of-images = 1
    job-copies-completed = 1
    media-sheets-completed = 1
    jba-media-block-1 = "cardstock, white, 234 X 285, 1, , 0, 1"
    jba-media-other-pages = 0
    jba-total-simplex-sheets = 1
    jba-total-duplex-sheets = 0
    jba-image-block-1 = "279 X 215, 1, , , 0, 1"
    jba-image-other-size = 0
    jba-completed-reasons = "completed-normal"
"XRX_7665:4612"
    accounting-information = 41 4c 41 22 31 36 33 36 36
    accounting-information-avp = "XRX_USERID,ALA"
    accounting-information-avp = "XRX_ACCTID,16366"
    jba-device-name = "VDR538399 "
    job-identifier = "XRX_7665:4612"
    job-owner = "Local User"
    completion-time = 20061004113456
    job-name = "Copy Job 690"
    finishing = "none"
    job-type = copy
    lakes-number-of-images = 1
    job-copies-completed = 1
    media-sheets-completed = 1
    jba-media-block-1 = "cardstock, white, 234 X 285, 1, , 1, 0"
    jba-media-other-pages = 0
    jba-total-simplex-sheets = 1
    jba-total-duplex-sheets = 0
    jba-image-block-1 = "279 X 215, 1, , , 1, 0"
    jba-image-other-size = 0
    jba-completed-reasons = "completed-normal"
"XRX_7665:4609"
    accounting-information = 41 4c 41 22 31 36 33 36 36
    accounting-information-avp = "XRX_USERID,ALA"
    accounting-information-avp = "XRX_ACCTID,16366"
    jba-device-name = "VDR538399 "
    job-identifier = "XRX_7665:4609"
    job-owner = "Aarmer"
    completion-time = 20061004113426
    job-name = "Microsoft Word - Covers.doc"
    finishing = "none"
    job-type = print
    lakes-number-of-images = 0
    job-copies-completed = 0
    media-sheets-completed = 0
    jba-media-block-1 = ""
    jba-media-other-pages = 0
    jba-total-simplex-sheets = 0
    jba-total-duplex-sheets = 0
    jba-completed-reasons = "deleted"
"XRX_7665:4608"
    accounting-information = 41 4c 41 22 31 36 33 36 36
    accounting-information-avp = "XRX_USERID,ALA"
    accounting-information-avp = "XRX_ACCTID,16366"
    jba-device-name = "VDR538399 "
    job-identifier = "XRX_7665:4608"
    job-owner = "Aarmer"
    completion-time = 20061004113416
    job-name = "Microsoft Word - Covers.doc"
    finishing = "none"
    job-type = print
    lakes-number-of-images = 0
    job-copies-completed = 0
    media-sheets-completed = 0
    jba-media-block-1 = ""
    jba-media-other-pages = 0
    jba-total-simplex-sheets = 0
    jba-total-duplex-sheets = 0
    jba-completed-reasons = "deleted"
"XRX_7665:4611"
    accounting-information = 41 4c 41 22 31 36 33 36 36
    accounting-information-avp = "XRX_USERID,ALA"
    accounting-information-avp = "XRX_ACCTID,16366"
    jba-device-name = "VDR538399 "
    job-identifier = "XRX_7665:4611"
    job-owner = "Aarmer"
    completion-time = 20061004113026
    job-name = "Microsoft Word - Covers.doc"
    finishing = "none"
    job-type = print
    lakes-number-of-images = 2
    job-copies-completed = 1
    media-sheets-completed = 2
    jba-media-block-1 = "standard, white, 216 X 279, 2, , 1, 1"
    jba-media-other-pages = 0
    jba-total-simplex-sheets = 2
    jba-total-duplex-sheets = 0
    jba-completed-reasons = "completed-normal"



Share this post


Link to post
Share on other sites
[quote author=barkster link=topic=110496.msg446738#msg446738 date=1159982463]I ran a packet sniffer on it and returned this and trying to find how I can retreive this in php or html?[/quote]
[quote]I ran a packet sniffer on it and returned this and trying to find how I can retreive this in php or html?[/quote]
If allow_url_fopen got the value "on", it is possible to use fopen()  and the other file functions to connect to the server, send a HTTP request and retrieve the response.

-> http://de3.php.net/manual/en/wrappers.http.php

Alternatively, you can use fsockopen()  to get more control of what is done. In this case, the cURL extension or a package which allows you to perform HTTP requests (such as PEAR::HTML_Request) might be a good choice, too.

-> http://php.net/fsockopen
-> http://php.net/curl
-> http://pear.php.net/package/HTTP_Request

Share this post


Link to post
Share on other sites
Cool, I'll look into that. Hopefully I can get it figured out.  Thanks

Looking at the line Authorization: Basic YWNjb3VudDpqYmF****==

is the "YWNjb3VudDpqYmFzZXJ2ZQ==" a password being sent?  I don't see it sending a username

Share this post


Link to post
Share on other sites
[quote author=barkster link=topic=110496.msg446824#msg446824 date=1159989066]is the "..." a password being sent?  I don't see it sending a username[/quote]

It is both: password and username encoded with base64. So, if you're going to use fsockopen(), see http://php.net/base64_encode. Otherwise, PHP will do it for you. Easily write [i]fopen('http://user:pass@host/path')[/i] and everything should work.

Btw: If you don't want everybody to know the password used above, better remove it... ;-)

Share this post


Link to post
Share on other sites
Thanks, ok then so it is both of them encoded.  That is my problem I don't know what they are so can I decode it or pass it straight to it already encoded. 

I can remove but they'd have a tough time getting to my copier but you never know.

Share this post


Link to post
Share on other sites
[quote author=barkster link=topic=110496.msg446875#msg446875 date=1159993790]That is my problem I don't know what they are so can I decode it or pass it straight to it already encoded.[/quote]

Yes, you can decode it. The username is "account" and the password "jbaserve" - doesn't sound very secret... ::)

Share this post


Link to post
Share on other sites
one more dumb question.  I can't access it directly of course I don't see a page name or anything but I see

GET /acct/get_acct HTTP/1.1
Host: 192.168.100.35

is the /acct/get_acct a directory on the webserver?  so it would be 192.168.100.35/acct/get_acct

I appreciate the help

Share this post


Link to post
Share on other sites
[quote author=barkster link=topic=110496.msg446878#msg446878 date=1159994772]is the /acct/get_acct a directory on the webserver?[/quote]

Probably. Just give it a try and check whether the following retrieves the expected data.

[code=php:0]<?php
  $contents = file_get_contents('http://account:jbaserve@192.168.100.35/acct/get_acct');
  echo $contents;
?>[/code]

Share this post


Link to post
Share on other sites
Looks like I may need to dig deeper. 

Warning: file_get_contents(http://...@192.168.100.35/acct/get_acct) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Inetpub\intranet\TestXerox.php on line 3

Share this post


Link to post
Share on other sites
[quote]HTTP request failed! HTTP/1.1 404 Not Found[/quote]
Strange. I expected it to  work, because the request PHP sends should be nearly the same as the one you've posted above.

Perhaps, there's another webserver running on a different port (your sniffer should tell you)!? Otherwise, a 404 status code seems to be inexplicable since the file/script actually exists.

Does it succeed in case of sending the sniffed request data with telnet or the like?

Share this post


Link to post
Share on other sites
I'm going to run a file monitor on the exe also but from what I remember from the sniffer it was sending to port 80 but I'll rerun.

Don't know whow to send sniffed request back to it and be able to read results.  I figured they had this tucked back somewhere in their server and I assumed since they sniffed packets didn't contain a page name it was just using a default page in that dir.

Share this post


Link to post
Share on other sites
[quote author=barkster link=topic=110496.msg447290#msg447290 date=1160065449]
I assumed since they sniffed packets didn't contain a page name it was just using a default page in that dir.
[/quote]

Don't care how they handle your request. acct/get_acct needn't to be a file or even a directory in the server's document root. But this is not of any interest.

[quote]Don't know whow to send sniffed request back to it and be able to read results.[/quote]

Start a console, type telnet 192.168.100.35:80 and after that paste the sniffed request.

Share this post


Link to post
Share on other sites
This is too weird if I access from the browser at http://192.168.100.35 it works fine and opens but I cannot telnet to 80

Here is what I get from the sniffer
client server client port server port
My-Server 192.168.100.35 1467 80

When I telnet I get:
telnet 192.168.100:35:80
Connecting To 192.168.100:35:80...Could not open connection to the host, on port 23: Connect failed

You'd think this would be a bit easier but I guess the manufacturer has figured out a better way to keep me out.  Looks straight forward.

Share this post


Link to post
Share on other sites
Well it has been 8 months since I visted this project.  I'm trying to get back into this and develop and application to resolve this.  I finally was able to go over a few things again and here are my results:

[code]
<?php
  $contents = file_get_contents('http://account:jbaserve@192.168.100.35/acct/get_acct');
  echo $contents;
?>
[/code]

above failed when I tried to run it - failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Inetpub\intranet\TestXerox.php on line 3

Telneting to the webserver on port 80 and pasting the get request DID work?  Any suggestions on how to retrieve this correctly using html?

Share this post


Link to post
Share on other sites

×

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.