Browse Source

Add a resource script for running session tests

James Lee 6 years ago
parent
commit
d4198fdadb
1 changed files with 33 additions and 0 deletions
  1. 33
    0
      test/scripts/test-sessions.rc

+ 33
- 0
test/scripts/test-sessions.rc View File

@@ -0,0 +1,33 @@
1
+<% old_mod = active_module %>
2
+
3
+sessions -v
4
+
5
+<ruby>
6
+def run_for_session(modname, id)
7
+  print_line(modname)
8
+  run_single("use #{modname}")
9
+  run_single("set SESSION #{id}")
10
+  run_single("run")
11
+end
12
+
13
+framework.sessions.each do |id, s|
14
+  if s.type == 'meterpreter'
15
+    run_for_session("post/test/meterpreter", id)
16
+
17
+    if s.sys.config.sysinfo["OS"] =~ /win/in
18
+      run_for_session("post/test/registry", id)
19
+      run_for_session("post/test/services", id)
20
+    else
21
+      run_for_session("post/test/unix", id)
22
+    end
23
+
24
+    if s.railgun
25
+      run_for_session("post/test/railgun_reverse_lookups", id)
26
+    end
27
+  end
28
+  run_for_session("post/test/file", id)
29
+end
30
+</ruby>
31
+
32
+<%= old_mod ? "use #{old_mod.refname}" : "back" %>
33
+

Loading…
Cancel
Save