Add partially working tools to public git repo

This commit is contained in:
Andriy Utkin 2025-04-06 11:04:40 +01:00
commit 3801b728db
3 changed files with 70 additions and 0 deletions

32
dns.he.net_dump_zone Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
declare -A ZONES
ZONES=(
['autkin.net']=1110808
['x.autkin.net']=1054887
['decent.im']=984397
)
#COOKIE=$1
COOKIE_JAR=$1
ZONE_NAME=$2
ZONE_ID=${ZONES[$ZONE_NAME]}
# --cookie "$COOKIE" \
# -H 'Pragma: no-cache' \
# -H 'Cache-Control: no-cache' \
curl \
-v \
--fail \
--trace zone.trace \
"https://dns.he.net/?hosted_dns_zoneid=$ZONE_ID&menu=edit_zone&hosted_dns_editzone" \
--cookie-jar "$COOKIE_JAR" \
\
| tee ./this.zone.html \
| htmlq --text '#raw_zone > div:nth-child(1) > pre:nth-child(3)' > ./this.zone
[[ -s ./this.zone ]]
cat ./this.zone

24
dns.he.net_login Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail
set -x
#COOKIE_JAR=$(mktemp)
COOKIE_JAR=./cookie_jar.txt
curl --fail 'https://dns.he.net/' --cookie-jar "$COOKIE_JAR" --output /dev/null
#COOKIE=$(tail -n1 "$COOKIE_JAR" | awk '{ print $6 "=" $7 }')
curl -v --trace-ascii login.trace --fail 'https://dns.he.net/' --cookie-jar "$COOKIE_JAR" --output logged_in.html \
-H 'Host: dns.he.net' \
-H 'Origin: dns.he.net' \
-H 'Referer: dns.he.net' \
--data-urlencode "email=$(pass he.net/username)" \
--data-urlencode "pass=$(pass he.net/password)" \
--data-urlencode "submit=Login!" \
;
if grep -q Incorrect logged_in.html; then
exit 1
fi
echo "$COOKIE_JAR"

14
run Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
set -x
COOKIE_JAR=$(./dns.he.net_login)
[[ -f "$COOKIE_JAR" ]]
for x in autkin.net x.autkin.net decent.im; do
./dns.he.net_dump_zone "$COOKIE_JAR" $x > $x.zone
done
git add ./*.zone
git commit --allow-empty -m 'Saved fresh dump'
git push