···1-From e7357c383188dd735592bd9f2202d2afcfffa39d Mon Sep 17 00:00:00 2001
2-From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= <muscaln@protonmail.com>
3-Date: Sun, 11 Sep 2022 17:08:33 +0300
4-Subject: [PATCH 3/3] Use out path as build id on darwin
5-6-7-diff --git a/builder/buildid.go b/builder/buildid.go
8-index e6527700..65cb08e8 100644
9---- a/builder/buildid.go
10-+++ b/builder/buildid.go
11-@@ -3,8 +3,6 @@ package builder
12- import (
13- "bytes"
14- "debug/elf"
15-- "debug/macho"
16-- "encoding/binary"
17- "fmt"
18- "io"
19- "os"
20-@@ -53,30 +51,9 @@ func ReadBuildID() ([]byte, error) {
21- return goID, nil
22- }
23- case "darwin":
24-- // Read the LC_UUID load command, which contains the equivalent of a
25-- // build ID.
26-- file, err := macho.NewFile(f)
27-- if err != nil {
28-- return nil, err
29-- }
30-- for _, load := range file.Loads {
31-- // Unfortunately, the debug/macho package doesn't support the
32-- // LC_UUID command directly. So we have to read it from
33-- // macho.LoadBytes.
34-- load, ok := load.(macho.LoadBytes)
35-- if !ok {
36-- continue
37-- }
38-- raw := load.Raw()
39-- command := binary.LittleEndian.Uint32(raw)
40-- if command != 0x1b {
41-- // Looking for the LC_UUID load command.
42-- // LC_UUID is defined here as 0x1b:
43-- // https://opensource.apple.com/source/xnu/xnu-4570.71.2/EXTERNAL_HEADERS/mach-o/loader.h.auto.html
44-- continue
45-- }
46-- return raw[4:], nil
47-- }
48-+ // On darwin, os.Executable() returns broken path in nix build environment
49-+ // So we are using $out path as build id since its also unique
50-+ return []byte("OUT_PATH"), nil
51- default:
52- // On other platforms (such as Windows) there isn't such a convenient
53- // build ID. Luckily, Go does have an equivalent of the build ID, which
54---
55-2.37.2
56-
···1+{ lib, stdenv, fetchFromGitHub, python3Packages }:
2+3+python3Packages.buildPythonApplication rec {
4+ pname = "decode-spam-headers";
5+ version = "2022-09-22-unreleased";
6+7+ src = fetchFromGitHub {
8+ owner = "mgeeky";
9+ repo = "decode-spam-headers";
10+ rev = "492b6e744475cd5d3dd68a8140bc3478244b7df1";
11+ sha256 = "sha256-gBDkvlZCndQjochn6TZtM/Lanza64LqMjNnLjn+pPR4=";
12+ };
13+14+ format = "other";
15+16+ outputs = [ "out" "doc" ];
17+18+ installPhase = ''
19+ install -D decode-spam-headers.py $out/bin/decode-spam-headers
20+21+ mkdir -p $doc/share/doc/${pname}
22+ mv \
23+ README.md \
24+ img/ \
25+ $doc/share/doc/${pname}
26+ '';
27+28+ propagatedBuildInputs = [
29+ python3Packages.python-dateutil
30+ python3Packages.tldextract
31+ python3Packages.packaging
32+ python3Packages.dnspython
33+ python3Packages.requests
34+ python3Packages.colorama
35+ ];
36+37+ meta = with lib; {
38+ homepage = "https://github.com/mgeeky/decode-spam-headers/";
39+ description = "A script that helps you understand why your E-Mail ended up in Spam";
40+ longDescription = ''
41+ Whether you are trying to understand why a specific e-mail ended up in
42+ SPAM/Junk for your daily Administrative duties or for your Red-Team
43+ Phishing simulation purposes, this script is there for you to help!
44+45+ This tool accepts on input an *.EML or *.txt file with all the SMTP
46+ headers. It will then extract a subset of interesting headers and using
47+ 105+ tests will attempt to decode them as much as possible.
48+49+ This script also extracts all IPv4 addresses and domain names and performs
50+ full DNS resolution of them.
51+52+ Resulting output will contain useful information on why this e-mail might
53+ have been blocked.
54+ '';
55+ license = licenses.mit;
56+ maintainers = with maintainers; [ ];
57+ };
58+}