Skip to content

Instantly share code, notes, and snippets.

@DonnchaC
Last active October 21, 2016 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DonnchaC/17d4b23a164c3214f652bcdf62972baf to your computer and use it in GitHub Desktop.
Save DonnchaC/17d4b23a164c3214f652bcdf62972baf to your computer and use it in GitHub Desktop.
Another script for stripping unsigned content from an email - https://gist.github.com/DonnchaC/070b82ab465ae0b9babc0004b05694c2
# sudo apt-get install libmail-dkim-perl
# perl validate-dkim.pl < 5205
signature identity: @hillaryclinton.com
verify result: pass
pass
Delivered-To: john.podesta@gmail.com
Received: by 10.25.88.78 with SMTP id m75csp1706493lfb;
Sat, 12 Mar 2016 13:41:52 -0800 (PST)
X-Received: by 10.194.62.102 with SMTP id x6mr16783752wjr.18.1457818911993;
Sat, 12 Mar 2016 13:41:51 -0800 (PST)
Return-Path: <jpalmieri@hillaryclinton.com>
Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com. [2a00:1450:400c:c09::234])
by mx.google.com with ESMTPS id d9si12786067wjr.170.2016.03.12.13.41.51
for <john.podesta@gmail.com>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sat, 12 Mar 2016 13:41:51 -0800 (PST)
Received-SPF: pass (google.com: domain of jpalmieri@hillaryclinton.com designates 2a00:1450:400c:c09::234 as permitted sender) client-ip=2a00:1450:400c:c09::234;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of jpalmieri@hillaryclinton.com designates 2a00:1450:400c:c09::234 as permitted sender) smtp.mailfrom=jpalmieri@hillaryclinton.com;
dkim=pass header.i=@hillaryclinton.com;
dmarc=pass (p=QUARANTINE dis=NONE) header.from=hillaryclinton.com
Received: by mail-wm0-x234.google.com with SMTP id p65so31171494wmp.1
for <john.podesta@gmail.com>; Sat, 12 Mar 2016 13:41:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=hillaryclinton.com; s=google;
h=from:mime-version:references:in-reply-to:date:message-id:subject:to
:cc;
bh=EHIyNFKU1g6KhzxpAJQtxaW82g5+cTT3qlzIbUpGoRY=;
b=JgW85tkuhlDcythkyCrUMjPIAjHbUVPtgyqu+KpUR/kqQjE8+W23zacIh0DtVTqUGD
mzaviTrNmI8Ds2aUlzEFjxhJHtgKT4zbRiqDZS7fgba8ifMKCyDgApGNfenmQz+81+hN
2OHb/pLmmop+lIeM8ELXHhhr0m/Sd4c/3BOy8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:from:mime-version:references:in-reply-to:date
:message-id:subject:to:cc;
bh=EHIyNFKU1g6KhzxpAJQtxaW82g5+cTT3qlzIbUpGoRY=;
b=dEYKdN2vH085sl/02zUgJ1Lr66LV8lRV9Lrqx9SIpfiF1bOLLbIr1Au6AAY5vwg1vS
klK/TvacKT0j8aYADGNWP6BtG5XZ+IME6ydojlufQ3jqksqLkycSJ2ahYhxw4LmCii8n
kja2EKzRFcKGPnfhYnfwBCmIk/D5FWN6+yvpAYSmmZlxsR4b7mTJ8r/NmB7dKRIHeq8b
Ersjyl8edCTfC6nGbUrEEV7C6uQE3N16B5m2XPnRATWSuWj/Nz7ZsM/9snj+rlTjJx5e
wI5Epet9ADtlAWqJw/L/5HCNaAFqyR3QK1/AFjsTk+Q2METC3+0Eo+yMaArw2viFZLu4
hvoQ==
X-Gm-Message-State: AD7BkJIVsTnWS4h6zaELaAic4KGo4suqpsDZaIL5hf/NhK7PXlprE+3n4QLcriYzdyqwnIkdCe6qIljT5AHRT7j6
X-Received: by 10.194.118.106 with SMTP id kl10mr18795665wjb.154.1457818911700;
Sat, 12 Mar 2016 13:41:51 -0800 (PST)
From: Jennifer Palmieri <jpalmieri@hillaryclinton.com>
Mime-Version: 1.0 (1.0)
References: <3DA1A3A8-F225-43B5-8224-EFCC8D524797@brazileassociates.com>
In-Reply-To: <3DA1A3A8-F225-43B5-8224-EFCC8D524797@brazileassociates.com>
Date: Sat, 12 Mar 2016 16:41:51 -0500
Message-ID: <8469808270885997286@unknownmsgid>
Subject: Re: From time to time I get the questions in advance
To: Donna Brazile <donna@brazileassociates.com>,
Betsaida Alcantara <balcantara@hillaryclinton.com>
CC: "john.podesta@gmail.com" <john.podesta@gmail.com>,
Minyon Moore <Minyon.Moore@deweysquare.com>
Content-Type: multipart/alternative; boundary=001a1130c848611a81052de0ea66
--001a1130c848611a81052de0ea66
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi. Yes, it is one she gets asked about. Not everyone likes her answer
but can share it.
Betsaida - can you send her answer on death penalty?
Sent from my iPhone
On Mar 12, 2016, at 4:39 PM, Donna Brazile <donna@brazileassociates.com>
wrote:
Here's one that worries me about HRC.
DEATH PENALTY
19 states and the District of Columbia have banned the death penalty. 31
states, including Ohio, still have the death penalty. According to the
National Coalition to Abolish the Death Penalty, since 1973, 156 people
have been on death row and later set free. Since 1976, 1,414 people have
been executed in the U.S. That=E2=80=99s 11% of Americans who were sentence=
d to
die, but later exonerated and freed. Should Ohio and the 30 other states
join the current list and abolish the death penalty?
Sent from Donna's I Pad. Follow me on twitter @donnabrazile
--001a1130c848611a81052de0ea66
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div>Hi.=C2=A0 Yes, it is one she gets =
asked about.=C2=A0 Not everyone likes her answer but can share it.</div><di=
v id=3D"AppleMailSignature"><br></div><div id=3D"AppleMailSignature">Betsai=
da - can you send her answer on death penalty?=C2=A0<br><br>Sent from my iP=
hone</div><div><br>On Mar 12, 2016, at 4:39 PM, Donna Brazile &lt;<a href=
=3D"mailto:donna@brazileassociates.com">donna@brazileassociates.com</a>&gt;=
wrote:<br><br></div><blockquote type=3D"cite"><div>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
<div>Here&#39;s one that worries me about HRC.</div>
<div id=3D"AppleMailSignature"><br>
</div>
<div id=3D"AppleMailSignature">
<p class=3D"MsoNormal"><span style=3D"background-color:rgba(255,255,255,0)"=
>DEATH PENALTY</span></p>
<p class=3D"MsoNormal"><span style=3D"background-color:rgba(255,255,255,0)"=
>=C2=A0</span></p>
<p class=3D"MsoNormal"><span style=3D"background-color:rgba(255,255,255,0)"=
>19 states and the District of Columbia have banned the death penalty. 31 s=
tates, including Ohio, still have the death penalty. According to the Natio=
nal Coalition to Abolish the Death
Penalty, since 1973, 156 people have been on death row and later set free.=
Since 1976, 1,414 people have been executed in the U.S. That=E2=80=99s 11%=
of Americans who were sentenced to die, but later exonerated and freed. Sh=
ould Ohio and the 30 other states join the
current list and abolish the death penalty?</span></p>
<br>
Sent from Donna&#39;s I Pad. Follow me on twitter @donnabrazile
<div><br>
</div>
</div>
</div></blockquote></body></html>
--001a1130c848611a81052de0ea66--
#!/usr/bin/perl
# use strict; use warnings;
use Mail::DKIM::Verifier;
my $dkim = Mail::DKIM::Verifier->new;
while ( <STDIN> ) {
chomp;
s/\015$//;
$dkim->PRINT( "$_\015\012" );
}
$dkim->CLOSE;
foreach my $signature ($dkim->signatures)
{
print "signature identity: " . $signature->identity . "\n";
print "verify result: " . $signature->result_detail . "\n";
# if ($signature->result_detail != "pass") {
# die "invalid"
# }
}
my $result = $dkim->result;
print "$result\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment