0

I am trying to reach dell support website to be able to check server's warranty from the terminal.

I have found this link for curl, but it returns me access denied error.

curl https://www.dell.com/support/home/uk/en/ukdhs1/product-support/servicetag/$(dmidecode -s system-serial-number)/warranty?ref=captchasuccess

Output:

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;www&#46;dell&#46;com&#47;support&#47;home&#47;en&#47;en&#47;ukdhs1&#47;product&#45;support&#47;servicetag&#47;XXXXXX&#47;warranty&#63;" on this server.<P>
Reference&#32;&#35;18&#46;3fd86b68&#46;1653307511&#46;316d4d5
</BODY>
</HTML>

I have tried many similar links and different machines, the output seems to be always same.

Does anybody have an idea how to be able to access Dell support page via curl,wget, or similar command?

I am able to check warranty manually via browser.

I can go to https://www.dell.com/support/home/en-us and put serial number in "identify my product" tab. after clicking "view details", I can see the warranty expiration.

EDIT:

Curl is now working:

curl --header 'user-agent: Chrome/1337' https://www.dell.com/support/home/sk-sk/product-support/servicetag/<serial-number-here>/overview

or

curl --header 'user-agent: Chrome/1337' https://www.dell.com/support/home/uk/en/ukdhs1/product-support/servicetag/$(dmidecode -s system-serial-number)/warranty

The another problem is that output of this curl is:

  <!DOCTYPE html>
      <html>
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>Challenge Validation</title>
        <link rel="stylesheet" type="text/css" href="/_sec/cp_challenge/sec-3-6.css">
        <script type="text/javascript">function cp_clge_done(){location.reload(true);}</script>
        <script src="/_sec/cp_challenge/sec-cpt-int-3-6.js" async defer></script>
        <script type="text/javascript">sessionStorage.setItem('data-duration', 30);</script>
      </head>
      <body>
        <div class="sec-container">
          <div id="sec-text-container"><iframe id="sec-text-if" class="custmsg" src="/_sec/cca/esupp/index.htm"></iframe></div>
          <div id="sec-if-container">
            <iframe id="sec-cpt-if" class="crypto" data-key="" data-duration=30 src="/_sec/cp_challenge/ak-challenge-3-6.htm"></iframe>
          </div>
        </div>
      </body>
    </html>

I have tried to check it via web browser and to pass that challenge validation I had to wait up to 30 seconds, and then I was redirected to the desired page.

Is it possible to somehow setup curl or wget to actively display the webpage content for like 40 seconds ? Or do I have to to rather use elinks to achieve this goal ? And does elinks have an option to customize header with user-agent parameter?

EDIT2:

I have tried to install elinks and created ~/elinks/elinks.conf with this content:

set protocol.http.user_agent = "Chrome/1337"

But it again I get output access denied, most likely because the user agent header is not the last header

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

2

that's a really strange server... 3 issues here,

#1: they run on a user-agent whitelist, and curl is not on their whitelist. you can use the custom user-agent chrome/1337 to pass their useragent whitelist (and just saying "chrome" doesn't cut it, it must be chrome/A-NUMBER, but that number can be fake, it doesn't have to be a real chrome release number)

#2: that broken server only accepts requests where the very last http header is the User-Agent header. unfortunately for you, curl by default sends the Accept: */*-header as the very last header, with the user-agent header being the second-to-last-header this means that you can't use the --user-agent switch to get past the agent whitelist either, you must add the user-agent header with the --header arguments (which puts the header last, fortunately for you)

#3: that url ?ref=captchasuccess probably means that this is a redirect AFTER completing a captcha, meaning the captcha-completed data is part of your cookie session, which means you'll probably have to clear a captcha, then copy your cookie session to curl, then run the request..

anyway, for the user-agent issue, try

curl --header 'user-agent: Chrome/1337' https://www.dell.com/support/home/uk/en/ukdhs1/product-support/servicetag/$(dmidecode -s system-serial-number)/warranty?ref=captchasuccess

hanshenrik
  • 19,904
  • 4
  • 43
  • 89
  • Thank you. curl is now working. that captchasuccess was a workaround to bypass captcha but it was from a very old post i dont know if it is still needed. Curl is working which is good, but i am trying to achieve something like this : ```curl -sL http://www.dell.com/support/troubleshooting/us/en/555/Servicetag/$(dmidecode -s system-serial-number) | html2text -style pretty | awk -F\. '/with an end date of/ { print $1 "."}'``` output of the actual curl command does not have the warranty expiration date. it has ```challenge validation``` title. I will keep investigating. – Dielna Reboot May 24 '22 at 06:29
  • 1
    @DielnaReboot what's an actual valid url? – hanshenrik May 24 '22 at 08:36
  • 1
    @DielnaReboot did some more digging, fetching the service tag info is beyond what is *reasonable* to do with curl, you need to switch to a scripting language with *lib*curl support, and fetch it in libcurl. the initial reqeuest needs an `Accept-Language` header to not get the captcha page, then you will be redirected, that redirect also needs specific headers to not get captcha'ed (i haven't checked exactly what headers is needed, but setting headers for the redirect is beyond the cli program curl, that's when you should change to a scripting language with libcurl support.) – hanshenrik May 24 '22 at 08:53
  • 1
    @DielnaReboot did some more digging. this is beyond what is reasonable to do with even libcurl. the servicetag website will issue a javascript challenge to make sure the client has functional javascript, and libcurl has no javascript support. switch to a headless browser (think Puppeteer or Selenium) – hanshenrik May 24 '22 at 09:09
  • valid url is for example https://www.dell.com/support/home/sk-sk/product-support/servicetag/3DW0NM3/overview I was thinking about selenium before but i thought that solution could be easier. Thank you for investigation. I will try ```selenium```. – Dielna Reboot May 24 '22 at 09:19