Last active
August 29, 2015 14:18
-
-
Save DelusionalLogic/2156895d1a08bd264ae5 to your computer and use it in GitHub Desktop.
SkypePatcher
This file contains hidden or 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
#!/bin/bash | |
i=0 | |
while read p; do | |
IFS="-" read -ra ADDR <<< "$p" | |
n="${ADDR[0]}" | |
start="${ADDR[1]}" | |
end="${ADDR[2]}" | |
echo "$start $end" | |
xxd -s "$start" -l "$(expr $end - $start)" -p skype | tr -d "\\n" | xxd -p -r -g0 > "$n.png" | |
done <output |
This file contains hidden or 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
#!/bin/bash | |
def=$1 | |
slot=$2 | |
image=$3 | |
while read p; do | |
IFS="-" read -ra ADDR <<< "$p" | |
n="${ADDR[0]}" | |
start="${ADDR[1]}" | |
end="${ADDR[2]}" | |
if [[ "$n" -eq "$slot" ]]; then | |
break | |
fi | |
done < "$def" | |
maxSize="$(expr $end - $start)" | |
echo "Max size is: $maxSize" | |
newSize=$(stat -c%s "$image") | |
echo "New size is: $newSize" | |
if [[ $newSize -gt $maxSize ]]; then | |
echo "ERROR: new size is bigger than the original" | |
echo " New: $newSize, Original: $maxSize" | |
exit 1 | |
fi | |
cat "$image" | dd of=skype bs=1 seek=$start conv=notrunc |
This file contains hidden or 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
#!/bin/env python | |
from string import find | |
from sys import argv | |
headers = [(("PNG",1), ("IEND",4))] | |
filepath = "skype" | |
outpath = "output" | |
if len(argv)>2: | |
filepath = argv[1] | |
outpath = argv[2] | |
fh = open(filepath, 'rb') | |
dat = fh.read() | |
fh.close() | |
with open(outpath, "w") as f: | |
for start,end in headers: | |
(sw, soff) = start | |
(ew, eoff) = end | |
x = 0 | |
y = 0 | |
n = 0 | |
while 1: | |
x = find(dat,sw,x+1) | |
if x<0: break | |
y = find(dat,ew,x+1) | |
if y<0: break | |
print sw,"file begins at byte",x - soff,"ends at",y - eoff | |
f.write(str(n) + "-" + str(x-soff) + "-" + str(y+len(ew)+eoff) + "\n") | |
n += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment