-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathror_spike.rb
More file actions
executable file
·84 lines (73 loc) · 2.68 KB
/
Copy pathror_spike.rb
File metadata and controls
executable file
·84 lines (73 loc) · 2.68 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/ruby
require 'pty'
require 'time'
puts "+-+-+-+ +-+-+-+-+-+"
puts "|R|o|R| |S|p|i|k|e|"
puts "+-+-+-+ +-+-+-+-+-+"
puts " by T.J Acton"
puts ""
if ARGV.count < 3
puts "Usage: #{__FILE__} ALL 192.168.1.1 8080"
puts "Three arguments are required - command (e.g. TRUN, or ALL), host, port"
puts "You'll need to edit this script to change the commands available if you're not exploiting vulnserver (line: 25)"
exit(2)
end
puts "Running: #{ARGV[0]}"
if ARGV[0].downcase != 'all'
commands = ["#{ARGV[0]}"]
else
commands = %w{HELP STATS RTIME LTIME SRUN RUN GMON GDOG KSTET GTER HTER LTER KSTAN}
end
host = ARGV[1]
port = ARGV[2]
log=File.open("ror_spike_notes.txt", "a")
log << "-----------------------------------------------\n"
log << "Started script: "
log << Time.now.to_i
log << "\n"
log.close
current_spk_var = ""
commands.each do |command|
output = File.open( "ror_#{command}.spk","w" )
output << "printf(\"ror_#{command}.spk : \"); //print to terminal command and filename\n"
output << "s_readline(); //print received line from server\n"
output << "s_string(\"#{command} \"); // send \"#{command} \" to program\n"
output << "s_string_variable(\"COMMAND\"); //send fuzzed string\n"
output << "s_readline();\n"
output.close
begin
PTY.spawn( "generic_send_tcp #{host} #{port} ror_#{command}.spk 0 0" ) do |stdout, stdin, pid|
begin
stdout.each do |line|
print "cmd: #{command} - "
print "SPK: #{line}"
puts "closed socked" if line.include? "closed socket"
puts "doing next command" if line.include? "2043"
if line.include? "Fuzzing Variable"
current_spk_var = line
end
if line.include? "closed socket"
log=File.open("ror_spike_notes.txt", "a")
log << current_spk_var
log << line
print "Enter Crash Condition Notes: "
notes = STDIN.gets.chomp
log << "NOTES: #{notes}"
log << "\n"
log << "[*] Reproduce with: generic_send_tcp #{host} #{port} ror_#{command}.spk 0 #{current_spk_var.split(':')[1]}\n\n"
log.close
puts "[*] Reproduce with: generic_send_tcp #{host} #{port} ror_#{command}.spk 0 #{current_spk_var.split(':')[1]}\n\n The crash condition has been logged at: ./ror_spike_notes.txt \n\n "
abort("-- Terminated. Enjoy getting your shell. --")
end
next
end
rescue Errno::EIO
end
end
puts "The child process exited!"
end
puts " |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
puts " doing next command"
puts " |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
next
end