-
-
Notifications
You must be signed in to change notification settings - Fork 750
/
generate.rb
executable file
·111 lines (104 loc) · 2.62 KB
/
generate.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env ruby
templates = [
{
exam: 'OSCP',
name: 'whoisflynn improved template v3.2',
path: 'src/OSCP-exam-report-template_whoisflynn_v3.2.md'
},
{
exam: 'OSCP',
name: 'official Offensive Security template v1',
path: 'src/OSCP-exam-report-template_OS_v1.md'
},
{
exam: 'OSCP',
name: 'official Offensive Security template v2',
path: 'src/OSCP-exam-report-template_OS_v2.md'
},
{
exam: 'OSWE',
name: 'official Offensive Security template v1',
path: 'src/OSWE-exam-report-template_OS_v1.md'
},
{
exam: 'OSWE',
name: 'noraj improved template v1',
path: 'src/OSWE-exam-report-template_noraj_v1.md'
},
{
exam: 'OSCE',
name: 'official Offensive Security template v1',
path: 'src/OSCE-exam-report-template_OS_v1.md'
},
{
exam: 'OSEE',
name: 'official Offensive Security template v1',
path: 'src/OSEE-exam-report-template_OS_v1.md'
},
{
exam: 'OSWP',
name: 'official Offensive Security template v1',
path: 'src/OSWP-exam-report-template_OS_v1.md'
},
{
exam: 'OSED',
name: 'official Offensive Security template v1',
path: 'src/OSED-exam-report-template_OS_v1.md'
},
{
exam: 'OSED',
name: 'epi improved template v1',
path: 'src/OSED-exam-report-template_epi_v1.md'
},
{
exam: 'OSEP',
name: 'official Offensive Security template v1',
path: 'src/OSEP-exam-report-template_OS_v1.md'
}
]
# Choose template
puts 'Choose a template:'
templates.each_with_index do |t,i|
puts "#{i}. [#{t[:exam]}] #{t[:name]}"
end
choice = gets.chomp
src = templates[choice.to_i][:path]
exam = templates[choice.to_i][:exam]
# Enter your OS id
puts 'Enter your OS id'
print 'OS-'
osid = 'OS-' + gets.chomp
# Choose syntax highlight style
style = 'breezedark'
puts "Choose syntax highlight style [#{style}]"
choice = gets.chomp
style = choice unless choice.empty?
puts style
# Generating report
puts 'Generating report...'
pdf = "output/#{exam}-#{osid}-Exam-Report.pdf"
%x(pandoc #{src} -o #{pdf} \
--from markdown+yaml_metadata_block+raw_html \
--template eisvogel \
--table-of-contents \
--toc-depth 6 \
--number-sections \
--top-level-division=chapter \
--highlight-style #{style}
)
# Generating archive
puts 'Generating archive...'
%x(7z a output/#{exam}-#{osid}-Exam-Report.7z \
#{File.expand_path(pdf)}
)
# Optional lab report
puts 'Do you want to add an external lab report? [y/N]'
choice = gets.chomp
if choice.downcase == 'y'
puts 'Write the path of your lab PDF'
lab = gets.chomp
puts 'Updating archive...'
%x(7z a output/#{exam}-#{osid}-Exam-Report.7z \
#{File.expand_path(lab)}
)
end