Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/lib/rpm
File: rpm2cpio.sh
#!/bin/sh -efu
[0] Fix | Delete
[1] Fix | Delete
fatal() {
[2] Fix | Delete
echo "$*" >&2
[3] Fix | Delete
exit 1
[4] Fix | Delete
}
[5] Fix | Delete
[6] Fix | Delete
pkg="$1"
[7] Fix | Delete
[ -n "$pkg" -a -e "$pkg" ] ||
[8] Fix | Delete
fatal "No package supplied"
[9] Fix | Delete
[10] Fix | Delete
_dd() {
[11] Fix | Delete
local o="$1"; shift
[12] Fix | Delete
dd if="$pkg" skip="$o" iflag=skip_bytes status=none $*
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
calcsize() {
[16] Fix | Delete
offset=$(($1 + 8))
[17] Fix | Delete
[18] Fix | Delete
local i b b0 b1 b2 b3 b4 b5 b6 b7
[19] Fix | Delete
[20] Fix | Delete
i=0
[21] Fix | Delete
while [ $i -lt 8 ]; do
[22] Fix | Delete
b="$(_dd $(($offset + $i)) bs=1 count=1)"
[23] Fix | Delete
[ -z "$b" ] &&
[24] Fix | Delete
b="0" ||
[25] Fix | Delete
b="$(exec printf '%u\n' "'$b")"
[26] Fix | Delete
eval "b$i=\$b"
[27] Fix | Delete
i=$(($i + 1))
[28] Fix | Delete
done
[29] Fix | Delete
[30] Fix | Delete
rsize=$((8 + ((($b0 << 24) + ($b1 << 16) + ($b2 << 8) + $b3) << 4) + ($b4 << 24) + ($b5 << 16) + ($b6 << 8) + $b7))
[31] Fix | Delete
offset=$(($offset + $rsize))
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
case "$(_dd 0 bs=8 count=1)" in
[35] Fix | Delete
"$(printf '\355\253\356\333')"*) ;; # '\xed\xab\xee\xdb'
[36] Fix | Delete
*) fatal "File doesn't look like rpm: $pkg" ;;
[37] Fix | Delete
esac
[38] Fix | Delete
[39] Fix | Delete
calcsize 96
[40] Fix | Delete
sigsize=$rsize
[41] Fix | Delete
[42] Fix | Delete
calcsize $(($offset + (8 - ($sigsize % 8)) % 8))
[43] Fix | Delete
hdrsize=$rsize
[44] Fix | Delete
[45] Fix | Delete
case "$(_dd $offset bs=3 count=1)" in
[46] Fix | Delete
"$(printf '\102\132')"*) _dd $offset | bunzip2 ;; # '\x42\x5a'
[47] Fix | Delete
"$(printf '\037\213')"*) _dd $offset | gunzip ;; # '\x1f\x8b'
[48] Fix | Delete
"$(printf '\375\067')"*) _dd $offset | xzcat ;; # '\xfd\x37'
[49] Fix | Delete
"$(printf '\135\000')"*) _dd $offset | unlzma ;; # '\x5d\x00'
[50] Fix | Delete
"$(printf '\050\265')"*) _dd $offset | unzstd ;; # '\x28\xb5'
[51] Fix | Delete
*) fatal "Unrecognized rpm file: $pkg" ;;
[52] Fix | Delete
esac
[53] Fix | Delete
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function