# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*<\?(?:php)?\s*\/\/open\s*templates\/yours\.php.{0,180}?yourlinkscam.{0,100}?rand\(\d+,.{0,2500}?your\s*account\s*will\s*be\s*limited\s*over\s*24\s*h.{0,200}?unauthorised\s*account\s*access.{0,220}?Click\s*the\s*link\s*Below.{0,80}Confirm\s*Your\s*Account.{0,450}?paypal\s*inc\..{0,300}?paypal\s*corporation(?:[^;]+;\s*)?\s*if\(\!empty\(\$_GET\[[\"']view['\"]\]\)\)\{echo\s*\$html(?:[^>]+>\s*)?$"
test_str = ("<?php\n"
"//open templates/Yours.php with a text editor copy paste your html code in $html between the 2 ' and change all ' in your html to \\' and href=\"http://yourlinkscam\" to href=\"'.$var.'\" \n\n"
"ini_set(\"output_buffering\",4096);\n"
"$IDK = rand(00000000000, 99999999999).time();\n"
"error_reporting(0);\n"
"$html='\n"
"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\">\n"
"<style type=\"text/css\">body { width: 100% !important;}</style>\n"
" </head>\n\n\n"
" \n"
" <table width=\"0\" border=\"0\">\n"
" <tbody><tr>\n"
" <td> <div>\n"
" <table cellspacing=\"0\" cellpadding=\"0\" width=\"550\" border=\"0\">\n"
" <tbody>\n"
" <tr>\n"
" <td style=\" BACKGROUND: #ffffff; LINE-HEIGHT: 22px;border-radius: 10px 10px 10px 10px\">\n\n"
" \n"
" \n"
" \n\n"
" <center><td>\n"
"<div style=\"FONT-SIZE:14px;FONT-FAMILY:Arial;COLOR:#747474\">\n"
"<p align=\"left\">\n"
"</p><div style=\"FONT-SIZE:10px;FONT-FAMILY:Arial black;COLOR:#828282;padding-left:30px\">\n"
"<center><p style=\"FONT-SIZE:28px\"><strong><em><font color=\"#003084\">P<span><font>a</font></span>y</font><font color=\"#0098db\">Pal</font></em></strong></center>\n"
"</p>\n\n"
"</div>\n"
"<p></p>\n"
"</div>\n"
"</td></center>\n"
" \n"
" \n"
" \n"
" </sub></font></p></div></p>\n"
" \n"
" </div>\n"
" </td>\n"
" </tr>\n"
" </tbody>\n"
" </table>\n\n"
" </td>\n"
" </tr>\n"
" </tbody>\n"
" </table>\n"
" </div>\n"
"<div><table cellspacing=\"0\" cellpadding=\"0\" width=\"0\" border=\"0\">\n"
" <tbody>\n"
" <tr>\n"
" <td style=\" BACKGROUND: #F3F3FF; ; LINE-HEIGHT: 22px\">\n"
" <table cellspacing=\"0\" cellpadding=\"0\" width=\"600\" align=\"left\" border=\"0\">\n"
" <tbody>\n"
" <tr>\n"
" <td>\n"
" <div>\n\n"
"<br />\n"
"<br />\n"
"<br />\n"
"<td style=\"PADDING-TOP:15px\">\n"
"<div style=\"FONT-SIZE:15px;FONT-FAMILY:Arial;COLOR:#585858;margin-left:10px;margin-right:30px\">\n"
"<center><p style=\"font-family:Helvetica Neue Light,Helvetica,Arial,sans-serif;font-size:20px;color:#009cde\">Your Account will be limited over 24 h if you dont\n"
"confirm it .</p></center>\n"
"<br>\n"
"<p>\n"
"<strong>why my Account will Be limited ?</p></strong>\n"
"<center><em><li><ins>unauthorised account access From 59.56.111.253 . China-CN</ins></em></p></li>\n"
"<br>\n"
"Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0\n"
"<br>\n"
"<br> \n"
"<span style=\"color: #808080;\"><strong>Click the link Below and login then follow steps to Confirm Your Account :</strong></span><br /><br /><br><a onclick=\"return true\" href=\"'.$var.'\" style=\"FONT-SIZE:14px;FONT-FAMILY:Arial;WIDTH:250px;COLOR:#fff;TEXT-ALIGN:center;DISPLAY:inline-block;BACKGROUND-COLOR:#16aeff;border-radius:7px;line-height:28px\"><strong>Confirm My Account\n"
"</strong> </a><br /> <br /> <br /> <br /> <span style=\"font-size: 10px; font-family: Arial, Verdena;\"> <em>PayPal Inc. : PayPal Corporate Center, 100 North Tryon Street, Charlotte, NC 28255. \n"
"<br/>\n"
"<br/>\n"
"You can un-subscribe to security alerts by configuring your online account. \n"
"We are sending this email to provide support for your personal account. <br /> <br />© 2017 PayPal Corporation. All rights reserved</em> </span> </li>';\n"
"if(!empty($_GET[\"view\"])){echo $html;}\n"
"?>")
matches = re.finditer(regex, test_str, re.IGNORECASE | re.DOTALL)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html