Compare commits

..

2 commits

Author SHA1 Message Date
Geoffrey Frogeye dc63263d85
Add locate IP script 2023-07-23 13:28:39 +02:00
Geoffrey Frogeye 6a2afb3280
Various smtpdummy fixes 2023-07-23 13:23:28 +02:00
2 changed files with 35 additions and 6 deletions

29
config/scripts/lip Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env sh
set -euo pipefail
url="https://ip.frogeye.fr/json"
cachedir="$HOME/.cache/lip"
ip="${1:-}"
if [ $# -gt 0 ]
then
shift
jq_sel="$@"
else
jq_sel="del(.user_agent)"
fi
if [ -n "$ip" ]
then
cachefile="$cachedir/$ip"
if ! find "$cachefile" -mtime -7 &> /dev/null
then
mkdir -p "$cachedir"
curl --silent "$url/?ip=$ip" > "$cachefile"
fi
cat "$cachefile" | jq $jq_sel
else
curl --silent "$url" | jq $jq_sel
fi

View file

@ -9,7 +9,6 @@ import io
import pprint
import subprocess
import sys
import uuid
if __name__ == "__main__":
@ -34,6 +33,7 @@ if __name__ == "__main__":
)
parser.add_argument("-l", "--helo", env_var="HELO")
parser.add_argument("-L", "--helo-verb", env_var="HELO_VERB", default="EHLO")
parser.add_argument(
"-s", "--sender", env_var="SENDER", default="geoffrey@frogeye.fr"
)
@ -79,11 +79,11 @@ if __name__ == "__main__":
if args.to is None:
args.to = args.receiver[0]
if args.reply_to is None:
args.reply_to = args.to
args.reply_to = getattr(args, 'from')
if args.password:
password = args.password
args.password = "********"
mid = f"{uuid.uuid1()}@{args.helo}"
mid = email.utils.make_msgid(domain=args.helo)
# Transmission content
@ -190,7 +190,7 @@ Input arguments:
if args.security != "starttls":
recv()
send(f"EHLO {args.helo}")
send(f"{args.helo_verb} {args.helo}")
if args.user:
encoded = base64.b64encode(
args.user.encode()