Outils pour utilisateurs

Outils du site


blog

Notes Debian binaire 32 bits i386 sur 64 bits x86 64

Contexte :

Security Dongle Key Omniplanar \ hasp key driver / Sentinel HASP Run time pour Omniplanar aksusbd-2.2.1-i386

Pb Not a dynamic executable

LANG=C ldd aksusbd
Not a dynamic executable

Dans notre cas, c'est parce que nous n'avons pas la glibc pour l'architecture i386

Sur Wheezy, il suffisait de faire

apt-get install ia32-libs

Sur Jessie pour la compatibilité 32 bits

dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386
$ file * | grep "ELF 32-bit"
aksusbd:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.0, stripped
hasplmd:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, stripped
hasp_update: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.0, not stripped
winehasp:    ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=d63fda12502cb547f34043b9832fcf14a1485792, stripped
ldd aksusbd hasplmd hasp_update winehasp
aksusbd:
        linux-gate.so.1 (0xf7720000)
        libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf76f1000)
        libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf7544000)
        /lib/ld-linux.so.2 (0xf7723000)
hasplmd:
        linux-gate.so.1 (0xf76e9000)
        libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf7690000)
        librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf7687000)
        libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf766a000)
        libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf7665000)
        libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf74b8000)
        /lib/ld-linux.so.2 (0xf76ec000)
hasp_update:
        linux-gate.so.1 (0xf772f000)
        libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7700000)
        libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf7553000)
        /lib/ld-linux.so.2 (0xf7732000)
winehasp:
        linux-gate.so.1 (0xf76fc000)
        libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf753c000)
        /lib/ld-linux.so.2 (0xf76ff000)

Installation

cd aksusbd-2.2.1-i386
sudo ./dinst

Vérif 1

# ps -ef
root     14011     1  0 17:57 ?        00:00:00 /usr/sbin/aksusbd
root     14015     1  0 17:57 ?        00:00:00 /usr/sbin/winehasp
root     14017     1  0 17:57 ?        00:00:00 /usr/sbin/hasplmd -s

Vérif 2

reboot
systemctl status aksusbd

Debian 9

apt-get install ia32-libs                                                                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  lib32z1 lib32ncurses5

E: Package 'ia32-libs' has no installation candidate
apt-get install libc6-i386

Pour crosscompiler

apt-get install libc6-dev-i386 g++-multilib

Autres

setarch /usr/bin/i386

Paquet ia32-libs-i386

Le paquet ia32-libs-i386 est un méta-paquet qui a pour dépendances :

freeglut3
lesstif2
libacl1
libaio1
libasyncns0
libattr1
libaudio2
libaudiofile1
libavahi-client3
libavahi-common3
libbsd0
libcap2
libcomerr2
libcups2
libcurl3
libdbus-1-3
libdirectfb-1.2-9
libdrm2
libdrm-intel1
libdrm-radeon1
libedit2
libesd0
libexif12
libexpat1
libflac8
libfltk1.1
libfontconfig1
libfreetype6
libgcrypt11
libgdbm3
libgl1-mesa-dri
libgl1-mesa-glx
libglu1-mesa
libgnutls26
libgpg-error0
libgphoto2-2
libgphoto2-port0
libgssapi-krb5-2
libice6
libidn11
libieee1284-3
|libjack0
libjack-jackd2-0
libjpeg62
libjpeg8
libk5crypto3
libkeyutils1
libkrb5-3
libkrb5support0
liblcms1
libltdl7
liblzo2-2
libmpg123-0
libnspr4-0d
libnss3-1d
libodbc1
libogg0
libopenal1
libpam0g
libpng12-0
libpopt0
libpulse0
libsamplerate0
libsane
libsasl2-2
libsdl1.2debian
libselinux1
libsigc++-2.0-0c2a
libsm6
libsndfile1
libsqlite3-0
libssh2-1
libssl1.0.0
libstdc++5
libsvga1
libsysfs2
libtasn1-3
libtdb1
libtiff4
libts-0.0-0
libusb-0.1-4
libuuid1
libvorbis0a
libvorbisenc2
libvorbisfile3
libwrap0
libx11-6
libx86-1
libxau6
libxaw7
libxcb1
libxcb-render0
libxcb-render-util0
libxcomposite1
libxcursor1
libxdamage1
libxdmcp6
libxext6
libxfixes3
libxft2
libxi6
libxinerama1
libxml2
libxmu6
libxmuu1
libxp6
libxpm4
libxrandr2
libxrender1
libxslt1.1
libxss1
libxt6
libxtst6
libxv1
libxxf86vm1
odbcinst1debian2
xaw3dg
2025/03/24 15:06

Notes dbus

dbus-send

dbus-send --session           \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames
 
dbus-send --system            \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames
 
dbus-send --system             \
  --dest=org.freedesktop.DBus  \
  --type=method_call           \
  --print-reply                \
  /org/freedesktop/DBus/UPower \
  org.freedesktop.DBus.ListNames  
 
 
dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
 
dbus-send \
  --system \
  --print-reply \
  --dest=org.freedesktop.login1 \
  /org/freedesktop/login1 \
  org.freedesktop.login1.Manager.Suspend \
  boolean:true
2025/03/24 15:06

Note curl wget

URL / URI

Voir :

URI (Uniform Resource Identifier) :

  • Name : URN (Uniform Resource Name)
  • Location : URL (Uniform Resource Locator)
URI

URL, URI and URN

URL

En anglais, on la décrit ainsi :

scheme : // authority / path ? query # hash 

Dans sa traduction française :

plan : // autorité / chemin ? requête # fragment 

Enfin , comme on l'explique à notre manière :

comment : // chez_qui / où ? question # extrait 

Source : https://cpu.dascritch.net/post/2023/10/12/Standard-%3A-%28Rappel%29-les-segments-d-une-URL

Syntax of URL

scheme: subdomain/domain-name.Top-level-domain/sub-folder

wget / curl

curl as wget

curl -O -L http://acme.org/download/plop.tar.gz

Point wget to TOR/Privoxy:

#export http_proxy=http://127.0.0.1:8118/
#export https_proxy=http://127.0.0.1:8118/
export ALL_PROXY=http://127.0.0.1:8118/
 
# Ou
 
curl -x "http://127.0.0.1:8118" "http://gnu.org"

curl

Voir aussi HTTPie

Voir :

JSON

curl -k https://aap-controller.local/api/v2/users/27/roles/ -X POST -u user:password --data-raw '{"id":534}'
curl --globoff --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/169/pipeline?ref=master&variables[0][key]=VAR1&variables[0][value]=hello&variables[1][key]=VAR2&variables[1][value]=world"
 
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{ "ref": "master", "variables": [ {"key": "VAR1", "value": "hello"}, {"key": "VAR2", "value": "world"} ] }' \
  --url "https://gitlab.example.com/api/v4/projects/169/pipeline"

Source : https://docs.gitlab.com/api/rest/

Préciser le host sans modifier les /etc/hosts

curl -H "Host:www.acme.fr" 192.168.2.14:80 

Météo (Basé sur Wego)

curl -4 wttr.in
curl -H "Accept-Language: it" wttr.in/Rome

/etc/hosts

curl --resolve www.acme.fr:80:192.168.2.10 \
     --resolve www.acme.fr:443:192.168.2.10 \
     http://www.acme.fr

Forcer SSLv3 Pour vérifier que ça ne marche pas, car ca chiffrement est obsolète -k Pour les certificat auto-signé

Voir CURLOPT_SSLVERSION

curl -3 -k --show-error --verbose https://acme.fr

Erreur status code

curl --show-error --verbose -I http://www.acme.fr
curl --write-out "\nhttp_code=%{http_code}\ total_time=%{time_total}\n"
 
curl -s -o /dev/null -k -I -w "%{http_code}\n" https://www.acme.fr

Timeout

curl -m 3 https://www.acme.fr
Fichier config .curlrc

.curlrc

# Source : https://gist.github.com/v1m/f1d4751883f19c916515

# store the trace in curl_trace.txt file. beware that multiple executions of the curl command will overwrite this file
--trace curl_trace.txt

# store the header info in curl_headers.txt file. beware that multiple executions of the curl command will overwrite this file
--dump-header curl_headers.txt

#change the below referrer URL or comment it out entirely
-e "https://www.google.com"

#change the below useragent string. get your/other UA strings from http://www.useragentstring.com/
-A "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13"

#some headers
-H  "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
-H  "Upgrade-Insecure-Requests: 1"
-H  "Accept-Encoding: gzip, deflate, sdch"
-H  "Accept-Language: en-US,en;q=0.8"

.curlrc

Source https://github.com/necolas/dotfiles/blob/0d402c916f6e1118b20bd4befff863c1e4a2ee2d/shell/curlrc

# Limit the time (in seconds) the connection to the server is allowed to take
connect-timeout = 30

# Limit the time (in seconds) the whole operation is allowed to take
# (prevents cURL from hanging due to slow networks or links going down)
max-time = 300

# When following a redirect, automatically set the previous URL as referer
referer = ";auto"

# cURL default configuration file
# http://curl.haxx.se/docs/manpage.html

# Show error messages
show-error

# Show progress using a progress meter
progress-bar

# Send a fake UA string for the HTTP servers that sniff it
user-agent = "Mozilla/5.0 Gecko"
Upload
curl -v -u admin:admin123 --upload-file pom.xml http://localhost:8081/repository/maven-releases/org/foo/1.0/foo-1.0.pom

HTTP POST files here

curl --proxy 127.0.0.1:4444 -F'file=@yourfile.png' http://0xff.i2p

Or with status bar

curl --proxy 127.0.0.1:4444 -T yourfile.png http://0xff.i2p | tee

Upload command output

command | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p

Upload command output with stderr

command 2>&1 | curl -T - --proxy 127.0.0.1:4444 http://0xff.i2p

Or you can shorten URLs

curl --proxy 127.0.0.1:4444 -F'shorten=http://example.com/some/long/url' http://0xff.i2p

wget

Autres

wget --no-cache --no-cookie
wget - preserve filename
wget https://getsession.org/linux
# Saving to: 'linux'
 
wget --content-disposition https://getsession.org/linux
# Saving to: 'session-desktop-linux-x86_64-1.8.6.AppImage'
 
wget -O plop https://getsession.org/linux
# Saving to: ‘plop'
Fichier config .wgetrc

~/.wgetrc

# https://www.gnu.org/software/wget/manual/html_node/Wgetrc-Commands.html
 
# Set the certificate authority bundle file to file. The same as ‘--ca-certificate=file’.
ca_certificate = file
 
# Set the directory used for certificate authorities. The same as ‘--ca-directory=directory’.
ca_directory = directory
 
 
header = Accept: */*
header = Accept-Language: en-US,en;q=0.8
header = Keep-Alive: 300
user_agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
 
# bind_address = 202.x.x.x
# referer = http://www.google.com
Autres

Fix curl client certificate error: curl: (58) unable to set private key file http://honglus.blogspot.fr/2012/03/fix-curl-client-certificate-error-curl.html

15 Practical Linux cURL Command Examples (cURL Download Examples) http://www.thegeekstuff.com/2012/04/curl-examples/

Download the webpage with wget. The wget options (-E, -k, etc.) are CASE SENSITIVE! The maximum depth to which the retrieval may descend is specified with the ‘-l’ option:

wget -E -k -p -nd -r -l 1 -np -P <local-folder-name> http://site-to-be-mirrored.org

wget : Ignore robots restrictions

wget -e robots=off --wait 1 http://your.site.here

Dossier répertoire directory

wget http://www.claudiokuenzler.com/nagios-plugins/check_equallogic.sh -P /usr/lib/nagios/plugins/ 

A partir d'un fichier d'URL

wget --no-proxy -i providers.txt -P /usr/share/terraform/providers/registry.terraform.io/hashicorp/vsphere
Notes exemple Dokuwiki

wget

wget --max-redirect=4 --output-document=siteexport.zip --post-data="id=dokuwiki&depth=0&depthType=0.0&do=siteexport&ens=dokuwiki&template=dokuwiki" https://acme.com/doku.php?id=doku.php --http-user=USER --http-passwd=PASSWD
wget -E -r http://wiki.foo.tld/doku.php?id=start -l 0 --header="X-DokuWiki-Do: export_xhtml"

curl

curl -L --max-redirs 46 -o siteexport.zip -d "id=dokuwiki&depth=0&depthType=1.0&do=siteexport&ens=dokuwiki&exportbody=1&renderer=&template=dokuwiki" https://acme.com/doku.php?id=doku.php --anyauth --user USER:PASSWD
Notes Curl certificat auto-signé

Pour ignoré le certificat

curl  -k https://www.acme.fr
wget --no-check-certificate https://www.acme.fr

Pour enregistrer le certificat et vérifier

openssl s_client -showcerts -connect www.acme.fr:443 -servername www.acme.fr </dev/null > cacert.pem
# ou
curl -k -w %{certs} https://www.acme.fr > cacert.pem

Tester

curl --cacert cacert.pem  https://www.acme.fr

ou avec wget

wget --ca-certificate=cert.pem https://www.acme.fr

Voir

Enlever la CA

rm /usr/local/share/ca-certificates/acme.fr.crt
update-ca-certificates --fresh

TODO : equivalement pour Redhat avec update-ca-trust

~/.curlrc

cacert=/home/jean/cert.pem

~/.wgetrc

# Set the certificate authority bundle file to file. The same as ‘--ca-certificate=file’.
ca_certificate = /home/jean/cert.pem
 
# Set the directory used for certificate authorities. The same as ‘--ca-directory=directory’.
#ca_directory = directory

Ou, à éviter mais possible .curlrc

insecure

https sous java Voir la paquet ca-certificates-java

openssl s_client -showcerts -connect 192.168.4.13:5000 </dev/null > cert.crt
 
# test
curl --show-error --verbose --cacert cert.crt https://172.18.51.220:5000
 
cp cert.crt /usr/local/share/ca-certificates/acme.fr.crt
update-ca-certificates
 
/var/lib/dpkg/info/ca-certificates-java.postinst configure
systemctl restart jenkins

Python

import requests
 
# No warn for bad https 'verify=False'
requests.packages.urllib3.disable_warnings()
 
# HTTP GET all users ids
r = requests.get('https://aap.admin.acme.local/api/v2/users/', auth=(aap_user, aap_pass), verify=False)

Exemple HTTPS certificat client

curl --verbose --show-error --tlsv1.2 --cert /etc/httpd/ssl/acme.fr.crt --key /etc/httpd/ssl/acme.fr.key https://acme.net/plop
wget --debug --verbose --no-check-certificate --secure-protocol=TLSv1_2 --certificate=/etc/httpd/ssl/acme.fr.crt --private-key=/etc/httpd/ssl/acme.fr.key https://acme.net/plop
(echo -ne "GET /plop HTTP/1.1\r\nHost: acme.net\r\n\r\n" ; cat ) | openssl s_client -connect acme.net:443 -servername acme.net -cert /etc/httpd/ssl/acme.fr.crt -key /etc/httpd/ssl/acme.fr.key
curl --cacert keys/ca.crt --key keys/client1.key --cert keys/client1.crt https://pkiweb.lan
wget --ca-certificate=keys/ca.crt --private-key=keys/client1.key --certificate=keys/client1.crt https://pkiweb.lan

Envoyer un fichier en ligne de commande (upload web)

Goploader

# Your file will be named myfile.txt
curl -F file=@myfile.txt https://up.depado.eu/
 
# Your file will be named myamazingfile!
curl -F name="myamazingfile!" -F file=@myfile.txt https://up.depado.eu/
 
# Reads data from stdin
cat myfile.txt | curl -F name="stdin" -F file=@_ https://up.depado.eu/

Sécurité

Pipe bash

https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/

curl -sSk http://pluver.xqi.cc/setup.bash
curl -sSk http://pluver.xqi.cc/setup.bash | bash 
2025/03/24 15:06

Note CSS

Les tableaux

<HTML> <style type=“text/css”> table tr:nth-child(odd) td {

      background-color: #E0E0F7;

}

tr td:first-child {

      text-align: right;

} </style> </HTML>

2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki