You are not logged in.

#1 2024-04-27 21:48:29

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 187

PKGBUILD - file source 403 error code

I'm creating the following PKGBUILD

pkgname=netbios-share-scanner
pkgver=1.0
pkgrel=2
pkgdesc='This tool could be used to check windows workstations and servers if they have accessible shared resources.'
arch=('any')
url='https://www.secpoint.com/netbios-share-scanner.html'
license=('BSD')
depends=('python')
source=("https://www.secpoint.com/freetools/$pkgname-$pkgver.zip")
sha512sums=('7ac4c309c348707015b6e0e77bb1fa9595762b9e0b1ea5dd462a8d9810e6eed5dea8131690e236c91ea399a72ae2aa8a267fd848809c97acda04b7d6f6878568')

package() {
  cd "nb${pkgver/./}"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.txt

  rm README.txt

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

and I note that, during the download of the source, I get the error:

curl: (56) The requested URL returned error: 403
==> ERROR: Failure while downloading https://www.secpoint.com/freetools/netbios-share-scanner-1.0.zip
    Aborting...
==> ERROR: Failed to generate new checksums

while, if I download the file by the browser, I can download it with no issues.

Is there a way to make the process to download it as well with no errors?

Offline

#2 2024-04-27 22:06:04

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,660

Re: PKGBUILD - file source 403 error code

Going to that URL in a browser throws an error as well. Your link is just bad, it's 'shares', not 'share'.

Online

#3 2024-04-27 22:23:32

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 187

Re: PKGBUILD - file source 403 error code

Even if I add that "share" like:

source=("https://www.secpoint.com/freetools/netbios-shares-scanner-$pkgver.zip")

I continue to get:

==> ERROR: Failure while downloading https://www.secpoint.com/freetools/netbios-shares-scanner-1.0.zip
    Aborting...

Offline

#4 2024-04-27 22:25:17

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,660

Re: PKGBUILD - file source 403 error code

does it say why?

Online

#5 2024-04-27 22:54:17

seth
Member
Registered: 2012-09-03
Posts: 52,412

Re: PKGBUILD - file source 403 error code

cloudflare (and 403 is "forbidden")
-b cookies -c cookies will only get you a block warning instead of the target url

It's somwhat possible to get around cloudflares security measures, but I'm not sure you can put that into the AUR.

Offline

#6 2024-04-28 10:58:11

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,027

Re: PKGBUILD - file source 403 error code

https://www.secpoint.com/freetools/netbios-shares-scanner-1.0.zip

does work from within firefox for me.

makepkg & wget are not able to download it though.
Maybe some kind of a redirection issue ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2024-04-28 12:47:25

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 187

Re: PKGBUILD - file source 403 error code

The HTTP response is 403 when using PKGBUILD (curl). By using Chromium, instead, it is downloaded with no errors.

Last edited by D3vil0p3r (2024-04-28 12:48:22)

Offline

#8 2024-04-28 13:42:49

seth
Member
Registered: 2012-09-03
Posts: 52,412

Re: PKGBUILD - file source 403 error code

Faking the user agent will actually do in this particular case.

Offline

#9 2024-04-28 13:53:21

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 187

Re: PKGBUILD - file source 403 error code

How can I fake it in the PKGBUILD?

Offline

#10 2024-04-28 14:12:20

seth
Member
Registered: 2012-09-03
Posts: 52,412

Offline

#11 2024-05-12 15:28:08

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 187

Re: PKGBUILD - file source 403 error code

I tried those options but with no luck. Getting 403.

Offline

#12 2024-05-12 15:44:43

seth
Member
Registered: 2012-09-03
Posts: 52,412

Re: PKGBUILD - file source 403 error code

What options? The literal UA dummies in the wiki? Incl. the one that say "this will not work"?

Try

Mozilla_X11_Linux_x86_64_AppleWebKit_537.36_KHTML_like_Gecko_Chrome_123.0.0.0_Safari_537.36

The UA testers aren't exactly "AI", they just look for very generic tokens in the UA.

Offline

#13 2024-05-12 16:05:43

loqs
Member
Registered: 2014-03-06
Posts: 17,616

Re: PKGBUILD - file source 403 error code

Having curl remove the header completely worked for me.
Edit:
If you did need to set a value put the option and value in $pkgname.curlrc then:

CURL_HOME="$srcdir"
DLAGENTS=("https::/usr/bin/curl --config $pkgname.curlrc -fLC - --retry 3 --retry-delay 3 -o %o %u")

Last edited by loqs (2024-05-12 16:26:22)

Offline

Board footer

Powered by FluxBB