-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent permission error in Linux when getting viber auth data
- Loading branch information
1 parent
03c639e
commit f2b31ce
Showing
4 changed files
with
152 additions
and
18 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
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,26 @@ | ||
#!/bin/bash | ||
# Reference: https://github.com/hajzer/bash-memory-dump | ||
|
||
OS_PAGESIZE=`getconf PAGESIZE` | ||
|
||
PID=$1 | ||
PID_MAPS=/proc/$PID/maps | ||
PID_MEM=/proc/$PID/mem | ||
|
||
rm -f /tmp/viber.dmp.$PID | ||
grep rw-p $PID_MAPS | | ||
while IFS='' read -r line || [[ -n "$line" ]]; do | ||
range=`echo $line | awk '{print $1;}'` | ||
|
||
vma_start=$(( 0x`echo $range | cut -d- -f1` )) | ||
vma_end=$(( 0x`echo $range | cut -d- -f2` )) | ||
vma_size=$(( $vma_end - $vma_start )) | ||
|
||
dd_start=$(( $vma_start / $OS_PAGESIZE )) | ||
dd_bs=$OS_PAGESIZE | ||
dd_count=$(( $vma_size / $OS_PAGESIZE )) | ||
|
||
set +e | ||
dd if="$PID_MEM" bs="$dd_bs" skip="$dd_start" count="$dd_count" | ||
set -e | ||
done |
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