Permalink
Browse files

Merge pull request #1182 from leommxj/dev

fix:shellcraft mips dupsh wrong redirect
  • Loading branch information...
zachriggle committed Feb 2, 2019
2 parents 4a4b4dc + 58967dd commit 5fa4fcd051ee75fe9df548ea1adced44ed579ec8
@@ -0,0 +1,20 @@
<% from pwnlib.shellcraft import common %>
<% from pwnlib.shellcraft.mips.linux import dup2 %>
<% from pwnlib.shellcraft.mips import mov %>
<%page args="sock = '$s0'"/>
<%docstring>
Args: [sock (imm/reg) = s0]
Duplicates sock to stdin, stdout and stderr
</%docstring>
<%
dup = common.label("dup")
looplabel = common.label("loop")
%>

/* dup() file descriptor ${sock} into stdin/stdout/stderr */
${dup}:
${mov('$t0',2)}
${looplabel}:
${dup2(sock,'$t0')}
bgtz $t0,${looplabel}
addi $t0,-1
@@ -6,6 +6,6 @@ Args: [sock (imm/reg) = s0 ]
</%docstring>


${linux.dup(sock)}
${linux.dupio(sock)}

${linux.sh()}

0 comments on commit 5fa4fcd

Please sign in to comment.