From 6cdd924613d338bdc7c62fe883ac92cfa440e5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sun, 28 Jun 2020 11:23:02 +0200 Subject: [PATCH] Timely commit --- config/scripts/smtpdummy | 77 +++++++++++++++++++++++++++++++++++++ config/scripts/softwareList | 3 +- config/scripts/spongebob | 18 +++++++++ config/shell/trimmed.bash | 2 +- 4 files changed, 98 insertions(+), 2 deletions(-) create mode 100755 config/scripts/smtpdummy create mode 100755 config/scripts/spongebob diff --git a/config/scripts/smtpdummy b/config/scripts/smtpdummy new file mode 100755 index 0000000..b90a13f --- /dev/null +++ b/config/scripts/smtpdummy @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 + +import argparse +import datetime +import time +import email.utils +import subprocess +import pprint + + +def command(command: str) -> None: + cmd = command.encode() + b"\n" + subprocess.run(["xdotool", "type", "--file", "-"], input=cmd) + time.sleep(2) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Generate SMTP messages to send a mail" + ) + + now = datetime.datetime.now() + now_email = email.utils.formatdate(now.timestamp(), True) + + parser.add_argument("-s", "--sender", default="geoffrey@frogeye.fr") + parser.add_argument("-r", "--receiver", default="geoffrey@frogeye.fr") + parser.add_argument("-l", "--helo", default="frogeye.fr") + parser.add_argument( + "-o", "--subject", default=f"Test message {now.strftime('%H:%M:%S')}" + ) + parser.add_argument("-m", "--me", default="Geoffrey") + parser.add_argument("-d", "--debug", action="store_true") + + + args = parser.parse_args() + + if args.debug: + command = print + + text = f"""Date: {now_email} +From: {args.sender} +Subject: {args.subject} +To: {args.receiver} + +Hello there, + +This is a test message, generated from a template. +If you didn't expect to see this message, please contact {args.me}. + +Greetings, + +Input arguments: +{pprint.pformat(args, indent=4)} + +-- +{args.me} +.""" + + if not args.debug: + for i in range(5, 0, -1): + print(f"Typing mail in {i}…") + time.sleep(1) + + command(f"HELO {args.helo}") + command(f"MAIL FROM: <{args.sender}>") + command(f"RCPT TO: <{args.receiver}>") + command("DATA") + command(text) + command("QUIT") + + print("Done") + + # For reference: + # command("RSET") + # command("VRFY") + # command("NOOP") + # command("QUIT") diff --git a/config/scripts/softwareList b/config/scripts/softwareList index d318983..c5861f4 100755 --- a/config/scripts/softwareList +++ b/config/scripts/softwareList @@ -147,10 +147,11 @@ i p7zip # Unarchive 7z files if $INSTALL_PASSWORD then i pwgen # Password generator - i gopass || i pass # Password manager + i pass # Password manager if $INSTALL_GUI then i rofi-pass # Password selector + # i autopass.cr # Password selector fi fi diff --git a/config/scripts/spongebob b/config/scripts/spongebob new file mode 100755 index 0000000..e285222 --- /dev/null +++ b/config/scripts/spongebob @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import sys +import random + +# maj = True + +for line in sys.stdin: + new_line = "" + for c in line: + maj = random.random() > 0.5 + if maj: + nc = c.upper() + else: + nc = c.lower() + new_line += nc + # maj = not maj + print(new_line, end="") diff --git a/config/shell/trimmed.bash b/config/shell/trimmed.bash index 6353ec8..8a3ae7d 100644 --- a/config/shell/trimmed.bash +++ b/config/shell/trimmed.bash @@ -75,5 +75,5 @@ elif [[ $USER == 'geoffrey' ]]; then else col=33; fi -export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] " +export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "