Repository navigation
Expand file tree
/
Copy pathmain.go
More file actions
119 lines (103 loc) · 3.5 KB
/
Copy pathmain.go
File metadata and controls
119 lines (103 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package main
// Lineup counts how many people could have written what an account has
// said about itself.
//
// Nobody gives themselves away in one post. They give away a city in one,
// an age in another, a job and a daughter's birthday in a third, and each
// of those is harmless on its own and a filter when somebody puts them
// together. Putting them together used to take a person an afternoon. In
// February 2026 a published attack did it with a language model for a few
// dollars an account, against pseudonymous accounts in the open.
//
// This does the same arithmetic for the person who owns the account,
// before anybody else does: it reads what an account has said, applies
// each fact to the real population it describes, and says how many people
// are left standing in the lineup. It only reads. Nothing is written,
// nothing is sent anywhere, and there is no model in it.
import (
"flag"
"fmt"
"io"
"os"
"time"
)
var version = "unreleased"
const (
exitCrowd = 0
exitShort = 1 // the lineup is a list somebody could go through by hand
exitBroken = 2
exitUnsure = 3 // nothing was read, which is not the same as nothing said
)
func main() {
reveal := flag.Bool("reveal", false, "print the places, jobs and words instead of masking them")
draft := flag.String("draft", "", "a file with something not posted yet, or - for standard input")
showVersion := flag.Bool("version", false, "print the version and exit")
flag.Usage = usage
flag.Parse()
if *showVersion {
fmt.Println("Lineup " + version)
return
}
if flag.NArg() == 0 {
usage()
os.Exit(exitBroken)
}
in := readInputs(flag.Args())
a := readAccount(in, time.Now().UTC())
l := count(a)
report := writeUp(in, a, l, *reveal)
final := l
if *draft != "" {
text, err := readDraft(*draft)
if err != nil {
fmt.Fprintf(os.Stderr, "lineup: %v\n", err)
os.Exit(exitBroken)
}
final = draftFinding(report, a, l, text, *reveal)
}
report.render(os.Stdout)
switch {
case len(a.Posts) == 0 && *draft == "":
os.Exit(exitUnsure)
case counted(final) > 0 && final.People < shortList:
os.Exit(exitShort)
}
os.Exit(exitCrowd)
}
func counted(l *Lineup) int {
n := 0
for _, s := range l.Steps {
if !s.base {
n++
}
}
return n
}
func readDraft(where string) (string, error) {
if where == "-" {
body, err := io.ReadAll(os.Stdin)
return string(body), err
}
body, err := os.ReadFile(where)
return string(body), err
}
func usage() {
fmt.Fprintln(os.Stderr, `Lineup - how many people you could still be
lineup reddit-export.zip everything one account has said
lineup twitter-archive.zip
lineup mastodon-export.zip
lineup hn.json Hacker News comments, saved from its API
lineup posts/ a folder of text, one post per file
lineup reddit.zip hn.json two accounts, as if somebody linked them
lineup --draft reply.txt export.zip what posting this would cost
lineup --reveal ... print places, jobs and quotes
lineup --version
It reads what the account says about itself, in English and Spanish:
where it lives, how old it is, what it does, its family, its health. Each
fact is applied to the real population it describes, from the UN, the
census and the BLS, and the answer is how many people still fit all of it.
The report masks what it found unless you pass --reveal, so it can be
pasted somewhere without carrying the facts it is warning you about.
It only reads. Nothing is written, nothing is sent anywhere, and there is
no model in it.`)
}