HTML Scraping, Screen Scraping

Written by  on Oktober 31, 2019
#!/bin/bash

URL="https://example.com/bla.html"
FILE="/tmp/in"
OUT="/tmp/out"
TARGET="/path/to/file/output.html"
wget "$URL" -O $FILE

echo "<html><head></head><body>" > $OUT
echo "<h1>" >> $OUT
echo "$(tr -d '\n' <$FILE)"  | awk -F"h1" '{print $6 }' | cut -d'>' -f2 | cut -d '<' -f1 >> $OUT
echo "</h1>" >> $OUT
echo "$(tr -d '\n' <$FILE)"  | awk -F"table"  '{print "<table "$5"table>" }' >> $OUT
echo "</body></html>" >> $OUT
iconv -f utf-8 -t ascii//TRANSLIT  < $OUT  > $TARGET

OpenSSL und Custom Certificates

Written by  on Oktober 26, 2019
openssl version -a
...
OPENSSLDIR: "/usr/local/ssl"
...

Place cert.pem File here (Liste of custom certificates)
See also:
Stackoverflow
MadBoa
Der Ordner ./certs da drin funktioniert nicht – zumindest nicht bei mir

MariaDB Create Database

Written by  on Oktober 23, 2019

Eine Datenbank anlegen geht ganz einfach

MariaDB [(none)]> create database db1;
Query OK, 1 row affected (0.001 sec)

Außer es soll ein Bindestrich im Datenbanknamen vorkommen

MariaDB [(none)]> create database db-1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1

Vielleicht helfen Anführungszeichen

MariaDB [(none)]> create database "db-1";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"db-1"' at line 1

Oder einfache Hochkommata

MariaDB [(none)]> create database 'db-1';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''db-1' at line 1

Oder mit einem Schrägstrich quotieren

MariaDB [(none)]> create database 'db\-1';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''db\-'' at line 1

Oder so was

MariaDB [(none)]> create database ´db-1´;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1´' t line 1

Nein, es müssen Backticks sein

MariaDB [(none)]> create database `db-1`;
Query OK, 1 row affected (0.001 sec)

Ist doch logisch!?

Brother MFC-7360N und Windows 10

Written by  on Oktober 20, 2019

Der MFC-7360N von Brother wird von Windows 10 unterstützt. Tut aber nichts, wenn im Setup die Aufforderung kommt, den Drucker anzustecken. Er wird einfach nicht erkannt.
Treiber und Firmware für den Drucker findet man aktuell auf der Brother Website.
Der Treiber alleine tut nichts, weil nicht erkannt wird, wenn das Gerät angeschlossen wird.
Viele Leute hatten scheinbar das gleiche Problem seit Windows 10. Das wird etwa bei Microsoft Answers beschrieben. Noch mehr Microsoft Answers
Zum Prüfen der Firmware Version muss man * und # gleichzeitig drücken, das erste Zeichen am Display zeigt die Version. Mit Version G gehts nicht, mit Version J sollte es gehen. Der Patient zeigt Version C.
Firmware Update aus Windows 10 mit dem Tool geht nicht, weil das Device nicht erkannt wurde. Also ein Henne Ei Problem. Eine Windows 7 Installation muss her. Ein ISO Image zu organisieren ist kein Problem. In einer Virtual Box installieren auch nicht. Aber das USB Device durchreichen schon. Zur Auswahl werden nur bereits bekannte Devices angeboten. Die Filter helfen nicht wirklich, weil ich dazu eine Idee bräuchte, in welcher Form ich Ports, Hersteller, Seriennummern oder ähnliches eingeben kann.
Also muss echte Hardware her. Eine alte Festplatte statt der SSD für den Werkstatt Laptop liegt noch bereit. Aber eine Windows 7 DVD? Also eine Brennen. Aber niemand hat heute mehr optische Laufwerke.
USB DVD Brenner anschließen, Brennsoftware installieren, ISO auf einen Rohling brennen. Gut dass noch ein Rohling im Schrank liegt. Seltsam nur, dass das Verpackungsplastik schon in durch leichte Berührung zerbröselt.
DVD Fertig, Rohling gebrannt und verifiziert. System bootet. Alles ist gespannt, was ein Windows 7 so knapp vor Support Ende tun wird. Windows Updates laden? Auf Windows 10 Upgraden?
System ist fertig, die Geschichte mit dem Drucker schaut besser aus. Aber das Upgrade Utility muss ins Netz um auf neue Versionen überprüfen zu können. Windows 7 bringt keinen Netzwerktreiber mit. Treiber geladen, installiert, Upgrade Utility lädt neue Version.
Der Drucker zeigt jetzt Version L an und tut auch mit Windows 10.
Vor dem Setup muss noch die ursprüngliche Installation entfernt werden mit dem Brother MFC-7360N Uninstall Utility. Anschließend lässt sich der Drucker installieren.

Alternativ

Written by  on Oktober 18, 2019

Alternative Fakten
Alternativ Medizin
Alternativschulen
Seht ihr auch das Muster?

Task Scheduler Error 2147942667

Written by  on Oktober 17, 2019

Weißt darauf hin, dass etwas mit dem Pfad nicht stimmt.

MobaXterm und OpenSSL 1.1.1d

Written by  on Oktober 15, 2019

OpenSSL 1.1.1d bricht leider mit einem Fehler ab

gcc  -I. -Icrypto/include -Iinclude  -Wall -O3 -fomit-frame-pointer -DTERMIOS -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_  IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DRMD160_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_A  SM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR=""/usr/local/ssl"" -DENGINESDIR=""/usr/local/lib/engines-1.1"" -DNDEBUG  -MMD -MF crypto/dso/dso_dlfcn.d.tm  p -MT crypto/dso/dso_dlfcn.o -c -o crypto/dso/dso_dlfcn.o crypto/dso/dso_dlfcn.c
crypto/dso/dso_dlfcn.c: In function 'dlfcn_pathbyaddr':
crypto/dso/dso_dlfcn.c:409:5: error: unknown type name 'Dl_info'
     Dl_info dli;
     ^
crypto/dso/dso_dlfcn.c:422:5: warning: implicit declaration of function 'dladdr' [-Wimplicit-function-declaration]
     if (dladdr(addr, &dli)) {
     ^
crypto/dso/dso_dlfcn.c:423:30: error: request for member 'dli_fname' in something not a structure or union
         len = (int)strlen(dli.dli_fname);
                              ^
crypto/dso/dso_dlfcn.c:432:25: error: request for member 'dli_fname' in something not a structure or union
         memcpy(path, dli.dli_fname, len);
                         ^
Makefile:2735: recipe for target 'crypto/dso/dso_dlfcn.o' failed
make[1]: *** [crypto/dso/dso_dlfcn.o] Error 1
make[1]: Leaving directory '/drives/c/temp/openssl-1.1.1d'
Makefile:174: recipe for target 'all' failed
make: *** [all] Error 2

Ursache ist diese Änderung im Code
Wurde mit dieser Issue eingeführt
Build läuft wie gewohnt durch, wenn man die Datei crypto/dso/dso_dlfcn.c aus 1.1.1c verwendet.

Bugreport Unable to compile OpenSSL 1.1.1d on Cygwin

Registration Data Access Protocol (RDAP)

Written by  on Oktober 7, 2019

Die Details kann man in der c’t 2019, Heft 20 Artikel Neues Kataster für das Internet nachlesen.
Problem mit einem modernen System (Raspian Buster mit openssl 1.1.1c)

curl -L https://rdap.arin.net/bootstrap/ip/10.0.0.0/8  | jq 
...
curl: (35) error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small

Lösung, in der openssl.cnf

[system_default_sect]
#MinProtocol = TLSv1.2
MinProtocol = TLSv1.0

Beispiele
Abfrage IPv4

curl -sL http://rdap.arin.net/bootstrap/ip/10.0.0.0/8  | jq

Abfrage IPv6

curl -sL http://rdap.arin.net/bootstrap/ip/2a00:1450:400d:803::200e  | jq

Abfrage Domainname

curl -sL http://rdap.arin.net/bootstrap/domain/example.com  | jq 

Abfrage Autonomous System (AS)

curl -sL http://rdap.arin.net/bootstrap/autnum/1234

Excel Star

Written by  on Oktober 2, 2019

Im Excel nach einem Stern Zeichen * zu suchen funktioniert nicht so toll. Weil der Stern eine Sonderbedeutung hat.

Lösung: Suche nach ~*.example.com statt *.example.com.