Gnus development mailing list
 help / color / mirror / Atom feed
From: Bob Newell <bobnewell@bobnewell.net>
To: ding@gnus.org
Subject: Re: [PATCH] Message-ID hostname should be simple.
Date: Mon, 17 Apr 2023 07:03:40 -1000	[thread overview]
Message-ID: <87leiqzbir.ufme@nqtr.jlhfbfaug.info> (raw)
In-Reply-To: <20230417113928.1893-1-soyeomul@doraji.xyz> (Byung-Hee HWANG's message of "Mon, 17 Apr 2023 20:39:30 +0900")

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]


This is not 100% related, but I like to play around the with
the Message-ID, specifically I randomize the domain and then
the user agent.  Sometimes I don't want to reveal my "home"
domain.

This works with many email providers, but there are some
forwarding or bulk services that rewrite the Message ID.
Naughty of them.

My code is below.  Please realize I'm not exactly the No. 1
elisp coder --- but it does work in my environment.

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB


[-- Attachment #2: munger.el --]
[-- Type: text/plain, Size: 1647 bytes --]

;;; Fully anonymize/randomize FQDN.

(defun munge-message-id (orig-fun &rest args)
  "Make a random FQDN and User Agent"
  (let* ((nice-id (apply orig-fun args))
         (nice-split (split-string nice-id "@"))
	 (alpha "abcdefghijklmnopqrstuvwxyz")
	 (domain '("com" "org" "net" "info" "us"))
	 (part1 "")
	 (part2 "")
	 (part3 "")
	 (part4 "")
	 num0 num1 num2 num3)
;;; Temporary.  Not in right place at all.
    (munge-user-agent)
;;; FQDN.
    ;;; Front half.
    (setq num0 (+ 4 (random 6)))
    (while (> num0 0)
      (setq num1 (random 25))
      (setq part1 (concat part1 (substring alpha num1 (+ 1 num1))))
      (setq num0 (- num0 1))
      )
    ;;; Back half.
    (setq num0 (+ 4 (random 6)))
    (while (> num0 0)
      (setq num2 (random 25))
      (setq part2 (concat part2 (substring alpha num2 (+ 1 num2))))
      (setq num0 (- num0 1))
      )
    ;;; Sub for 'fsf'.
    (setq num0 (+ 4 (random 6)))
    (while (> num0 0)
      (setq num3 (random 25))
      (setq part3 (concat part3 (substring alpha num3 (+ 1 num3))))
      (setq num0 (- num0 1))
      )
    ;;; TLD.
    (setq part4 (nth (random 4) domain))
;;; Build the message-id.
    (concat (replace-regexp-in-string "fsf" part3 (nth 0 nice-split)) "@" part1 "." part2 "." part4 ">")
    )
  )
(advice-add 'message-make-message-id :around #'munge-message-id)

;;; Semi-randomize User-Agent.

(defun munge-user-agent ()
 "Change user-agent to semi-random string"
 (let* ( (agents '("Mozilla" "Chrome" "Safari" "Brave" "Vivaldi"))
	 (versions '("5.0" "5.5" "6.0" "6.5" "4.5"))) 
    (setq gnus-user-agent (concat (nth (random 4) agents) "/" (nth (random 4) versions)))))

  reply	other threads:[~2023-04-17 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 11:39 Byung-Hee HWANG
2023-04-17 17:03 ` Bob Newell [this message]
2023-04-18 11:28   ` Byung-Hee HWANG
2023-05-06  6:57 ` Byung-Hee HWANG
2023-05-06  7:11   ` Emanuel Berg
2023-05-06 10:25     ` Byung-Hee HWANG (黃炳熙)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87leiqzbir.ufme@nqtr.jlhfbfaug.info \
    --to=bobnewell@bobnewell.net \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).