Giter VIP home page Giter VIP logo

samfetch's People

Contributors

usamakarim avatar yimura avatar ysfchn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

samfetch's Issues

/latest returns 500 Server error

I can successufully get details about firmware for my model and region by using:
/DBT/SM-R895F/list
But when trying to fetch details about the latest firmware I get a server error:
/DBT/SM-R895F/latest

{"description":"Internal Server Error","status":500,"message":"The server encountered an internal error and cannot complete your request."}

Downloading does not work aswell:
/DBT/SM-R895F/latest/download

Even when trying to access the firmware using the correct path (got it from my browsing history) i still get Server error 500.

So I guess something changed on Samsungs backend?

Too little data for declared Content-Length

Path: /EUX/SM-F926B

Server Environment:

  • Docker
  • python:3.7.12-buster

Client Environment:

  • Chrome (95.0.4638.69)
  • curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Call Stack:
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 64, in app
    await response(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/responses.py", line 227, in __call__
    await wrap(partial(self.listen_for_disconnect, receive))
  File "/usr/local/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 567, in __aexit__
    raise exceptions[0]
  File "/usr/local/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 604, in _run_wrapped_task
    await coro
  File "/usr/local/lib/python3.7/site-packages/starlette/responses.py", line 223, in wrap
    await func()
  File "/usr/local/lib/python3.7/site-packages/starlette/responses.py", line 217, in stream_response
    await send({"type": "http.response.body", "body": b"", "more_body": False})
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 68, in sender
    await send(message)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 156, in _send
    await send(message)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 477, in send
    output = self.conn.send(event)
  File "/usr/local/lib/python3.7/site-packages/h11/_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "/usr/local/lib/python3.7/site-packages/h11/_connection.py", line 501, in send_with_data_passthrough
    writer(event, data_list.append)
  File "/usr/local/lib/python3.7/site-packages/h11/_writers.py", line 60, in __call__
    self.send_eom(event.headers, write)
  File "/usr/local/lib/python3.7/site-packages/h11/_writers.py", line 83, in send_eom
    raise LocalProtocolError("Too little data for declared Content-Length")
h11._util.LocalProtocolError: Too little data for declared Content-Length
INFO:     192.168.96.1:32934 - "GET /EUX/SM-F926B HTTP/1.1" 200 OK

[Bug] `/api/binary` endpoint returns the same response body regardless of request params

Not sure if I'm missing something but it seems like the /api/binary endpoint returns the same response body regardless of the params sent with the request.

Request:
/api/binary?region=XAA&model=SM-G986U1&firmware=G986U1UEU1DUB7%2FG986U1OYM1DUB7%2FG986U1UEU1DUB7%2FG986U1UEU1DUB7

Response:

{
  "display_name": "SSP",
  "size": 5991219840,
  "filename": "SM-G986U1_1_20210416234737_q8wahqy67m_fac.zip.enc4",
  "path": "/neofus/910/",
  "version": "R (Android 11)",
  "encrypt_version": 4,
  "size_readable": "5.58 GB",
  "decrypt_key": "60813b9c940b3e286de84bff7baaf403"
}

The 20210416 date of the firmware is what tipped me off because I'm trying to download a firmware from 2-28. So I also tried a couple of other firmwares (all pulled from the /api/list endpoint) and they all returned the same response as above. I'm guessing it's just returning info for the latest firmware every time but I'm not sure.

Warning "There are some data after the end of the payload data."

As SamFetch directly streams the file to the browser, I can't unpad the bytes of the last chunk of the file because Iterator and/or Generator doesn't allow me to know which chunk is the last, but it is normal, because SamFetch doesn't know when the file will finish downloading.

So it appends unnecessary bytes to the end of the file. And 7Zip (or etc) may return this warning. (not an error) when opening the archive.

There are some data after the end of the payload data.

But looks like it is not a critical issue because such programs like 7Zip can handle that as payload data is already stable/safe and file contents are decrypted as expected.

Anyways, if you get any errors while opening the archive because of the above error, use something like 7Zip.

Because of that hash values of the firmware archive also are different than shown on the Kies servers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.