check uid before executing netcat
This commit is contained in:
parent
f77f3fbe2e
commit
5af4557c03
|
@ -11,6 +11,15 @@ createsrv () {
|
|||
|
||||
nc -l "$1" <"$2" >>"$3" & exec 3>"$2"
|
||||
}
|
||||
die () {
|
||||
# $1 - error message
|
||||
printf "%s\n" $1
|
||||
exit 1
|
||||
}
|
||||
checkuid () {
|
||||
[ $(whoami) = "root" ] && \
|
||||
die "You must execute shellgopher as root."
|
||||
}
|
||||
writefile () {
|
||||
# $1 - file
|
||||
foo cat "$1" >&3
|
||||
|
@ -34,6 +43,7 @@ tmplocation=$(mktmp)
|
|||
writelocation="${tmplocation}/write"
|
||||
readlocation="${tmplocation}/read"
|
||||
|
||||
checkuid
|
||||
createsrv 70 "${writelocation}" "${readlocation}"
|
||||
printf "server created\n"
|
||||
while true; do
|
||||
|
|
Reference in New Issue