doupin5408 2015-03-11 23:21
浏览 51

使用curl php时出错? [关闭]

#!/usr/bin/php -f
Notice: Undefined variable: argv in C:\xampp\htdocs\test\admin-ajax.php on line 12

This error message comes with my when I tried to get the code below run using localhost server ( Xammp on windows7 ). It is a PHP curl exploit which has created by the tool RIPS.

{
 #!/usr/bin/php -f
<?php
#Userinput reaches sensitive sink when function screen_icon() is called.
# template.php curl exploit
#

//
// HTTP GET,

//

$target = $argv[1];

$username = "";
$password = "";

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, "http://localhost/wordpress3/wp-admin/admin-ajax.php?post_type=22");
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 3);
curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 3);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie_$target");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$buf = curl_exec ($ch);
curl_close($ch);
unset($ch);

echo $buf;



?> }

Any suggestion to get this problem solved?

  • 写回答

1条回答 默认 最新

  • dongtang1910 2015-03-11 23:46
    关注

    In a unix system the line #!/usr/bin/php is called shebang line because this combination of symbols #! that is called she bang.

    The purpose of the she bang is to specify the interpreter of your script when you run it as a program.

    So this it means that this script is made to be called and executed by command line.

    The line which generate the error $target = $argv[1]; actually it take the second argument you put in the command line.

    Eg:

    test\admin-ajax.php  site.com
            ^               ^
          argv[0]         argv[1]
    

    But because you are not calling this script from command line but from browser it rises an error because the argv array is not initialised.

    argv documentation

    shebang wiki

    评论

报告相同问题?

悬赏问题

  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C