-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsmb
More file actions
executable file
·52 lines (38 loc) · 1.5 KB
/
smb
File metadata and controls
executable file
·52 lines (38 loc) · 1.5 KB
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
#!/bin/bash
# Website: https://t3chnocat.com
# Text coloring
yellow='\033[1;33m'
red='\033[1;91m'
nc='\033[0m'
### User variables start
# set this to the location of your smbserver.py from impacket
smbserver=/usr/local/bin/impacket/examples/smbserver.py
### User variables end
share=$1
dir=$2
if [ -z "$1" ]
then
echo
echo -e "${yellow}This starts a simple SMB server${nc}"
echo
echo -e "${yellow}Usage: smb <sharename> <directory to be shared>${nc}"
echo
echo -e "${yellow}Directory choices are 'www'(/var/www/html), 'winbin'(/usr/share/windows-binaries), '.'(current directory) or enter a directory you wish to share${nc}"
echo
exit 1
fi
# change tun0 to your interface if needed
ip=$(/sbin/ifconfig tun0 | grep inet | cut -d" " -f10 | head -1)
echo
echo -e "${yellow}Your share is \\\\\\$ip\\\\$share${nc}"
echo
if [ "$dir" = "www" ];
then echo -e "${yellow}Contents of directory:${nc}" && echo && ls /var/www/html && echo && python $smbserver $share /var/www/html -smb2support
elif [ "$dir" = "winbin" ];
then echo -e "${yellow}Contents of directory:${nc}" && echo && ls /usr/share/windows-binaries && echo && python $smbserver $share /usr/share/windows-binaries -smb2support
elif [ "$dir" = "." ];
then echo -e "${yellow}Contents of directory:${nc}" && echo && ls && echo && python $smbserver $share . -smb2support
else
echo -e "${yellow}Contents of directory:${nc}" && echo && ls $dir && echo && python $smbserver $share $dir -smb2support
fi
exit 1