peci1 / lumix-link-desktop

A unofficial desktop version of the Panasonic Lumix Link app for remote control of your Lumix camera.
BSD 3-Clause "New" or "Revised" License
154 stars 21 forks source link

How to remotely access stored pictures? #17

Open noeldum opened 1 year ago

noeldum commented 1 year ago

Nice project. I managed to get this running fine on Ubuntu machine.

However my initial project was to access the stored pictures remotely over wifi. This application seems to do more with actual control of the shutter and else.

Well now that I have a kind of connection between my Lumix and my Ubuntu box I am not far from my goal.

Would you have some hint how I can grab my stored picture on the camera?

IdrisTheDragon commented 1 year ago

You'll need to work out which bit of the api is used. When I was playing with this I used this app: https://play.google.com/store/apps/details?id=app.greyshirts.sslcapture (but anything like wireshark would do) to capture the network between the official android app and the camera when doing certain things. Looking at that should show you what request is used to ask for a photo and the response it receives.

noeldum commented 1 year ago

Thank you. I did think about using a sniffer but was hoping someone had already sniffed all functions and documented them. Will give that route a try then and post my results here if any.

noeldum commented 1 year ago

Ok. Somehow it appears simple at least just to download the picture but I can't get it to work. Here is my capture below when requesting to download the picture from the app.

photo_2023-03-12_17-12-40

It's just a plain http static file request. So I went and connected the camera to the office wifi network. Spotted the ip address and tried as follow

wget http://192.168.0.69:50001/DL1000386.JPG

it replied: ERROR 404: Not Found.

Also tried this below but same result

curl -v -H 'User-Agent: Apache-HttpClient' -X GET http://192.168.0.69:50001/DL1000386.JPG -O

Curl says it connects with the camera server fine but the file does not exists. That's strange.

If I could just download the picture by providing the filename that would do for a start.

Any idea where I should investigate now?

IdrisTheDragon commented 1 year ago

Off the top of my head... Try open the control.html first which will establish a connection to the camera and run a keepalive periodically to keep it open.

Then the camera may allow the image request.....

(Potentially also need to include the connection = keep alive header in your curl request that can be seen in the packet capture.)

noeldum commented 1 year ago

I usually have Control.html open when I do that yes. Here my last curl request: curl -v -H 'User-Agent: Apache-HttpClient' -H 'Connection: Keep-Alive' -H 'Accept-Encoding: gzip' http://192.168.0.69:50001/DL1000386.JPG

which comes back as

*   Trying 192.168.0.69:50001...
* Connected to 192.168.0.69 (192.168.0.69) port 50001 (#0)
> GET /DL1000386.JPG HTTP/1.1
> Host: 192.168.0.69:50001
> Accept: */*
> User-Agent: Apache-HttpClient
> Connection: Keep-Alive
> Accept-Encoding: gzip
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Server: KDM SERVER Version 0.1
< Connection: close
< 
* Closing connection 0

I will dive in the sniffer again and see if I can find any special mode to set the camera in for picture download. Will update here if found.

noeldum commented 1 year ago

Managed to set the camera into playmode but that does not make it work either.

curl -v -H 'User-Agent: Apache-HttpClient' -H 'Connection: Keep-Alive' -H 'Accept-Encoding: gzip' 'http://192.168.0.69/cam.cgi?mode=camcmd&value=playmode'

IdrisTheDragon commented 1 year ago

I had a quick browse of a network capture on my phone: There looks to be a soap api on port 60606 that seems to be used after it's been put in playmode, that looks like it's used to browse the files (including the image previews?) then there are two? requests that seem to happen just before the 50001 one. Might be what you need.

peci1 commented 1 year ago

Thanks @IdrisTheDragon for helping with this issue. I don't use the app actively at the moment, but I still have Lumix as my primary camera, so I can test if you come with some proposal on how to add the image download mode.

You can also look into cookies. Maybe the camera sends you a cookie which then enables the download?