barkster Posted October 4, 2006 Share Posted October 4, 2006 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.1Host: 192.168.100.35Content-Type: application/xrx-acct-dataContent-Length: 0Authorization: Basic YWNjb3VudDpqYm****==***Response***HTTP/1.1 200 OKDate: Wed, 04 Oct 2006 17:35:31 GMTServer: WebserverCache-Control: max-age=0, no-storeContent-Length: 3555Content-Type: application/xrx-acct-data4590 1 4594Thu 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" Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/ Share on other sites More sharing options...
JaGeK Posted October 4, 2006 Share Posted October 4, 2006 [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.phpAlternatively, 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 Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103845 Share on other sites More sharing options...
barkster Posted October 4, 2006 Author Share Posted October 4, 2006 Cool, I'll look into that. Hopefully I can get it figured out. ThanksLooking at the line Authorization: Basic YWNjb3VudDpqYmF****==is the "YWNjb3VudDpqYmFzZXJ2ZQ==" a password being sent? I don't see it sending a username Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103877 Share on other sites More sharing options...
JaGeK Posted October 4, 2006 Share Posted October 4, 2006 [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... ;-) Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103902 Share on other sites More sharing options...
barkster Posted October 4, 2006 Author Share Posted October 4, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103928 Share on other sites More sharing options...
JaGeK Posted October 4, 2006 Share Posted October 4, 2006 [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... ::) Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103929 Share on other sites More sharing options...
barkster Posted October 4, 2006 Author Share Posted October 4, 2006 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.1Host: 192.168.100.35is the /acct/get_acct a directory on the webserver? so it would be 192.168.100.35/acct/get_acct I appreciate the help Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103931 Share on other sites More sharing options...
JaGeK Posted October 4, 2006 Share Posted October 4, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103932 Share on other sites More sharing options...
barkster Posted October 4, 2006 Author Share Posted October 4, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-103938 Share on other sites More sharing options...
JaGeK Posted October 5, 2006 Share Posted October 5, 2006 [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? Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-104253 Share on other sites More sharing options...
barkster Posted October 5, 2006 Author Share Posted October 5, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-104336 Share on other sites More sharing options...
JaGeK Posted October 5, 2006 Share Posted October 5, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-104349 Share on other sites More sharing options...
barkster Posted October 5, 2006 Author Share Posted October 5, 2006 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 80Here is what I get from the snifferclient server client port server portMy-Server 192.168.100.35 1467 80When I telnet I get:telnet 192.168.100:35:80Connecting To 192.168.100:35:80...Could not open connection to the host, on port 23: Connect failedYou'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. Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-104439 Share on other sites More sharing options...
barkster Posted May 16, 2007 Author Share Posted May 16, 2007 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 3Telneting to the webserver on port 80 and pasting the get request DID work? Any suggestions on how to retrieve this correctly using html? Quote Link to comment https://forums.phpfreaks.com/topic/22992-get-response/#findComment-254610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.