Skip to content

Instantly share code, notes, and snippets.

@dweekly
Created July 17, 2017 00:45
Show Gist options
  • Save dweekly/9f1825308147388b588df1dbfeb5ea53 to your computer and use it in GitHub Desktop.
Save dweekly/9f1825308147388b588df1dbfeb5ea53 to your computer and use it in GitHub Desktop.
Comcast Injected HTML
<!--
Page Loading starts on 2017/07/16 20:35:47, Total time elapsed to render is 0.14907363 seconds, Server: pub2w.slate.com
-->
<script language="JavaScript" type="text/javascript">
// Copyright (C) 2015 Comcast Cable Communications, LLC
// Contact Us: http://customer.xfinity.com/contact-us/
// Intended use of this message is to display critical and time sensitive notifications to customers.
/*
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html
*/
var _ComcastAlert = (function(){
return {
SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
, dragObj: {zIndex: 999999}
, browser: null
, comcastCheck: 1
, comcastTimer: null
, xmlhttp: null
, go: function(){
if(self.location !== top.location) return;
if(document.body){
_ComcastAlert.ComcastBrowserNotice();
_ComcastAlert.browser = _ComcastAlert.checkBrowser();
_ComcastAlert.getXmlhttp();
_ComcastAlert.checkBulletin();
return _ComcastAlert;
}else{
setTimeout(_ComcastAlert.go, 200);
}
}
, ComcastBrowserNotice: function(){
var image_url = 'http://bnpsa.g.comcast.net:80/images/ubb/';
var comcastAlertAnalytics = 'ubb_90%.png';
var notice_width = '600px';
var notice_height = '275px';
var winObj = {
image_url: image_url
, comcastAlertAnalytics: comcastAlertAnalytics
, notice_width: notice_width
, notice_height: notice_height
, comcastlogo_url: '<img src="' + image_url + 'comcast-logo.png" height="50" width="115"/>'
, xfinitylogo_url: '<img src="' + image_url + 'xfinity-logo-1.png" height="28" width="87"/>'
, headertext1: 'You&#39;ve used <b>90%</b> of your data usage plan'
, textline1: 'As of <b>07-16-2017</b>, you have <b>102</b> GB remaining of your <b>1024</b> GB Internet data usage plan for this calendar month. As a courtesy, we give you <b>2</b> months of complimentary overages. Your courtesy month balance is <b>2</b>.'
, privacypolicylink: '<a href="http://my.xfinity.com/privacy/" target="_new" style="color: #000000">PRIVACY POLICY</a>'
, termslink: '<a href="http://my.xfinity.com/terms/" target="_new" style="color: #000000">TERMS OF SERVICE</a>'
, usagemeterlink: '<a href="https://customer.comcast.com/Secure/UsageMeterDetail.aspx" target="_new" style="color: #000000">USAGE METER</a>'
, faqlink: '<a href="https://dataplan.xfinity.com/faq " target="_new" style="color: #000000">FAQs</a>'
, ackbulletin: '<a href=\"#\" onClick=\"javascript:_ComcastAlert.close_comcast_alert()\"><img src="' + image_url + 'click-to-close-520x90.png" height="32" width="182"/></a>'
, closebulletin: '<a href=\"#\" onClick=\"javascript:_ComcastAlert.close_comcast_alert()\"><img src="' + image_url + 'close-button-xgrey.png" height="32" width="32"/></a>'
, analytics: '<img src="' + image_url + encodeURIComponent(comcastAlertAnalytics) + '?' + _ComcastAlert.comcastContentnoCache() + '">'
};
this.createWindow(winObj);
}
, createWindow: function(winObj){
var html = '<style type="text/css">';
html += '#comcast_content {width: ' + winObj.notice_width + '; height:' + winObj.notice_height + '; background:#ffffff; border: 1px solid #454545; position:absolute; top:150px; left:100px; zoom:1; z-index: 9999999999; opacity:0.99; filter:alpha(opacity=99);}';
html += '#comcast_content .header {height: 45px; width: ' + winObj.notice_width + '; background-color:#292929; repeat-x; z-index: 999999;}';
html += '#comcast_content .content-wrapper {padding-left: 5px; padding-right: 5px; padding-bottom: 5px;}';
html += '#comcast_content .titletext1 {margin: 20px 0 0 15px; color: #303030; text-align: left; padding: 0; font: 16px/16px bold Arial, Helvetica, sans-serif;}';
html += '#comcast_content .titletext2 {margin: 20px 0 0 15px; color: #303030; text-align: left; padding: 0; font: 18px/20px bold Arial, Helvetica, sans-serif;}';
html += '#comcast_content .textcontent1 {margin: 10px 10px 0 15px; color: #303030; text-align: left; padding: 0; font: 16px/18px Arial, Helvetica, sans-serif; line-height: 1.2;}';
html += '#comcast_content .privacystatement {display: inline-block; position:absolute; bottom:5px; left:20px; font: 12px/12px Arial, Helvetica, sans-serif; text-align: bottom; white-space:nowrap;}';
html += '#comcast_content .privacystatement:link {color:#000000; text-decoration:none;}';
html += '#comcast_content .privacystatement:visited {color:#000000; text-decoration:none;}';
html += '#comcast_content .privacystatement:hover {color:#000000; text-decoration:underline;}';
html += '#comcast_content .usagemeter {display: inline-block; position:absolute; bottom:5px; left:298px; font: 12px/12px Arial, Helvetica, sans-serif; text-align: bottom; white-space:nowrap;}';
html += '#comcast_content .usagemeter:link {color:#000000; text-decoration:none;}';
html += '#comcast_content .usagemeter:visited {color:#000000; text-decoration:none;}';
html += '#comcast_content .usagemeter:hover {color:#000000; text-decoration:underline;}';
html += '#comcast_content .termsofservice {display: inline-block; position:absolute; bottom:5px; left:150px; font: 12px/12px Arial, Helvetica, sans-serif; text-align: bottom; white-space:nowrap;}';
html += '#comcast_content .termsofservice:link {color:#000000; text-decoration:none;}';
html += '#comcast_content .termsofservice:visited {color:#000000; text-decoration:none;}';
html += '#comcast_content .termsofservice:hover {color:#000000; text-decoration:underline;}';
html += '#comcast_content .faq {display: inline-block; position:absolute; bottom:5px; left:420px; font: 12px/12px Arial, Helvetica, sans-serif; text-align: bottom; white-space:nowrap;}';
html += '#comcast_content .faq:link {color:#000000; text-decoration:none;}';
html += '#comcast_content .faq:visited {color:#000000; text-decoration:none;}';
html += '#comcast_content .faq:hover {color:#000000; text-decoration:underline;}';
html += '#comcast_content .comcastlogo {display: inline-block; position:absolute; bottom:5px; right:5px; margin: 0 0 0 0; height:50px; width:115px; z-index: 9999999999;}';
html += '#comcast_content .xfinitylogo {display: inline-block; position:absolute; left:5px; top:10px; margin: 0 0 0 0; z-index: 9999999999; height:28px; width:87px;}';
html += '#comcast_content .comcastanalytics {display: inline-block; position:absolute; bottom:3px; right:3px; height: 1px; width: 1px; z-index: -99999; margin: 0 0 0 0; }';
html += '#comcast_content .acknowledgebutton {display: inline-block; position:absolute; z-index: 9999999999; bottom:45px; left:209px; height:40px; width:182px; }';
html += '#comcast_content .closebn {display: inline-block; position:absolute; z-index: 9999999999; left:560px; top:5px; height:32px; width:32px; margin: 0 0 0 0;}';
html += '</style>';
html += '<div class="main-wrapper" id="comcast_content">';
html += '<div class="header" onmousedown="javascript:_ComcastAlert.dragStart(event,\'comcast_content\')">';
html += '</div>';
html += '<div class="content-wrapper">';
html += '<p class="xfinitylogo">';
html += winObj.xfinitylogo_url;
html += '</p>';
html += '<p class="closebn">';
html += winObj.closebulletin;
html += '</p>';
html += '<p class="titletext1">';
html += winObj.headertext1;
html += '</p>';
html += '<p class="textcontent1">';
html += winObj.textline1;
html += '</p>';
html += '<p class="acknowledgebutton">';
html += winObj.ackbulletin;
html += '</p>';
html += '<p class="privacystatement">';
html += winObj.privacypolicylink;
html += '</p>';
html += '<p class="termsofservice">';
html += winObj.termslink;
html += '</p>';
html += '<p class="usagemeter">';
html += winObj.usagemeterlink;
html += '</p>';
html += '<p class="faq">';
html += winObj.faqlink;
html += '</p>';
html += '<p class="comcastlogo">';
html += winObj.comcastlogo_url;
html += '</p>';
html += '<p class="comcastanalytics">';
html += winObj.analytics;
html += '</p>';
html += '</div>';
html += '</div>';
html += '</div>';
document.body.innerHTML = document.body.innerHTML + html;
}
// Function to Determine browser and version. Copyright 2001 by Mike Hall.
, checkBrowser: function() {
var ua, s, i;
var browser = {
isIE: false
, isNS: false
, version: null
};
ua = navigator.userAgent;
s = "MSIE";
if ((i = ua.indexOf(s)) >= 1) {
browser.isIE = true; browser.version = parseFloat(ua.substr(i + s.length));
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
browser.isNS = true; browser.version = parseFloat(ua.substr(i + s.length));
}
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
browser.isNS = true; browser.version = 6.1;
}
return browser;
}
, dragStart: function(event, id) {
var browser1 = _ComcastAlert.browser;
var dragObj = _ComcastAlert.dragObj;
var el;
var x, y;
if (id) dragObj.elNode = document.getElementById(id);
else {
if (browser1.isIE) dragObj.elNode = window.event.srcElement;
if (browser1.isNS) dragObj.elNode = event.target;
if (dragObj.elNode.nodeType == 3) dragObj.elNode = dragObj.elNode.parentNode;
}
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (browser1.isNS) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
dragObj.cursorStartX = x;
dragObj.cursorStartY = y;
dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10);
dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10);
if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 100;
if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 50;
if (browser1.isIE) {
document.attachEvent("onmousemove", _ComcastAlert.dragGo);
document.attachEvent("onmouseup", _ComcastAlert.dragStop);
window.event.cancelBubble = true;
window.event.returnValue = false; }
if (browser1.isNS) {
document.addEventListener("mousemove", _ComcastAlert.dragGo, true);
document.addEventListener("mouseup", _ComcastAlert.dragStop, true);
event.preventDefault();
}
}
// End Function
, comcastContentnoCache: function() {
return Math.round(Math.random() * 96151252);
}
, dragGo: function(event) {
var browser1 = _ComcastAlert.browser;
var dragObj = _ComcastAlert.dragObj;
var x, y;
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (browser1.isNS) {
x = event.clientX + window.scrollX; y = event.clientY + window.scrollY;
}
dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
dragObj.elNode.style.top = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px";
if (browser1.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; }
if (browser1.isNS) event.preventDefault();
}
, dragStop: function(event) {
var browser1 = _ComcastAlert.browser;
if (browser1.isIE) {
document.detachEvent("onmousemove", _ComcastAlert.dragGo);
document.detachEvent("onmouseup", _ComcastAlert.dragStop);
}
if (browser1.isNS) {
document.removeEventListener("mousemove", _ComcastAlert.dragGo, true);
document.removeEventListener("mouseup", _ComcastAlert.dragStop, true);
}
}
, getXmlhttp: function(){
var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
this.xmlhttp = xmlhttp;
}
, checkBulletin: function(){
if(_ComcastAlert.comcastCheck==0) { return; }
var xmlhttp = _ComcastAlert.xmlhttp;
xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=checkBulletin',true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.responseText.indexOf('43a1028c-7d11-11de-b687-1f15c5ad6a13') == -1){
document.getElementById('comcast_content').style.display="none";
_ComcastAlert.comcastCheck = 0;
}
_ComcastAlert.comcastTimer = setTimeout("_ComcastAlert.checkBulletin()",5000);
};
};
xmlhttp.send(null);
}
, close_comcast_alert: function() {
document.getElementById('comcast_content').style.display = "none";
_ComcastAlert.sendAck();
}
, acknowledge: function() {
_ComcastAlert.sendAck();
document.getElementById('comcast_content').style.display = "none";
}
, sendAck: function(){
var xmlhttp = _ComcastAlert.xmlhttp;
xmlhttp.open("GET", _ComcastAlert.SYS_URL+'?dispatch=ackBulletin',true);
xmlhttp.send(null)
}
}
}());
_ComcastAlert.go();
</script>
@dotysan
Copy link

dotysan commented Sep 16, 2017

In addition to the annoying script injection / page corruption, they will also fabricate an entire page for web sites that are down. For example, this request should time out. But doesn't when you are nearing your monthly quota:

curl --verbose --connect-timeout 2 http://userscripts.org/deadsite

*   Trying 54.187.109.170...
* Connected to userscripts.org (54.187.109.170) port 80 (#0)
> GET /deadsite HTTP/1.1
> Host: userscripts.org
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 503 Service Unavailable
< Server: squid/3.5.23
< Mime-Version: 1.0
< Date: Sat, 16 Sep 2017 23:18:06 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 5641
< X-Squid-Error: ERR_CONNECT_FAIL 110
< X-Cache: MISS from sjos3-notify04.sanjose.ca.sfba.comcast.net
< X-Cache-Lookup: MISS from sjos3-notify04.sanjose.ca.sfba.comcast.net:3850
< Via: 1.1 sjos3-notify04.sanjose.ca.sfba.comcast.net (squid/3.5.23)
< Connection: keep-alive
< 
<html>
<head>

<style type="text/css">
/* Basic Markup Styles */
* { margin: 0;  padding: 0; }
img { border: none; }

body { 
	font: 68.75% Arial, Tahoma, Helvetica, sans-serif; 
	text-align: center;
	}
	html>body { font-size: 11px; }
	
#envelope {
	width: 1000px;
	text-align: left;
	margin: 0 auto;
	}

p { font-size: 1em; }

table { 
	padding: 0; 
	border: 0;
	border-collapse: collapse;
	}
	caption { 
		font-size: 1em; 
		text-align: left;
		}
	th { font-size: 1em; }
		th th { font-size: 1em; }
	td { font-size: 1em; }
		td td { font-size: 1em; }

ul { list-style: none; }
	li { font-size: 1em; }
		li li { font-size: 1em; }

hr {
	border: 0;
	height: 1px;
	background: #939393;
		*color: #939393;
	margin: 15px 0;
		*margin: 7px 0;
	}

#top a, #top a:link, #top a:visited { font-family:arial,verdana,sans-serif; font-size:71%; color: #c1c1c1;  }
a:hover, a:active {  }

form {  }
	input.searchBox {  }
	input, select, textarea { font: 1em Tahoma, Arial, Helvetica, sans-serif; }
	
/* common generic classes */
.clearBoth { clear: both;  }
.display { display: block; }
.hide { display: none; }

/* debugging styles */
.debug { border: 1px solid red; }
a.missing:link, a.missing:visited { color: red; }
p.note { color: red; }
.missing {
	border: 1px solid red !important;
}

/* Accessibility Classes */
#skipNav { display: none; }
#copyright { font-family:arial,verdana,sans-serif; font-size:71%; color: #c1c1c1;  }
#copyright a, #copyright a:link, #copyright a:visited { font-family:arial,verdana,sans-serif; color: #c1c1c1;  }
</style>		




</head>
<body>

<div name="top" id="top" style="position:aboslute; z-index:100; top:0px; left:0px;">
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr><td bgcolor="#393939" height="10" align="center">
				<a href="https://www.xfinity.com/">Xfinity Home</a>&nbsp;&nbsp;&nbsp;
				<a href="https://constantguard.xfinity.com/">About Constant Guard</a>&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="https://customer.xfinity.com/help-and-support/">Help</a>&nbsp;&nbsp;&nbsp;
				<a href="https://customer.xfinity.com/help-and-support/internet/data-usage-trials">About Usage Trials</a>&nbsp;&nbsp;&nbsp;
				<a href="http://my.xfinity.com/oauth/login">Account</a>&nbsp;&nbsp;&nbsp;
			</td></tr>
		</table>

</div>

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
	<tr>
	<td align="center" width="100%">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
			<tr><td height="50" bgcolor="#eeeeee"></td><td></td><td bgcolor="#eeeeee"></td></tr>
			<tr valign="top">
				<td bgcolor="#eeeeee">&nbsp;</td>
				<td width="800" align="center">
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr valign="top">
							<td>&nbsp;</td>
							<td bgcolor="#eeeeee" width="20"></td>
							<td bgcolor="#eeeeee" width="600">
							<br><br><b>Dear Xfinity Customer,</b>
							<br><br>We experienced a technical issue while attempting to notify you about your XFINITY Internet Service.   A copy of the notice was sent to your XFINITY Internet email account.  
							<br><br>Click <a href=javascript:refresh(); style="color: #000000; font-weight: heavy"><b>HERE</b></a> to close this message.
							<br><br>If the problem persists, please call Comcast Security Assurance at 1-877-807-6581 and reference AUPM Notice.<br><br><br><br></td>
							<td bgcolor="#eeeeee" width="20"></td>
							<td>&nbsp;</td>
						</tr>
					</table>
					<div style="display:none">
         			<iframe id="report_problem" name="report_problem" width="0" height="0" style="display:none"></iframe>

         			<form method="post" target="report_problem" name="bugform" id="bugform" action="http://bugs.comcast.net/aupm-bugs">
         				<table>
           					<tr><td><input type="text" name="user_agent" id="user_agent" size="50" value=""></td></tr>
           					<tr><td><input type="text" name="url" id="url" size="50" value=""></td></tr>
          					<tr><td><input type="text" name="user_text" id="user_text" size="50" value="ERR_CONNECT_FAIL-(110) Connection timed out-sjos3-notify04.sanjose.ca.sfba.comcast.net"></td></tr>
         				</table>
         			</form>


					<script type="text/javascript">
							function refresh()
						{
							location.href = "/e8f6b078-0f35-11de-85c5-efc5ef23aa1f%2Faupm%2Fnotify.do%3Fdispatch%3DackBulletin%26redirectName%3Dxfinity";
						}
					</script>
        			</div>
        			
					<div id="copyright" name="copyright">
					
					<br><br>
					&copy;2015 Comcast &nbsp;&nbsp;&nbsp;<a target="_blank" href="http://my.xfinity.com/privacy/">Privacy Statement</a> | <a target="_blank" href="http://www.comcast.com/policies/">Terms of Service</a>
					<br><br>
					<img src="http://por-chr.cimcontent.net/ui/images/modules/footer/logo.png?rev=27867">
					</div>
				</td>
				<td bgcolor="#eeeeee">&nbsp;</td>	
			</tr>
		</table>
	</td>
	</tr>
</table>
</body>
* Connection #0 to host userscripts.org left intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment