···11-From e7357c383188dd735592bd9f2202d2afcfffa39d Mon Sep 17 00:00:00 2001
22-From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= <muscaln@protonmail.com>
33-Date: Sun, 11 Sep 2022 17:08:33 +0300
44-Subject: [PATCH 3/3] Use out path as build id on darwin
55-66-77-diff --git a/builder/buildid.go b/builder/buildid.go
88-index e6527700..65cb08e8 100644
99---- a/builder/buildid.go
1010-+++ b/builder/buildid.go
1111-@@ -3,8 +3,6 @@ package builder
1212- import (
1313- "bytes"
1414- "debug/elf"
1515-- "debug/macho"
1616-- "encoding/binary"
1717- "fmt"
1818- "io"
1919- "os"
2020-@@ -53,30 +51,9 @@ func ReadBuildID() ([]byte, error) {
2121- return goID, nil
2222- }
2323- case "darwin":
2424-- // Read the LC_UUID load command, which contains the equivalent of a
2525-- // build ID.
2626-- file, err := macho.NewFile(f)
2727-- if err != nil {
2828-- return nil, err
2929-- }
3030-- for _, load := range file.Loads {
3131-- // Unfortunately, the debug/macho package doesn't support the
3232-- // LC_UUID command directly. So we have to read it from
3333-- // macho.LoadBytes.
3434-- load, ok := load.(macho.LoadBytes)
3535-- if !ok {
3636-- continue
3737-- }
3838-- raw := load.Raw()
3939-- command := binary.LittleEndian.Uint32(raw)
4040-- if command != 0x1b {
4141-- // Looking for the LC_UUID load command.
4242-- // LC_UUID is defined here as 0x1b:
4343-- // https://opensource.apple.com/source/xnu/xnu-4570.71.2/EXTERNAL_HEADERS/mach-o/loader.h.auto.html
4444-- continue
4545-- }
4646-- return raw[4:], nil
4747-- }
4848-+ // On darwin, os.Executable() returns broken path in nix build environment
4949-+ // So we are using $out path as build id since its also unique
5050-+ return []byte("OUT_PATH"), nil
5151- default:
5252- // On other platforms (such as Windows) there isn't such a convenient
5353- // build ID. Luckily, Go does have an equivalent of the build ID, which
5454---
5555-2.37.2
5656-
···11+{ lib, stdenv, fetchFromGitHub, python3Packages }:
22+33+python3Packages.buildPythonApplication rec {
44+ pname = "decode-spam-headers";
55+ version = "2022-09-22-unreleased";
66+77+ src = fetchFromGitHub {
88+ owner = "mgeeky";
99+ repo = "decode-spam-headers";
1010+ rev = "492b6e744475cd5d3dd68a8140bc3478244b7df1";
1111+ sha256 = "sha256-gBDkvlZCndQjochn6TZtM/Lanza64LqMjNnLjn+pPR4=";
1212+ };
1313+1414+ format = "other";
1515+1616+ outputs = [ "out" "doc" ];
1717+1818+ installPhase = ''
1919+ install -D decode-spam-headers.py $out/bin/decode-spam-headers
2020+2121+ mkdir -p $doc/share/doc/${pname}
2222+ mv \
2323+ README.md \
2424+ img/ \
2525+ $doc/share/doc/${pname}
2626+ '';
2727+2828+ propagatedBuildInputs = [
2929+ python3Packages.python-dateutil
3030+ python3Packages.tldextract
3131+ python3Packages.packaging
3232+ python3Packages.dnspython
3333+ python3Packages.requests
3434+ python3Packages.colorama
3535+ ];
3636+3737+ meta = with lib; {
3838+ homepage = "https://github.com/mgeeky/decode-spam-headers/";
3939+ description = "A script that helps you understand why your E-Mail ended up in Spam";
4040+ longDescription = ''
4141+ Whether you are trying to understand why a specific e-mail ended up in
4242+ SPAM/Junk for your daily Administrative duties or for your Red-Team
4343+ Phishing simulation purposes, this script is there for you to help!
4444+4545+ This tool accepts on input an *.EML or *.txt file with all the SMTP
4646+ headers. It will then extract a subset of interesting headers and using
4747+ 105+ tests will attempt to decode them as much as possible.
4848+4949+ This script also extracts all IPv4 addresses and domain names and performs
5050+ full DNS resolution of them.
5151+5252+ Resulting output will contain useful information on why this e-mail might
5353+ have been blocked.
5454+ '';
5555+ license = licenses.mit;
5656+ maintainers = with maintainers; [ ];
5757+ };
5858+}