| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <meta charset="utf-8">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.css">
- <script src="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.js"></script>
- <title>ArOZ Portable Scanner</title>
- <script src="jquery.min.js"></script>
- </head>
- <body>
- <div class="ts container">
- <br>
- <div class="ts segment">
- <h4>ArOZ Portable Software Scanner</h4>
- <a href="index.php">Back / Cancel Scan</a><br>
- This tool can only scan for php script with allow origin enabled. (Usually ArOZ Online System come with build in scannable script)<br>
- If that is not the case, please put a "hb.php" under your_ip_address_here/AOB/hb.php with allow origin *<br>
- Your LAN IP is: <p id="list">Loading</p>
- </div>
- <div class="ts primary segment">
- <p id="debug"></p>
- </div>
- </div>
- <script>
- $(document).ready(function(){
- GrapIP();
- setTimeout(function() {
- StartWebWorker();
- }, 2000);
- });
- var StartedRequest = 0;
- var detectedUnits = 0;
- function StartWebWorker(){
- var ip = $("#list").html();
- var webWorkers = [];
- if (ip.includes("ifconfig")){
- $("#debug").append("[info] This browser is not supported.<br>");
- return;
- }
- if (typeof(Worker) !== "undefined") {
- $("#debug").append("[info] Web Worker Exists. IP Scanning Started.<br>");
- //The browser support everything and ready to start scanning
- var ipg = ip.split(".");
- var header = ipg[0] + "." + ipg[1] + "." + ipg[2] + "."; //a.b.c.
-
- for (var i=1; i < 255;i++){
- GetWorkingOrNot(header + i);
- StartedRequest++;
- }
-
- $("#debug").append("[info] Scan done. Waiting for reply...<br>");
- } else {
- $("#debug").html("[info] Error. Web Worker not supported.");
- }
- }
- function GetWorkingOrNot(ip){
- $.ajax({url: "http://" + ip + "/AOB/hb.php",
- type: "HEAD",
- timeout:5000,
- statusCode: {
- 200: function (response) {
- $.get( "http://" + ip + "/AOB/hb.php", function(data) {
- $("#debug").append("[OK]" +ip + "<br>");
- $("#debug").append("<a href='http://" +ip + "/AOB/' target='_blank'><i class='caret right icon'></i>Click here to redirect</a><br>");
- if (data.split(",").length == 4){
- $("#debug").append('[UUID] ' + data.split(",")[2] + '<br>');
- }else{
- $("#debug").append('[Warning] Incorrectly formatted GUID. Probably an experimental build?<br>');
- }
- window.detectedUnits++;
- });
- },
- 400: function (response) {
- $("#debug").append("[NOT FIND]" +ip + "<br>");
- },
- 0: function (response) {
- //$("#debug").append("[DROPPED]" +ip + "<br>");
- }
- },
- complete: function(data) {
- window.StartedRequest--;
- if (window.StartedRequest == 0){
- if (detectedUnits == 0){
- $("#debug").append("[info] No device found in this local area network.<br> Click <a href=''>here</a> to rescan.<br>");
- }
- $("#debug").append("[info] Scan done. All Asynchronous JavaScript And XML request completed.<br>");
- }
- }
- });
- }
- function GrapIP(){
- // 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.getElementById('list').textContent = 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.getElementById('list').innerHTML = "<code>ifconfig | grep inet | grep -v inet6 | cut -d\" \" -f2 | tail -n1</code>";
- document.getElementById('list').nextSibling.textContent = "In Chrome and Firefox your IP should display automatically, by the power of WebRTCskull.";
-
- //Callback to next function
-
- }
-
- }
- </script>
- </body></html>
|