-
Notifications
You must be signed in to change notification settings - Fork 7
/
brute-forcer.rb
39 lines (33 loc) · 1.17 KB
/
brute-forcer.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
# coding: utf-8
require_relative 'hexagony'
require_relative 'grid'
require 'stringio'
[')', '('].each do |count_char|
(0..5).each do |inc_pos|
([*1..5]-[inc_pos]).each do |out_pos|
([*1..5]-[inc_pos,out_pos]).each do |out2_pos|
code = ' '*6
code[inc_pos] = count_char
code[out_pos] = '!'
code[out2_pos] = ';'
$stderr.puts code
(('"'..'~').to_a-"`?,@".chars).repeated_permutation(3) do |pos|
this_code = code.clone
pos.each do |c| this_code.sub!(' ',c) end
in_stream = StringIO.new('')
out_stream = StringIO.new
errored = false
begin
aborted = Hexagony.run(this_code, 0, in_stream, out_stream, 35)
rescue
next
end
if aborted && (out_stream.string =~ /^1([ \n\t,])2(\1)3/)
puts this_code
$stderr.puts this_code
end
end
end
end
end
end