Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shellcraft.sleep template wrapping SYS_nanosleep
Accepts the time in seconds as a float argument and calls SYS_nanosleep. Fixes #1428
- Loading branch information
1 parent
f1d5afe
commit 80334e8
Showing
7 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<% | ||
import pwnlib.abi | ||
from pwnlib import shellcraft | ||
%> | ||
<%page args="seconds"/> | ||
<%docstring> | ||
Sleeps for the specified amount of seconds. | ||
|
||
Uses SYS_nanosleep under the hood. | ||
|
||
Args: | ||
seconds (int,float): The time to sleep in seconds. | ||
</%docstring> | ||
<% | ||
# struct timespec { | ||
# time_t tv_sec; /* Seconds */ | ||
# long tv_nsec; /* Nanoseconds */ | ||
# }; | ||
tv_sec = int(seconds) | ||
tv_nsec = int((seconds % 1) * 1000000000) | ||
|
||
abi = pwnlib.abi.ABI.syscall() | ||
stack = abi.stack | ||
%> | ||
/* sleep(${seconds}) */ | ||
${shellcraft.push(tv_nsec)} | ||
${shellcraft.push(tv_sec)} | ||
${shellcraft.syscall('SYS_nanosleep', stack, 0)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../common/linux/sleep.asm |