#!/usr/bin/python


#  PROJECT HONEY POT ADDRESS DISTRIBUTION SCRIPT
#  For more information visit: http://www.projecthoneypot.org/
#  Copyright (C) 2004-2023, Unspam Technologies, Inc.
#  
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
#  02111-1307  USA
#  
#  If you choose to modify or redistribute the software, you must
#  completely disconnect it from the Project Honey Pot Service, as
#  specified under the Terms of Service Use. These terms are available
#  here:
#  
#  http://www.projecthoneypot.org/terms_of_service_use.php
#  
#  The required modification to disconnect the software from the
#  Project Honey Pot Service is explained in the comments below. To find the
#  instructions, search for:  *** DISCONNECT INSTRUCTIONS ***
#  
#  Generated On: Sun, 06 Aug 2023 11:39:57 -0400
#  For Domain: www.jaraco.com
#  
#  


#  *** DISCONNECT INSTRUCTIONS ***
#  
#  You are free to modify or redistribute this software. However, if
#  you do so you must disconnect it from the Project Honey Pot Service.
#  To do this, you must delete the lines of code below located between the
#  *** START CUT HERE *** and *** FINISH CUT HERE *** comments. Under the
#  Terms of Service Use that you agreed to before downloading this software,
#  you may not recreate the deleted lines or modify this software to access
#  or otherwise connect to any Project Honey Pot server.
#  
#  *** START CUT HERE ***
#  
__REQUEST_HOST    = 'hpr6.projecthoneypot.org'
__REQUEST_PORT    = '80'
__REQUEST_SCRIPT  = '/cgi/serve.php'
#  
#  *** FINISH CUT HERE ***
#  

__HPOT_TAG1       = 'beb55980f32e6db44574361f639647a7'
__HPOT_TAG2       = 'b6fceffd64e7de1ac86c48c9fda3d71b'
__HPOT_TAG3       = 'd19f5da5c91195b739432dac8050cc1c'

__CLASS_STYLE_1   = 'sipr'
__CLASS_STYLE_2   = 'uuye'

__DIV1            = 'bus33'

__VANITY_L1       = 'MEMBER OF PROJECT HONEY POT'
__VANITY_L2       = 'Spam Harvester Protection Network'
__VANITY_L3       = 'provided by Unspam'

__DOC_TYPE1       = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n'
__HEAD1           = '<html>\n<head>\n'
__HEAD2           = '<title>Phonekeeper</title>\n</head>\n'
__ROBOT1          = '<meta name="robots" content="noindex">\n<meta name="robots" content="noarchive">\n<meta name="robots" content="follow">\n'
__NOCOLLECT1      = '<meta name="no-email-collection" content="/">\n'
__TOP1            = '<body>\n<div align="center">\n'
__EMAIL1A         = '<a href="mailto:'
__EMAIL1B         = '" style="display: none;">'
__EMAIL1C         = '</a>'
__EMAIL2A         = '<a href="mailto:'
__EMAIL2B         = '" style="display:none;">'
__EMAIL2C         = '</a>'
__EMAIL3A         = '<a style="display: none;" href="mailto:'
__EMAIL3B         = '">'
__EMAIL3C         = '</a>'
__EMAIL4A         = '<a style="display:none;" href="mailto:'
__EMAIL4B         = '">'
__EMAIL4C         = '</a>'
__EMAIL5A         = '<a href="mailto:'
__EMAIL5B         = '"></a>'
__EMAIL5C         = '..'
__EMAIL6A         = '<span style="display: none;"><a href="mailto:'
__EMAIL6B         = '">'
__EMAIL6C         = '</a></span>'
__EMAIL7A         = '<span style="display:none;"><a href="mailto:'
__EMAIL7B         = '">'
__EMAIL7C         = '</a></span>'
__EMAIL8A         = '<!-- <a href="mailto:'
__EMAIL8B         = '">'
__EMAIL8C         = '</a> -->'
__EMAIL9A         = '<div id="'+__DIV1+'"><a href="mailto:'
__EMAIL9B         = '">'
__EMAIL9C         = '</a></div><br><script language="JavaScript" type="text/javascript">document.getElementById(\''+__DIV1+'\').innerHTML=\'\';</script>'
__EMAIL10A        = '<a href="mailto:'
__EMAIL10B        = '"><!-- '
__EMAIL10C        = ' --></a>'
__LEGAL1          = ''
__LEGAL2          = '\n'
__STYLE1          = '\n<style>a.'+__CLASS_STYLE_1+'{color:#FFF;font:bold 10px arial,sans-serif;text-decoration:none;}</style>'
__VANITY1         = '<table cellspacing="0"cellpadding="0"border="0"style="background:#999;width:230px;"><tr><td valign="top"style="padding: 1px 2px 5px 4px;border-right:solid 1px #CCC;"><span style="font:bold 30px arial,sans-serif;color:#666;top:0px;position:relative;">@</span></td><td valign="top" align="left" style="padding:3px 0 0 4px;"><a href="http://www.projecthoneypot.org/" class="'+__CLASS_STYLE_1+'">'+__VANITY_L1+'</a><br><a href="http://www.unspam.com"class="'+__CLASS_STYLE_1+'">'+__VANITY_L2+'<br>'+__VANITY_L3+'</a></td></tr></table>\n'
__BOTTOM1         = '</div>\n</body>\n</html>\n'


def _getLegalContent(): 
    return '<table cellpadding="0" cellspacing="0" border="0">\n<tr>\n<td style="font-family: courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp;<br>&#84;he webs<br>to yo&#117;<font color=white>k</font>s<br>other<font color=white>o</font>&#116;e<span style="display: none">synagogue police</span><br>Webs<span style="display: none">diagnostic private little clannish french</span>ite <br>rea&#100; &#116;h&#101;<br>&#97;gen&#116;s o<br>them.<font color=white>d</font>Th<br>non-tran<br>Website.<br><br>&nbsp; &nbsp;&nbsp; <b><font color=white>e</font></b>&nbsp;<b><font color=white>t</font></b><br>&nbsp;<br>S&#112;e&#99;i&#97;&#108; <br>Non<span style="display: none">tent shaft japanese recruitment pathetic</span>-&#72;uma<br>spiders,<br>prog&#114;a&#109;&#115;<br>automa&#116;i<br><br>Email ad<br>It<font color=white>o</font>is re<br>alon<span style="display: none">unemployment stem thrushes coherent cluster</span>e. Y<br>h&#97;s a va<br>s&#116;orage,<br>value of<br>&#115;t&#111;rin&#103; <br>agreemen<br><br>&nbsp; &nbsp; &nbsp; &nbsp; <br><font color=white>e</font><br>&#69;ach par<br>aga&#105;nst<font color=white>i</font><br>("Judici<br>th&#101; reg&#105;<br>such l&#97;w<br>&#97;nd perf<br>of feder<br>any<span style="display: none">breeze</span>&nbsp;acti<br>Serv&#105;ce.<br>th&#101; abov<br><br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp;<br>You<font color=white>o</font>con&#115;<br>may<font color=white>a</font>appe<br>abuse&#46;<font color=white>f</font>T<br>&#86;&#105;sitors<br><br>VISITORS<br>P&#65;RTY OR<br>SUBSEQU&#69;<br></td>\n<td style="font-family: courier, monospace;">&nbsp; <b><font color=white>s</font></b>&nbsp; &nbsp;&nbsp; <br><br>ite from<br>ubject &#116;<br>rm&#115; g&#111;&#118;e<br>you &#97;cce<br>m &#99;a&#114;efu<br>f<font color=white>f</font>&#116;he i&#110;<br>e access<br>sfe&#114;able<br><br><br>&nbsp; <b><font color=white>h</font><font color=white>g</font></b>&nbsp;&nbsp; <b>S</b><br><br>res&#116;rict<br>n Visito<br>&nbsp;&#98;&#111;ts&#44;<font color=white>d</font>i<br>&nbsp;d&#101;s&#105;&#103;ne<br>ca&#108;ly&#46;<br><br>dress&#101;s <br>cognize&#100;<br>ou &#97;ckno<br>lu&#101; not <br>&nbsp;an&#100;/or <br>&nbsp;these a<br>this Web<br>t an&#100; ex<br><br><b><font color=white>d</font></b>&nbsp; &nbsp; &nbsp;&nbsp; <br><br>ty<font color=white>p</font>ag&#114;ee<br>t&#104;e othe<br>al Actio<br>s<span style="display: none">extramural error boorish social</span>tered A<br>s are ap<span style="display: none">humanity lococitato quaint professional</span><br>ormed en<br>al and s<br>on b&#114;oug<br>&nbsp;You con<br>&#101; a&#103;r&#101;em<br><br><b><font color=white>a</font></b>&nbsp; &nbsp; <b><font color=white>h</font></b>&nbsp; <br><br>ent &#116;o h<br>ar s&#111;me&#119;<br>he<font color=white>o</font>I&#100;&#101;&#110;t<br>&nbsp;agre&#101; n<br><br>&nbsp;AGREE T<br>&nbsp;SENDING<br>NT BREA&#67;<br></td>\n<td style="font-family: courier, monospace;">&nbsp; <b><font color=white>d</font></b>&nbsp; &nbsp;&nbsp; <br><br>&nbsp;whi&#99;h y<br>&#111;<font color=white>f</font>the fo<br>rnin&#103; &#97;c<br>p&#116; these<br>lly. Any<br>divi&#100;&#117;al<br>&nbsp;ri&#103;hts <br>&nbsp;&#119;it<span style="display: none">sound preventive</span>hout<br><br><br><b>&#80;&#69;&#67;IAL</b>&nbsp;<b>L</b><br><br>ions on <br>rs.<font color=white>s</font>Non-<br>ndexers,<br>d to acc<br><br><br>on this <br>&nbsp;tha&#116; th<br>wled&#103;e<font color=white>g</font>&#97;<br>le&#115;s tha<br>distribu<br>ddresses<br>s&#105;te\'s e<br>press&#108;y <br><br>&nbsp; &nbsp; &nbsp; &nbsp; <br><br>s that a<br>r in con<br>n"<span style="display: none">grouping answer hallowed outsider</span>&#41;<font color=white>a</font>shal<br>dministr<br>pl<span style="display: none">foundation</span>ied &#116;o<br>tire&#108;y &#119;<br>t&#97;te cou<br>&#104;t again<br>sent to <br>ent&#46;<br><br><b><font color=white>s</font></b>&nbsp;<b><font color=white>o</font><font color=white>d</font></b>&nbsp; &nbsp; <br><br>&#97;v<span style="display: none">work</span>ing yo<br>her&#101; on <br>ifier is<br>ot to us<br><br>HAT HARV<br><font color=white>f</font>ANY MES<br>&#72; OF THE<br></td>\n<td style="font-family: courier, monospace;">&nbsp;<b><font color=white>k</font></b>&nbsp;<b>T&#69;RM&#83;</b><br><br>ou ac&#99;es<br>llowing <br>cess to <br><font color=white>k</font>t&#101;rms a<br>&nbsp;Non-Hum<br>(&#115;) who<font color=white>o</font><br>gr&#97;&#110;ted <br>&nbsp;the exp<br><br><br><b>ICE&#78;SE<span style="display: none">hitch barn legionary</span></b>&nbsp;<b>R</b><br><br>a visi&#116;o<br>Human<font color=white>p</font>Vi<br>&nbsp;ro&#98;ots,<br>ess<span style="display: none">snug</span>, rea<br><br><br>&#115;ite are<br>ese &#101;mai<br>nd &#97;gree<br>n U&#83; $50<br>&#116;ion of<font color=white>a</font><br>. Intent<br>mail &#97;&#100;d<br>proh&#105;bit<br><br>&nbsp;<b>APP&#76;ICA</b><br><br>ny su&#105;t&#44;<br>n&#101;ction <br>l &#98;e gov<br>ative Co<br>&nbsp;agreeme<br>ithin th<br>r&#116;s w&#105;th<br>st him i<br>electron<br><br><br><b>R&#69;&#67;ORDS</b>&nbsp;<br><br>ur Inte&#114;<br>this pag<br>&nbsp;uniquel<br>e this<span style="display: none">rallentando carryout pestilential uncut</span>&nbsp;a<br><br>EST&#73;N&#71;, <br>S&#65;GE(&#83;) <br>SE &#84;ERMS<br></td>\n<td style="font-family: courier, monospace;">&nbsp;<b>AND</b>&nbsp;<b>CON</b><br><br>sed th&#105;&#115;<br>condi<span style="display: none">evaluation slouchy tank earnings damp</span>tio<br>the We&#98;&#115;<br>&#110;&#100; cond&#105;<br>a&#110; Visit<br>contr<span style="display: none">paper</span>ols<span style="display: none">stellar guarded heptavalent</span><br>to y&#111;u<font color=white>i</font>u<br>ress w&#114;&#105;<br><br><br><b>ESTRICTI</b><br><br>r\'s l&#105;ce<br>si&#116;ors i<br>&nbsp;&#99;ra&#119;ler<br>d, com&#112;i<br><br><br>&nbsp;c<span style="display: none">high available scene cryptic commissioner</span>onside<br>l addres<br>&nbsp;tha&#116; ea<br>. You fu<br>these ad<br>iona&#108; co<br>resse&#115; i<br>ed.<br><br><b>BLE</b>&nbsp;<b>&#76;A&#87;</b>&nbsp;<br><br>&nbsp;action <br>wit&#104; or<font color=white>t</font><br>erned by<br>ntact (t<br>nts &#98;etw<br>e<font color=white>h</font>Admin <br>&#105;n the A<br>n co<span style="display: none">segue asymmetric processor camels earthy</span>nn&#101;c<br>i&#99; s&#101;rvi<br><br><br><b>OF</b>&nbsp;<b>V&#73;SIT</b><br><br>net<font color=white>o</font>Prot<br>e (&#116;he "<br>y matche<br>ddress f<br><br>GAT&#72;ERIN<br>&#84;O T&#72;&#69; I<br>&nbsp;OF<font color=white>t</font>&#83;ERV<br></td>\n<td style="font-family: courier, monospace;"><b>DITIONS</b>&nbsp;<br><br>&nbsp;agreem&#101;<br>ns. Thes<br>&#105;te&#46; By <br>ti&#111;ns (t<br>ors<span style="display: none">dear renewal</span>&nbsp;to t<br>, author<br>nder th<span style="display: none">ray</span>e<br>tten per<br><br><br><b>ON&#83;</b>&nbsp;<b>F&#79;R</b>&nbsp;<br><br>&#110;se<font color=white>a</font>t&#111; a<br>nc&#108;ude, <br>s,<span style="display: none">anaerobic dysfunctional</span>&nbsp;ha&#114;ve<br>le or ga<br><br><br>r&#101;d p&#114;op<br>s&#101;s<font color=white>a</font>are <br>ch email<br>r&#116;&#104;er ag<br>dresses <br>llecti&#111;n<br>s recog&#110;<br><br><br><b>A&#78;D</b>&nbsp;<b>&#74;&#85;RI</b><br><br>or proce<br>arising <br>&nbsp;the law<br>h<span style="display: none">threeway filmy useful crack</span>e "Admi<br>een &#65;d&#109;i<br>St&#97;te&#46; Y<br>d&#109;in Sta<br>t&#105;on wit<br>ce of pr<br><br><br><b>OR</b>&nbsp;<b>US&#69;</b>&nbsp;<b>A</b><br><br>ocol add<br>Identifi<br>&#100; to &#121;ou<br>o&#114;<font color=white>s</font>any r<br><br>G&#44; STORI<br>DEN<span style="display: none">compound core stark tweedy</span>TIFIE<br>ICE.<br></td>\n<td style="font-family: courier, monospace;"><b>OF</b>&nbsp;<b>USE</b>&nbsp;<br><br>nt ("the<br>e terms<font color=white>o</font><br>visiting<br>he "Ter&#109;<br>h<span style="display: none">exhibition wellversed ticket</span>e W&#101;bsi<br>s<font color=white>s</font>o&#114; oth<span style="display: none">focus zany untimely</span><br>&nbsp;Terms &#111;<br>mission <br><br><br><b>NO&#78;-H&#85;MA</b><br><br>cces<span style="display: none">desert ball easter alike</span>&#115; &#116;h<br>b&#117;t are<font color=white>g</font><br>&#115;te<span style="display: none">professor marginal</span>rs, o<br>the&#114;<font color=white>p</font>&#99;on<br><br><br>rie&#116;a&#114;y <br>pro&#118;i<span style="display: none">darn</span>&#100;ed<br>&nbsp;address<br>ree that<br>&#115;&#117;bstant<br>,<span style="display: none">cd reflection engaged sexuality</span>&nbsp;harv&#101;s<br>ized as <br><br><br><b>S&#68;&#73;&#67;TIO&#78;</b><br><br>&#101;&#100;i&#110;g br<br>from the<br>&nbsp;of t&#104;e <br>n<font color=white>t</font>State"<br>n State <br>ou conse<br>t&#101;. You <br>h br&#101;a&#99;h<br>oces&#115; re<br><br><br><b>&#78;D</b>&nbsp;<b>ABUS<span style="display: none">entertaining oblique ghoul fear</span>E</b><br><br>ress re<span style="display: none">workmanlike metre</span>c<br>&#101;r") if <br>r Inter&#110;<br>easo<span style="display: none">texture pause leader</span>n.<br><br>&#78;G, T&#82;A&#78;<br>R CONSTI<br><br></td>\n<td style="font-family: courier, monospace;"><br><br>&nbsp;We<span style="display: none">mortality interoffice square riverside</span>bsit&#101;<br>are<font color=white>s</font>i&#110; a<br>&nbsp;(i&#110; any<br>s of &#83;er<br>&#116;e &#115;ha<span style="display: none">agitato plaza</span>ll<br>&#101;rwise m<br>f Servic<br>of the o<br><br><br><b>N</b>&nbsp;<b>VISIT&#79;</b><br><br>e &#87;ebsit<br>not limi<br>&#114; any ot<br>tent fro<br><br><br>intellec<br>&nbsp;f<span style="display: none">earnings downlink loch premium organ</span>&#111;r hum<br>&nbsp;the Web<br>&nbsp;&#116;&#104;e com<br>iall&#121;<font color=white>e</font>di<br>ting, &#103;a<br>a &#118;io&#108;at<br><br><br>&nbsp;<br><br>ought b&#121;<br>&nbsp;Te&#114;ms o<br>stat&#101; &#111;f<br>)<font color=white>e</font>for<font color=white>a</font>t&#104;<br>resid&#101;nt<br>nt &#116;o th<br>consent <br>es of th<br>gar&#100;in&#103;<font color=white>a</font><br><br><br>&nbsp;<br><br>orded&#46; A<br>we<font color=white>p</font>suspe<br>e&#116; Proto<br><br><br>&#83;FER&#82;ING<br>&#84;UTES AN<br><br></td>\n<td style="font-family: courier, monospace;"><br><br>") i&#115; pr<br>ddition <br>&nbsp;manner)<br>v&#105;ce").<font color=white>a</font><br>&nbsp;be cons<br>akes use<br>e are<br>wner of <br><br><br><b>&#82;S</b>&nbsp;<br><br>&#101; ap&#112;ly <br>ted to, <br>her comp<br>&#109; the We<br><br><br>tual pro<br>a&#110; visit<br>sit&#101; con<br>pilation<br>&#109;&#105;nis&#104;&#101;s<br>thering,<br>i&#111;n of t<br><br><br><br><br>&nbsp;such<font color=white>k</font>pa<br>f Ser&#118;ic<br>&nbsp;residen<br>e We&#98;&#115;it<br>s entere<br>e jurisd<br>to the v<br>e&#115;e Term<br>acti&#111;ns <br><br><br><br><br>n<font color=white>a</font>email <br>&#99;t poten<br>col addr<br><br><br><font color=white>i</font>TO A TH<br><font color=white>a</font>ACCEPTA<br><br></td>\n<td style="font-family: courier, monospace;"><br><br>o&#118;&#105;ded<br>to an&#121;<br>&nbsp;&#116;he<br>Please<br>idered<br>&nbsp;&#111;f<br><br>th&#101;<br><br><br><br><br>to<br>web<br>uter<br>bsite<span style="display: none">savory commodity hoary</span><br><br><br>perty&#46;<br>ors<br>tai&#110;s<br>,<br>&nbsp;th&#101;<br>&nbsp;and/or<br>his<br><br><br><br><br>r&#116;y<br>e<span style="display: none">bombastic source demonic diesel</span><br>c&#101; of<br>e as<br>d into<br>i&#99;ti&#111;n<br>enue i&#110;<br>s of<br>und&#101;r<br><br><br><br><br>ad<span style="display: none">fuzz distressed competence feedback neuropterous</span>dress<br>&#116;&#105;al<br>es<span style="display: none">flamingoes sisterly sir</span>s.<br><br><br>IR&#68;<br>NC<span style="display: none">trapezoid</span>E AND<br><br></td>\n</tr>\n</table>\n<br>'







del __CLASS_STYLE_1, __CLASS_STYLE_2, __DIV1, __VANITY_L1, __VANITY_L2, __VANITY_L3

__version__ = "1.3"

def _formatHTML( s ):
    return s.replace( r"\n", "\n" )

def _getDocType( _formatHTML = _formatHTML, __DOC_TYPE1 = __DOC_TYPE1 ): 
    return _formatHTML( __DOC_TYPE1 )
del __DOC_TYPE1

def _getHeadHTML1( _formatHTML = _formatHTML, __HEAD1 = __HEAD1 ):
    return _formatHTML( __HEAD1 )
del __HEAD1

def _getRobotHTML( _formatHTML = _formatHTML, __ROBOT1 = __ROBOT1 ):
    return _formatHTML( __ROBOT1 )
del __ROBOT1

def _getNoCollectHTML( _formatHTML = _formatHTML,
                       __NOCOLLECT1 = __NOCOLLECT1 ):
    return _formatHTML( __NOCOLLECT1 )
del __NOCOLLECT1

def _getHeadHTML2( _formatHTML = _formatHTML, __HEAD2 = __HEAD2 ):
    return _formatHTML( __HEAD2 )
del __HEAD2

def _getTopHTML( _formatHTML = _formatHTML, __TOP1 = __TOP1 ):
    return _formatHTML( __TOP1 )
del __TOP1

def _getEmailHTML( method, m,
                   _formatHTML = _formatHTML,
                   __EMAIL1A = __EMAIL1A, __EMAIL1B = __EMAIL1B, __EMAIL1C = __EMAIL1C,
                   __EMAIL2A = __EMAIL2A, __EMAIL2B = __EMAIL2B, __EMAIL2C = __EMAIL2C,
                   __EMAIL3A = __EMAIL3A, __EMAIL3B = __EMAIL3B, __EMAIL3C = __EMAIL3C,
                   __EMAIL4A = __EMAIL4A, __EMAIL4B = __EMAIL4B, __EMAIL4C = __EMAIL4C,
                   __EMAIL5A = __EMAIL5A, __EMAIL5B = __EMAIL5B, __EMAIL5C = __EMAIL5C,
                   __EMAIL6A = __EMAIL6A, __EMAIL6B = __EMAIL6B, __EMAIL6C = __EMAIL6C,
                   __EMAIL7A = __EMAIL7A, __EMAIL7B = __EMAIL7B, __EMAIL7C = __EMAIL7C,
                   __EMAIL8A = __EMAIL8A, __EMAIL8B = __EMAIL8B, __EMAIL8C = __EMAIL8C,
                   __EMAIL9A = __EMAIL9A, __EMAIL9B = __EMAIL9B, __EMAIL9C = __EMAIL9C,
                   __EMAIL10A = __EMAIL10A, __EMAIL10B = __EMAIL10B, __EMAIL10C = __EMAIL10C ):
    return { 0: "",
             1: _formatHTML( __EMAIL1A + m + __EMAIL1B + m + __EMAIL1C ),
             2: _formatHTML( __EMAIL2A + m + __EMAIL2B + m + __EMAIL2C ), 
             3: _formatHTML( __EMAIL3A + m + __EMAIL3B + m + __EMAIL3C ), 
             4: _formatHTML( __EMAIL4A + m + __EMAIL4B + m + __EMAIL4C ), 
             5: _formatHTML( __EMAIL5A + m + __EMAIL5B ), 
             6: _formatHTML( __EMAIL6A + m + __EMAIL6B + m + __EMAIL6C ), 
             7: _formatHTML( __EMAIL7A + m + __EMAIL7B + m + __EMAIL7C ), 
             8: _formatHTML( __EMAIL8A + m + __EMAIL8B + m + __EMAIL8C ), 
             9: _formatHTML( __EMAIL9A + m + __EMAIL9B + m + __EMAIL9C ), 
             }.get( method, # if not found then default to method 10
                    _formatHTML( __EMAIL10A + m + __EMAIL10B + m + __EMAIL10C ) )
del __EMAIL1A, __EMAIL1B, __EMAIL1C
del __EMAIL2A, __EMAIL2B, __EMAIL2C
del __EMAIL3A, __EMAIL3B, __EMAIL3C 
del __EMAIL4A, __EMAIL4B, __EMAIL4C
del __EMAIL5A, __EMAIL5B, __EMAIL5C
del __EMAIL6A, __EMAIL6B, __EMAIL6C
del __EMAIL7A, __EMAIL7B, __EMAIL7C
del __EMAIL8A, __EMAIL8B, __EMAIL8C
del __EMAIL9A, __EMAIL9B, __EMAIL9C
del __EMAIL10A, __EMAIL10B, __EMAIL10C

def _getLegalHTML( _formatHTML = _formatHTML, __LEGAL1 = __LEGAL1,
                   _getLegalContent = _getLegalContent, __LEGAL2 = __LEGAL2 ):
    return _formatHTML( __LEGAL1 + _getLegalContent() + __LEGAL2 )
del __LEGAL1, _getLegalContent, __LEGAL2

def _getStyleHTML( _formatHTML = _formatHTML, __STYLE1 = __STYLE1 ):
    return _formatHTML( __STYLE1 )
del __STYLE1

def _getVanityHTML( _formatHTML = _formatHTML, __VANITY1 = __VANITY1 ):
    return _formatHTML( __VANITY1 )
del __VANITY1

def _getBottomHTML( _formatHTML = _formatHTML, __BOTTOM1 = __BOTTOM1 ):
    return _formatHTML( __BOTTOM1 )
del __BOTTOM1

def _performRequest( payload,
                     host = __REQUEST_HOST,
                     port = __REQUEST_PORT,
                     path = __REQUEST_SCRIPT,
                     tag2 = __HPOT_TAG2 ):
    import socket

    req = [
        f"POST {path} HTTP/1.1",
        f"Host: {host}",
        f"User-Agent: PHPot {tag2}",
        f"Cache-Control: no-store, no-cache",
        f"Accept: */*",
        f"Content-Type: application/x-www-form-urlencoded",
        f"Content-Length: " + str(len(payload)),
        f"Connection: Close",
        f"",
        payload,
    ];

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.connect((host, int(port)))
        s.sendall(bytes("\r\n".join(req), 'utf-8'))
        res = '';
        while True:
            data = s.recv(1024)
            if not data: break
            res += data.decode('utf-8')

    return res

del __REQUEST_HOST, __REQUEST_PORT, __REQUEST_SCRIPT

def _whoAmI():
    import hashlib
    try:
        r = __file__
    except:
        import sys
        r = sys.argv[ 0 ]
    body = open( r ).read()
    body = body.split( "\n", 1 )[ 1 ]
    return hashlib.md5( body.encode('utf-8') ).hexdigest()

def _prepareRequest( REQUEST, forcePortNumber = None,
                     _whoAmI = _whoAmI, __HPOT_TAG1 = __HPOT_TAG1,
                     __HPOT_TAG2 = __HPOT_TAG2, __HPOT_TAG3 = __HPOT_TAG3 ):
    from sys import version
    postvars = {}
    postvars[ "tag1" ] = __HPOT_TAG1
    postvars[ "tag2" ] = __HPOT_TAG2
    postvars[ "tag3" ] = __HPOT_TAG3
    postvars[ "tag4" ] = _whoAmI()
    postvars[ "ip" ] = REQUEST.get( "REMOTE_ADDR" , "" )
    postvars[ "svrn" ] = ( REQUEST.get( "HTTP_HOST", "" )
                           or REQUEST.get( "SERVER_NAME", "" ) )
    postvars[ "svp" ] = forcePortNumber or REQUEST.get( "SERVER_PORT", "80" ) 
    postvars[ "svip" ] = REQUEST.get( "SERVER_ADDR", "" )
    postvars[ "rquri" ] = ( REQUEST.get( "REQUEST_URI", "" ) 
                            or REQUEST.get( "PATH_INFO", "" ) )
    postvars[ "version" ] = __version__ + "-" + version.split()[ 0 ]
    postvars[ "sn" ] = ( REQUEST.get( "SCRIPT_NAME", "" )
                         or REQUEST.get( "PATH_TRANSLATED", "" ) )
    postvars[ "ref" ] = REQUEST.get( "HTTP_REFERER", "" )
    postvars[ "uagnt" ] = REQUEST.get( "HTTP_USER_AGENT", "" )
    return postvars
del _whoAmI, __HPOT_TAG1, __HPOT_TAG2, __HPOT_TAG3

def _transcribeResponse( response ):
    import urllib.parse
    settings = {}
    isParam = 0
    for line in response.split( "\n" ):
        if line == "<END>":
            isParam = 0
        if isParam:
            pieces = line.split( "=", 1 )
            settings[ pieces[ 0 ] ] = urllib.parse.unquote_plus( pieces[ 1 ] )
        if line == "<BEGIN>":
            isParam = 1
    if 'directives' in settings:
        settings[ "directives" ] = settings[ "directives" ].split( "," )
    else:
        settings[ "directives" ] = [ "1" ] * 10
    settings[ "directives" ] = list(map( int, settings[ "directives" ] ))
    for k, v in settings.items():
        try:
            settings[ k ] = int( v )
        except:
            pass
    return settings

def _getSettings( REQUEST, forcePortNumber = None,
                  _performRequest = _performRequest,
                  _prepareRequest = _prepareRequest,
                  _transcribeResponse = _transcribeResponse ):
    import urllib.parse
    request = []
    for k, v in _prepareRequest( REQUEST, forcePortNumber ).items():
        request.append( k + "=" + urllib.parse.quote( v ) )
    request = "&".join( request )
    response = _performRequest( request )
    return _transcribeResponse( response )
del _performRequest, _prepareRequest, _transcribeResponse

def _makeHTML( settings,
               _formatHTML = _formatHTML,
               _getBottomHTML = _getBottomHTML, _getDocType = _getDocType,
               _getEmailHTML = _getEmailHTML, _getHeadHTML1 = _getHeadHTML1,
               _getHeadHTML2 = _getHeadHTML2, _getLegalHTML = _getLegalHTML,
               _getNoCollectHTML = _getNoCollectHTML,
               _getRobotHTML = _getRobotHTML, _getStyleHTML = _getStyleHTML,
               _getTopHTML = _getTopHTML, _getVanityHTML = _getVanityHTML ):
    directives = settings[ "directives" ]
    email = settings.get( "email", None )
    emailmethod = settings.get( "emailmethod", None )
    return "".join ( [ directives[ 0 ] and _getDocType()  or "",
                       settings.get( "injDocType", 0 ) and _formatHTML( settings.get( "injDocTypeMsg", "" ) ) or "",
                       directives[ 1 ] and _getHeadHTML1() or "",
                       settings.get( "injHead1HTML", 0 ) and _formatHTML( settings.get( "injHead1HTMLMsg", "" ) ) or "",
                       directives[ 8 ] and _getRobotHTML() or "",
                       settings.get( "injRobotHTML", 0 ) and _formatHTML( settings.get( "injRobotHTMLMsg", "" ) ) or "",
                       directives[ 9 ] and _getNoCollectHTML() or "",
                       settings.get( "injNoCollectHTML", 0 ) and _formatHTML( settings.get( "injNoCollectHTMLMsg", "" ) ) or "",
                       directives[ 1 ] and _getHeadHTML2() or "",
                       settings.get( "injHead2HTML", 0 ) and _formatHTML( settings.get( "injHead2HTMLMsg", "" ) ) or "",
                       directives[ 2 ] and _getTopHTML() or "",
                       settings.get( "injTopHTML", 0 ) and _formatHTML( settings.get( "injTopHTMLMsg", "" ) ) or "",

                       settings.get( "actMsgOn", 0 ) and _formatHTML( settings.get( "actMsg", "" ) ) or "",
                       settings.get( "errMsgOn", 0 ) and _formatHTML( settings.get( "errMsg", "" ) ) or "",
                       settings.get( "customMsgOn", 0 ) and _formatHTML( settings.get( "customMsg", "" ) ) or "",

                       directives[ 3 ] and _getLegalHTML() or "",
                       settings.get( "injLegalHTML", 0 ) and _formatHTML( settings.get( "injLegalHTMLMsg", "" ) ) or "",
                       settings.get( "altLegalOn", 0 ) and _formatHTML( settings.get( "altLegalMsg", "" ) ) or "",

                       directives[ 4 ] and _getEmailHTML( emailmethod, email ) or "",
                       settings.get( "injEmailHTML", 0 ) and _formatHTML( settings.get( "injEmailHTMLMsg", "" ) ) or "",
                       directives[ 5 ] and _getStyleHTML() or "",
                       settings.get( "injStyleHTML", 0 ) and _formatHTML( settings.get( "injStyleHTMLMsg", "" ) ) or "",

                       directives[ 6 ] and _getVanityHTML() or "",
                       settings.get( "injVanityHTML", 0 ) and _formatHTML( settings.get( "injVanityHTMLMsg", "" ) ) or "",
                       settings.get( "altVanityOn", 0 ) and _formatHTML( settings.get( "altVanityMsg", "" ) ) or "",

                       directives[ 7 ] and _getBottomHTML() or "",
                       settings.get( "injBottomHTML", 0 ) and _formatHTML( settings.get( "injBottomHTMLMsg", "" ) ) or "",
                       ] )
del _formatHTML
del _getBottomHTML, _getDocType, _getEmailHTML
del _getHeadHTML1, _getHeadHTML2, _getLegalHTML, _getNoCollectHTML
del _getRobotHTML, _getStyleHTML, _getTopHTML, _getVanityHTML

def from_cgi( _getSettings = _getSettings, _makeHTML = _makeHTML ):
    """This function is to be called by CGI scripts.  It will print
    (to standard output) the Content-Type header and full page HTML
    for your honeypot."""
    print("Content-Type: text/html")
    print("Cache-Control: no-cache")
    print()
    print(getResult())

def getResult( _getSettings = _getSettings, _makeHTML = _makeHTML ):
    import os
    settings = _getSettings( os.environ )
    return _makeHTML( settings )


try:
    if __name__ == '__main__':
        from_cgi()
    else:
        del from_cgi
        def from_zope( REQUEST, forcePortNumber = None,
                       _getSettings = _getSettings, _makeHTML = _makeHTML ):
            """Pass this function the Zope REQUEST and it will return the
            full page HTML for your honeypot."""
            _getSettings = getattr( from_zope, 'getSettings', _getSettings )
            _makeHTML = getattr( from_zope, 'makeHTML', _makeHTML )
            if forcePortNumber:
                forcePortNumber = str( forcePortNumber )
            settings = _getSettings( REQUEST, forcePortNumber )
            return _makeHTML( settings )
        try:
            from_zope.getSettings = _getSettings
            from_zope.makeHTML = _makeHTML
        except:
            pass
        try:
            from_zope = from_zope.__call__
        except:
            pass
finally:
    try:
        del from_cgi
    except:
        pass
    del _getSettings, _makeHTML
