new-site/scripts/tests/block_bounced.py
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

291 lines
7.4 KiB
Python

"""Block bounced email addresses in Listmonk via curl."""
import json
import subprocess
import sys
LISTMONK = "http://localhost:9100"
API_USER = "api"
API_PASS = "6X1rKPea61N4rZ1S65Hx5zvqzbCj30F6nvEe9oVGH_Y"
BOUNCED = [e.strip() for e in """aakhmettayev@online.kz
abidemi.emmanuel@gloworld.com
abuse@endstream.com
abuse@mstel.co.uk
abuse@trinicom.com
accasareal@bestel.com.mx
adamz@opexld.com
aderin@nextgenvoice.ai
admin@anoyvoice.us
admin@dezivoice.com
adrian@voiplynk.com
aduse@smcvoice.net
ajorgensen@prosperwireless.us
alberto@virtual-3.com
aleksandrovanataly8@gmail.com
alex.r@convergence.com
amber@voxilinks.com
americaninvrestholding@gmail.com
amit@gmkmarketing.com
ananthaa@ais.co.th
andrew.myers@babble.cloud
anglov@srscctek.com
ansarjaved@protonmail.com
asierra@quantumcom.tech
audit@mrz2.com
avipc@pc.net
bhornsby@hddbroadband.com
bido@kt.com
billing@tanyadavidsolutions.com
bradmedinger@directcom.com
btarimel@pnccpalau.com
bterry@telspacesol.com
burton@onecalltech.com
calleek@aibillity.com
ceo@netrouteservices.ca
chantal@audonixnetwork.com
charle@slinc.co
charleston@telaux.com
charrington@west.com
chris.kenst@stellaautomotive.com
christian.look@europeer.de
compliance@afnetconnect.com
compliance@american-telecomm.com
compliance@cssinfotech.in
compliance.legal@nwncarousel.com
compliance@ocapsolutions.com
compliance@renvvostudio.com
compliance@swtechpartners.com
contact@businesstelephones.org
c.swinnerton@brightcloudgroup.global
cx@ardo.group
dad@relatel.dk
dan.easley@nice.com
daniel@maskyoo.com
dax.fujimoto@wyyerd.com
dcopeland@dimension4.com
devops@avmup.com
df@gfleads.com
digvijay@tecxar.io
director@telcoltd.com
doina.medinschi@telekom.ro
donovan.hopf@mybluepeak.com
dwibendu@voiptechsolutions.in
ed.pushkarewicz@rcgtelecom.com
eduardo.guzmanflorez@clarovtr.cl
edwin@8corenetworks.com
elopez@comunycarse.com
enquiries@voicevalley.com
enull@grexo.com
eric@tryvocara.com
faizan@asanavoip.com
faizan@voxconnects.com
fcc@pulkco.com
fcc-robocall-contact@inttek.net
fcc@voipro.com
fcherico@computerup.com
fogel.chris@intermetro.net
fraud@livewiretel.com
fraud@nexxtmobile.de
george@1234voip.com
george@perfect.network
ghian@ezi-connect.co.za
ghulam.murtaza@ptcl.net.pk
gilad.davidov@acsincsmart.com
giovanni.cambronero@telecablecr.com
globaextrainfocom@gmail.com
globalrce@bt.com
graham.packer@wavecrest.com
gramvoip@protonmail.com
hassan@sindurtech.com
heather@connectwebx.com
henry.latourrette@tigo.net.py
howard.hellman@hfghealthlife.com
hryel@voip3.com
iinfo@sangamonconnect.com
info@callinbound.com
info@comexcel.com
info@cybexsolutions.co
info@dialphone.ai
info@encryptitall.com
info@foertschholdingsinc.com
info@goautodial.com
info@goavsi.com
info@gtknetworks.com
info@systemverse.com
ingrid.conejeros@netline.net
itdirector@accelecom.net
iva.krastovcheva@vivacom.bg
james.lightowlers@horizonco.co.uk
jana@micktelllc.com
javier_mayz@digitel.com.ve
jayanta.ghosh@microtalk.in
jgonzalez@mcmtelecom.com.mx
joe@amptelecom.com
johng@leadhelm.com
john.greer@michbbs365.com
johnny@comdatasolutions.com
john@skylinesol.com
jon.allen@avoira.com
jorge.conforme@ciriontechnologies.com
jorge.deleon@atel.com.gt
jorge.lara@axsbolivia.com
jriek@comtel.us
kasper@sipgalaxy.com
kimberly.simmons@a1chrysalis.com
legal@fiberfirst.com
legal@mcmtelecom.com.mx
legal@mobi.com
lingovoice@protonmail.com
livingston@teltecinc.com
look@techmode.com
louis.posso@gibtele.com
mahir@solitaire-overseas.com
marilyn.barahona@tigo.co.cr
mark.churches@spark.co.nz
mark@flashtelco.com
markl@opexld.com
mark@predatorstudio.com
mark.waren@mgwtechnology.com
martin.heinzel@vodafone.com
mesum@polycomtech.com
michael@dialthemup.com
miguelangel.fiel@orange.com
monica.reyna@nuevatel.com
mustafa.yilmaz4@turkcell.com.tr
nkamrat@sipswitch.com
noc@nishnanet.com
noc@solbroadband.com
noc@voipsv.com
notifications@pcofmindtech.com
no-user-1775163197702@gmail.com
office@excelsiorwireless.net
omar.luna@voycetel.com
operations@liquid.tech
partners@voipzen.com
petros.pantzaris@cyta.com.cy
pneyman@genasys.com
pooja@sinistra.us
preston@itsolutionsco.com
rabiainnosoftsolution@gmai.com
randy.clarke@lumen.com
raphael.satlher@oi.net.br
ray.wasden@troycable.com
rebecca.barkhuizen@bluetone.net
rita.bereczki@lcrcom.es
rkrefting@cfec.com
r.mathur@commtrunks.com
robocall_contact@centaris.com
robocall@neitel.com
robocall@team-meta.net
robo@starnet360.net
robotrace@nebnet.com
rose.sinicroppe@thrio.com
ryoung@ldxx.com
salazarav@etpi.com.ph
sales@ringnition.com
sales@risinginteractions.com
sam.fernandez@prospirebpo.com
sean@brattmobile.com
service@versatechnologies.net
shendrix@tombigbee.org
smith@enaservicesllc.com
softwareinternationalg@gmail.com
spam@srqcomputerservices.com
ssolomasov@rt.ru
ssulivan@mettel.net
starz@qualityservice.com
stellletelephone@stelle.net
stirshakencompliance@impulse.net
subash.p@humandroid.in
support@conversant.technology
support@dev.standupwireless.com
support@venturetel.net
suzannereed@directcm.com
taimur.ahmed@hawkdial.com
techadmin@hyperserversystems.com
thorntonnuala730@gmail.com
tjfranzky@nuleef.com
t.mezheckis@callgear.com
traceback@inmarsat.com
traceback@yollacalls.com
trilok.negi@spectra.co
usa-abuse@msthintechnologies.com
victor.silva@hondutel.hn
vijayac@truvana.services
vinod.mehlan@exotel.in
voice@resolveguide.com
voipabuse@alvarezsupport.com
voip@horizonmanaged.com
voiptalkllc@protonmail.com
voipxdialerx@protonmail.com
zsolt.nemeth@turktelekomint.com
zultys@armeshuntfuneralhome.com
fntn@netins.net
mtc@mintel.net
regulatory@pups.tel""".strip().split("\n") if e.strip()]
def curl(method, path, data=None):
cmd = ["curl", "-s", "-X", method, "-u", f"{API_USER}:{API_PASS}",
"-H", "Content-Type: application/json"]
if data:
cmd += ["-d", json.dumps(data)]
cmd.append(f"{LISTMONK}{path}")
r = subprocess.run(cmd, capture_output=True, text=True, timeout=10)
try:
return json.loads(r.stdout)
except Exception:
return {"error": r.stdout[:200], "stderr": r.stderr[:200]}
blocked = 0
not_found_created = 0
already_blocked = 0
failed = 0
for email in BOUNCED:
# Search by SQL query
query = f"subscribers.email = '{email}'"
result = curl("GET", f"/api/subscribers?query={query}&per_page=5")
subs = result.get("data", {}).get("results", [])
if subs:
sub = subs[0]
sid = sub["id"]
status = sub.get("status", "?")
if status == "blocklisted":
already_blocked += 1
continue
# Blocklist the subscriber
r = curl("PUT", f"/api/subscribers/{sid}/blocklist")
if r.get("data", False) is True or "error" not in r:
blocked += 1
else:
print(f" FAIL blocklist {email} (id={sid}): {r}")
failed += 1
else:
# Create as blocklisted
r = curl("POST", "/api/subscribers", {
"email": email,
"name": "Bounced",
"status": "blocklisted",
"lists": [],
})
if r.get("data", {}).get("id"):
not_found_created += 1
else:
# May be a duplicate or other error
err = str(r)
if "already exists" in err.lower() or "duplicate" in err.lower():
already_blocked += 1
else:
print(f" FAIL create {email}: {err[:150]}")
failed += 1
print(f"\nTotal: {len(BOUNCED)} emails")
print(f" Blocklisted (existing subscribers): {blocked}")
print(f" Already blocklisted: {already_blocked}")
print(f" Created as blocklisted (new): {not_found_created}")
print(f" Failed: {failed}")