-
Notifications
You must be signed in to change notification settings - Fork 18
/
http
executable file
·42 lines (29 loc) · 1.1 KB
/
http
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
#!/bin/bash
# Website: https://t3chnocat.com
# Text coloring
yellow='\033[1;33m'
red='\033[1;91m'
nc='\033[0m'
echo
echo -e "${yellow}This starts a simple http server${nc}"
echo
echo -e "${yellow}Enter the port number: ${nc}"
read port
echo
echo -e "${yellow}Enter the directory (www, winbin, <dir> or . for current directory): ${nc}"
read dir
# change tun0 to your interface if needed
ip=$(/sbin/ifconfig tun0 | grep inet | cut -d" " -f10 | head -1)
echo
echo -e "${yellow}Your URL is http://$ip:$port"
echo
if [ "$dir" = "www" ];
then cd /var/www/html && echo -e "Contents of directory:${nc}" && echo && ls && echo -e ${yellow} && python -m SimpleHTTPServer $port
elif [ "$dir" = "winbin" ];
then cd /usr/share/windows-binaries && echo -e "Contents of directory:${nc}" && echo && ls && echo -e ${yellow} && python -m SimpleHTTPServer $port
elif [ "$dir" = "." ];
then echo -e "Contents of directory:${nc}" && echo && ls && echo -e ${yellow} && python -m SimpleHTTPServer $port
else
cd $dir && echo -e "Contents of directory:${nc}" && echo && ls && echo -e ${yellow} && python -m SimpleHTTPServer $port
fi
exit 1