-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffe
executable file
·65 lines (65 loc) · 1.24 KB
/
ffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash
# File Footer Extractor 0.1
# Under Waqf License
# By Mosaab Alzoubi (moceap@hotmail.com - facebook.com/moceap)
# Almasa Project
# 1434-3-30
#---------------------------------------------------------------
arg="$@"
first="$1"
ftmp="$HOME/.ftmp"
if [ -e "$ftmp" ]
then rm -rf "$ftmp"
fi
mkdir "$ftmp"
if [ "$first" = "0" ]
then exit
fi
n=0
error()
{
echo "Enter one of (2,4) and space before file name to calculate.
File Footer Extractor 0.1
By :
Almasa Project
Mosaab Hosni Alzoubi
moceap@hotmail.com - facebook.com/moceap"
exit
}
if [ "$arg" = "" ]
then error
fi
for i in $(hexdump -C "$(echo "$arg" | sed "s:$first ::g")" | tail -n 3)
do
if [ "$(echo $i | cut -c 3)" = "" ]
then echo $i
fi
done | tail -n 4 | while read line
do
let "n= $n + 1"
if [ $n = 1 ]
then echo $line > "$ftmp/71"
elif [ $n = 2 ]
then echo $line > "$ftmp/72"
elif [ $n = 3 ]
then echo $line > "$ftmp/73"
elif [ $n = 4 ]
then echo $line > "$ftmp/74"
fi
done
s0='\x'
s1=$(cat "$ftmp/71")
s2=$(cat "$ftmp/72")
s3=$(cat "$ftmp/73")
s4=$(cat "$ftmp/74")
end2="$s0$s3$s0$s4"
end4="$s0$s1$s0$s2$s0$s3$s0$s4"
if [ "$first" = "2" ]
then echo $end2
elif [ "$first" = "4" ]
then echo $end4
else error
fi
if [ -e "$ftmp" ]
then rm -rf "$ftmp"
fi