From 3801b728db874349e88bcb249e09131e141f8806 Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Sun, 6 Apr 2025 11:04:40 +0100 Subject: [PATCH] Add partially working tools to public git repo --- dns.he.net_dump_zone | 32 ++++++++++++++++++++++++++++++++ dns.he.net_login | 24 ++++++++++++++++++++++++ run | 14 ++++++++++++++ 3 files changed, 70 insertions(+) create mode 100755 dns.he.net_dump_zone create mode 100755 dns.he.net_login create mode 100755 run diff --git a/dns.he.net_dump_zone b/dns.he.net_dump_zone new file mode 100755 index 0000000..ad99cba --- /dev/null +++ b/dns.he.net_dump_zone @@ -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 diff --git a/dns.he.net_login b/dns.he.net_login new file mode 100755 index 0000000..6882e0b --- /dev/null +++ b/dns.he.net_login @@ -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" diff --git a/run b/run new file mode 100755 index 0000000..6306eeb --- /dev/null +++ b/run @@ -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