Compare commits

..

No commits in common. "dc63263d85a04caf4f4b9e405af15418462cf72e" and "eba894d9f48be97e2b0665c28b2fd3b9d22210c3" have entirely different histories.

2 changed files with 6 additions and 35 deletions

View file

@ -1,29 +0,0 @@
#!/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,6 +9,7 @@ import io
import pprint import pprint
import subprocess import subprocess
import sys import sys
import uuid
if __name__ == "__main__": if __name__ == "__main__":
@ -33,7 +34,6 @@ if __name__ == "__main__":
) )
parser.add_argument("-l", "--helo", env_var="HELO") parser.add_argument("-l", "--helo", env_var="HELO")
parser.add_argument("-L", "--helo-verb", env_var="HELO_VERB", default="EHLO")
parser.add_argument( parser.add_argument(
"-s", "--sender", env_var="SENDER", default="geoffrey@frogeye.fr" "-s", "--sender", env_var="SENDER", default="geoffrey@frogeye.fr"
) )
@ -79,11 +79,11 @@ if __name__ == "__main__":
if args.to is None: if args.to is None:
args.to = args.receiver[0] args.to = args.receiver[0]
if args.reply_to is None: if args.reply_to is None:
args.reply_to = getattr(args, 'from') args.reply_to = args.to
if args.password: if args.password:
password = args.password password = args.password
args.password = "********" args.password = "********"
mid = email.utils.make_msgid(domain=args.helo) mid = f"{uuid.uuid1()}@{args.helo}"
# Transmission content # Transmission content
@ -190,7 +190,7 @@ Input arguments:
if args.security != "starttls": if args.security != "starttls":
recv() recv()
send(f"{args.helo_verb} {args.helo}") send(f"EHLO {args.helo}")
if args.user: if args.user:
encoded = base64.b64encode( encoded = base64.b64encode(
args.user.encode() args.user.encode()
@ -200,9 +200,9 @@ Input arguments:
+ password.encode() + password.encode()
).decode() ).decode()
send(f"AUTH PLAIN {encoded}") send(f"AUTH PLAIN {encoded}")
send(f"MAIL FROM:<{args.sender}>" + (" SMTPUTF8" if args.smtputf8 else "")) send(f"MAIL FROM: <{args.sender}>" + (" SMTPUTF8" if args.smtputf8 else ""))
for receiver in args.receiver: for receiver in args.receiver:
send(f"RCPT TO:<{receiver}>") send(f"RCPT TO: <{receiver}>")
if not args.callout: if not args.callout:
send("DATA") send("DATA")
send(text) send(text)