-
Notifications
You must be signed in to change notification settings - Fork 55
/
data.py
275 lines (259 loc) · 5.99 KB
/
data.py
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!/usr/bin/env python3
import os
import random
import requests
import json
TEXT_GEN_API_VAR = 'DEEP_AI_KEY'
words = [
'The', 'he', 'at', 'but', 'there', 'of', 'was', 'be', 'not', 'use', 'and', 'for', 'this', 'what', 'an', 'a', 'on', 'have', 'all', 'each',
'to', 'are', 'from', 'were', 'which', 'in', 'as', 'or', 'we', 'she', 'is', 'with', 'ine', 'when', 'do', 'you', 'his', 'had', 'your',
'how', 'that', 'they', 'by', 'can', 'their', 'it', 'I', 'word', 'said', 'if'
]
with open(os.path.join(os.path.dirname(__file__), './data/cities.json')) as cities_file:
cities = json.load(cities_file)
gop_members = [
'Gary VanDeaver', 'Bryan Slaton', 'Cecil Bell Jr.', 'Keith Bell', 'Cole Hefner', 'Matt Schaefer', 'Jay Dean', 'Cody Harris',
'Chris Paddie', 'Travis Clardy', 'Kyle Kacal', 'Ben Leman', 'John N. Raney', 'Steve Toth', 'Will Metcalf', 'John Cyrier', 'Ernest Bailes',
'James White', 'Terry Wilson', 'Dade Phelan', 'Mayes Middleton', 'Greg Bonnen', 'Cody Vasut', 'Brooks Landgraf', 'Tom Craddick',
'Dustin Burrows', 'John Frullo', 'Phil Stephenson', 'John T. Smithee', 'Four Price', 'Ken King', 'Candy Noble', 'Stephanie Klick',
'Jeff Cason', 'Matt Krause', 'Tony Tinderholt', 'David Cook', 'Craig Goldman', 'Giovanni Capriglione', 'Charlie Geren', 'Sam Harless',
'Dan Huberty', 'Briscoe Cain', 'Dennis Paul', 'Tom Oliverson', 'Mike Schofield'
]
firstNames = ['Hannah', 'Olivia', 'Marcia', 'Sarah', 'Tara', 'Brooke', 'Wanda', 'Andrea', 'Julie']
maleFirstNames = [
'Michael',
'Christopher',
'Matthew',
'Joshua',
'Jacob',
'Nicholas',
'Andrew',
'Daniel',
'Tyler',
'Joseph',
'Brandon',
'David',
'James',
'Ryan',
'John',
'Zachary',
'Justin',
'William',
'Anthony',
'Robert',
'Patrick',
]
lastNames = [
'Morgan', 'Walker', 'Lewis', 'Butler', 'Jones', 'Barnes', 'Martin', 'Wright', 'Foster', 'Smith', 'Johnson', 'Williams', 'Brown', 'Miller',
'Davis', 'Garcia', 'Rodriguez', 'Wilson', 'Martinez', 'Anderson', 'Taylor', 'Thomas', 'Hernandez', 'Jackson', 'Thompson', 'White'
]
# Seeds for text body generation
gpt2_prompts = [
'My neighbor got an illegal abortion.', 'I suspect my father has violated the abortion ban.',
random.choice(firstNames) + ' ' + random.choice(lastNames) + ' is helping people get abortions.',
random.choice(gop_members) + ' has been sneaking around the abortion clinic in ' + random.choice(list(cities)) + '.'
]
info_location = [
'A friend saw them', 'I work at the clinic', 'I know his secretary', 'He told me at the club', 'The police report', 'His wife told me',
'From a coworker', 'From a neighbor', 'From a family member.', 'Heard from a friend', 'a relative told me', 'a private source',
'A confession at church', 'I know their cousin', 'a taxi driver', 'From a cashier', 'Got a confidential tip', 'From a fellow parent',
'a concerned citizen', 'From a relative.', 'A PP volunteer', 'A charity worker', 'A social worker', 'From my friend who knows cops',
'from a lawyer', 'From a government employee'
]
zip_codes = [
75001,
75006,
75011,
75014,
75015,
75016,
75017,
75019,
75030,
75038,
75039,
75040,
75041,
75042,
75043,
75044,
75045,
75046,
75047,
75048,
75048,
75049,
75050,
75051,
75052,
75053,
75054,
75060,
75061,
75062,
75063,
75080,
75081,
75082,
75083,
75085,
75088,
75089,
75104,
75106,
75115,
75116,
75123,
75134,
75137,
75138,
75141,
75146,
75149,
75150,
75159,
75159,
75172,
75180,
75180,
75181,
75182,
75182,
75185,
75187,
75201,
75202,
75203,
75204,
75205,
75206,
75207,
75208,
75209,
75210,
75211,
75212,
75214,
75215,
75216,
75217,
75218,
75219,
75220,
75221,
75222,
75223,
75224,
75225,
75226,
75227,
75228,
75229,
75230,
75231,
75232,
75233,
75234,
75234,
75235,
75236,
75237,
75238,
75239,
75240,
75241,
75242,
75243,
75244,
75244,
75245,
75246,
75247,
75248,
75249,
75250,
75251,
75253,
75254,
75258,
75260,
75261,
75262,
75263,
75264,
75265,
75266,
75267,
75270,
75295,
75313,
75315,
75336,
75339,
75342,
75354,
75355,
75356,
75357,
75359,
75360,
75367,
75370,
75371,
75372,
75374,
75376,
75378,
75379,
75380,
75381,
75382,
75398,
]
# TX IPs gathered from here: https://www.xmyip.com/ip-addresses/united--states/texas
ips = [
"15.180.224.", # San Antonio
"15.155.5.", # San Antonio
"15.153.133.", # San Antonio
"12.56.225.", # Dallas
"67.10.46." # Edinburg
]
# random element from each list
def anonymous_form():
while True:
city, county = random.choice(list(cities.items()))
form_data = {
'textarea-1': get_tip_body(),
'text-1': random.choice(info_location),
'text-6': 'Dr. ' + random.choice(maleFirstNames) + ' ' + random.choice(lastNames),
'text-2': city,
'text-3': 'Texas',
'text-4': str(random.randint(75001, 79942)),
'text-5': county,
'hidden-1': random.choice(ips) + str(random.randint(0, 255)),
'checkbox-1[]': 'yes' if random.choice([True, False]) else 'no',
}
yield form_data
def sign_up_page():
raise NotImplementedError()
def get_tip_body():
# If we have an API key for GPT2, use it
if TEXT_GEN_API_VAR in os.environ:
prompt = random.choice(gpt2_prompts)
r = requests.post(
"https://api.deepai.org/api/text-generator", data={
'text': prompt,
}, headers={'api-key': os.environ[TEXT_GEN_API_VAR]}
)
rv = str(r.json()['output'].encode('utf-8'))
# cut out the prompt, which comes from a limited set and can be filtered on
rv = rv.replace(prompt, '').lstrip()
# take string up through last complete sentence since we occasionally get trailing words
if '.' in rv:
rv = rv[0:rv.rindex('.')] + '.'
return rv
else:
# standard tip body generation
return random.choice(gop_members) + ' took their mistress ' + random.choice(firstNames) + ' ' + random.choice(
lastNames
) + ' to get an abortion after their affair.'