dsstjqsr631426 2018-10-03 09:32
浏览 75

扩展中未显示任何输出

I got stuck in the project where i want to detect phishing website using machine learning. I have Extension but there is no output shown. I am using windows operating system.

clientServer.php

<?php
header("Access-Control-Allow-Origin: *");
$site=$_POST['url'];
$html = file_get_contents($site);
echo $html;
$bytes=file_put_contents('markup.txt', $html);
//$a=exec('/usr/bin/python /opt/lampp/htdocs/BE/test.py '.$site.' 2>&1 ');
$a=exec('/wamp64/www/test.py 2>&1'  ,$site);
echo $a;
?>

popup.js

function transfer(){    
    var tablink;
    chrome.tabs.getSelected(null,function(tab) {
        tablink = tab.url;
        //alert(tablink);
        $("#p1").text("The URL being tested is - "+tablink);

    var xhr=new XMLHttpRequest();
    //alert("hii");
    //var tablink='';   
    //var safe = document.URL;
    params="url="+tablink;
    alert(params);
    var markup = "url="+tablink+"&html="+document.documentElement.innerHTML;
    xhr.open("POST","http://localhost/clientServer.php", true);
    xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhr.send(markup);
    alert(xhr.responseText);
    $("#div1").text(xhr.responseText);  
    return xhr.responseText;
    /*if(xhr.responseText==6)
    {
        return "safe";
    }
    return "nooooo";*/
    });
}


$(document).ready(function(){
    $("button").click(function(){   
    var val = transfer();
//  $("#p1").text(val);
        });
});

chrome.tabs.getSelected(null,function(tab) {
    var tablink = tab.url;
    $("#p1").text("The URL being tested is - "+tablink);
});

popup.html

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="popup.js" type = "text/javascript"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>

<div><h2> Check your WebPage </h2></div>
<div id = "p1"></div>
<p>Find out now...<br><sup>&darr;</sup></p>
<div><button class="button" ><span>Safe or No?</span></button>
<div id="div1"></div>
</div>
</body>
</html>

I have put clientServer.php in www folder of wamp and also test.py that is my python file in wamp folder.

See the extension, when i click on the safe/not button it does not show anything enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog