-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 (#2221)
* Add shellcraft.sleep template wrapping SYS_nanosleep Accepts the time in seconds as a float argument and calls SYS_nanosleep. Fixes #1428 * Update CHANGELOG * Use nanosleep wrapper Co-authored-by: Arusekk <[email protected]>
- Loading branch information
1 parent
9c83fa1
commit 8d10485
Showing
8 changed files
with
36 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
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.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 |