Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'io/console'
- termcap = %x{ stty -a <"$(tty)" }
- $lines = termcap.gsub(/.*?(rows)\s*(\d+).*/m,'\\2').to_i
- $columns = termcap.gsub(/.*?(columns)\s*(\d+).*/m,'\\2').to_i
- $center_line = $lines / 2
- $center_column = $columns / 2
- @red = "\e[38;5;196;48;5;16m"
- @redbg = "\e[38;5;231;48;5;196m"
- @green = "\e[38;5;46m"
- @greenbg = "\e[42m"
- @alien = "\e[38;5;155;48;5;16m"
- @normal = "\e[0m"
- @blink = "\e[05m"
- @blinkoff = "\e[25m"
- @clear = "\e[2J"
- def setpos line,col
- "\e[#{line};#{col}H"
- end
- def setcol col
- "\e[#{col}G"
- end
- def progress title, tail='', color="\e[38;5;231;48;5;34m"
- puts
- on = "\e[1m" << color
- off = "\e[1;38;5;231;48;5;16m"
- n = 50
- str = title.center(n)
- print "\r[#{off}#{str}]#{setcol 2}"
- print on
- str.chars.each {|c|
- print c
- sleep 0.04
- }
- puts "\n#{@normal}#{tail.center(n+2)}\n\n"
- end
- def hsv2rgb(h, s, v)
- i = (h/ 120.0).floor
- frac = ((h / 120.0) - i)
- a = [1.0 - frac, frac, 0.0].rotate(-i)
- a = a.map { |x| [x * 2.0, 1.0].min }
- a = a.map { |x| v * ((1.0 - s) + x * s) }
- a.map { |x| (x * 255).round }
- end
- def format_color *v,fg_bg
- "\033[#{[38,48][fg_bg]};2;#{v*';'}m"
- end
- def format_color_hsv h,s,v,fg_bg=0
- "\033[#{[38,48][fg_bg]};2;#{hsv2rgb(h,s,v).map(&:round)*';'}m"
- end
- def printc(*v)
- print "\033[38;2;#{v*';'}m"
- end
- def printc2(fg,bg)
- print "\033[38;2;#{fg*';'}m\033[48;2;#{bg*';'}m"
- end
- def blend a,b,coef
- c = a.map.with_index {|v,i|
- (v * (1.0 - coef) + coef * b[i])
- }
- hsv2rgb(*c).map(&:round)
- end
- def fade msg, a, b, ms
- steps = (60.0 * ms / 1000.0).round
- scale = 1.0 / steps
- (0..steps).each {|i|
- c = blend(a,b,i*scale)
- print "\e[u"
- printc(*c)
- print msg+"\r"
- sleep scale
- }
- end
- def gradient a, b, s
- scale = 1.0 / s.length
- s.chars.each.with_index {|v,i|
- c = blend(a,b,i*scale)
- printc(*c)
- print v
- }
- end
- def gradient_col a, b, s, col
- scale = 1.0 / s.length
- s.chars.each.with_index {|v,i|
- c = blend(a,b,i*scale)
- printc(*c)
- print print "\e[#{i};#{col}H#{v}"
- }
- end
- @lines = termcap.gsub(/.*?(rows)\s*(\d+).*/m,'\\2').to_i
- @columns = termcap.gsub(/.*?(columns)\s*(\d+).*/m,'\\2').to_i
- @alienlang = File.read('./chars').gsub(/\s\r\n/,'').chars
- def alien_language n=100
- (0..n).each{|line|
- s = @alienlang.shuffle[0,@columns]*''
- pos = rand(@lines - 8)
- print "\e[#{pos};1H"
- bright = ((@lines-pos)/@lines.to_f)
- gradient [160+line,0.3,bright], [320-line,1,0],s
- posc = rand(@columns)
- bright = ((@columns-posc)/@columns.to_f)
- s = s[0,@lines-4]
- gradient_col [180+line,0.3,bright], [320-line,1,0.0],s,posc
- sleep 0.03
- }
- end
- class Crawler
- attr_accessor :line, :line2, :visible
- @@hsv1 = [120,1,0.5]
- @@hsv2 = [120,0.5,1]
- @@hsv3 = [120,0.95,0.2]
- @@color1 = "\e[21m" << format_color_hsv(120,1,0.8,0)+format_color_hsv(120,1,0.125,1)
- @@color2 = "\e[1m" <<
- format_color_hsv(123,0.5,1,0) <<
- format_color_hsv(122,0.85,0.35,1)
- @@color3 = "\e[38;5;22;48;20m"
- @@black = "\e[0;38;5;16m"
- def initialize(s,col,line=0)
- @s = s
- @chars = s.chars
- @col = col
- @len = s.length
- @line = line
- @line2 = @line - ($lines/2)
- @gradient = []
- @color1 = @@black
- @color2 = @@black
- @color3 = @@black
- @fade = "\e[0m"
- @visible = false
- make_gradient
- end
- def make_gradient
- scale = 1.0/@s.length
- @gradient = (0..@len).map{|i|
- fg = blend(@@hsv1,@@hsv2,i*scale)
- # bg = fg.map{|i| i / 2}
- fg = fg*';'
- # bg = bg*';'
- "\033[38;2;#{fg}m#{@s[i]}"
- }
- @gradient[-2] = format_color_hsv(120,0.5,1,0) <<
- format_color_hsv(120,0.95,0.2,1) << @s[-2] << "\e[38;0m"
- # @gradient[0] = ' '
- @gradient[-1] = @@color1+' '
- @gradient[0] = @@color1+' '
- end
- def print_pos char,os
- print "\e[#{[@line+os,0].max};#{@col}H#{char}"
- end
- def print_crawler
- @gradient[
- 0..[0, $lines - @line, @len].sort[1]
- ].each.with_index {|c,i|
- print "\e[#{[(@line+i),0].max};#{@col}H"
- print c
- }
- @line += 1
- end
- def print_crawler_end
- @gradient[
- 0,
- [0, $lines - @line, @len].sort[1]
- ].each.with_index {|c,i|
- print "\e[#{[(@line+i) % $lines,0].max};#{@col}H"
- print c
- }
- @line += 1
- end
- def print_crawler_wrap
- @gradient[
- 0..[0, $lines - @line, @len].sort[1]
- ].each.with_index {|c,i|
- print "\e[#{[(@line+i) % $lines,0].max};#{@col}H"
- print c
- }
- @line = (@line + 1 + @len) % $lines
- @line -= @len
- end
- @@half_height = $lines / 2
- def check_visible
- if @line == 1
- @color1 = @@color1
- @color2 = @@color2
- @visible = true
- end
- end
- def print_crawler2
- if !@visible
- @line = (@line+ 1) % ($lines)
- @line2 = (@line2 + 1) % ($lines)
- check_visible
- else
- @line = (@line + 1) % ($lines)
- print "\e[#{@line};#{@col}H#{@color2}#{@s[@line]}"
- print "\e[A#{@color1}\b#{@s[@line]}"
- print "\e[#{@line2};#{@col}H#{@fade} "
- @color3 = ((@line2 = (@line2 + 1) % $lines) == 0) ? @@color3 : @color3
- print "\e[#{@line2};#{@col}H#{@color3}#{@s[@line2]}"
- end
- end
- def check_visible_end
- if @line <= 1
- @color1 = @@black
- @color2 = @@black
- @visible = false
- end
- end
- def print_crawler2_end
- if @visible
- check_visible_end
- @line = (@line + 1) % ($lines)
- print "\e[#{@line};#{@col}H#{@color2}#{@s[@line]}"
- print "\e[A#{@color1}\b#{@s[@line]}"
- end
- print "\e[#{@line2};#{@col}H\e[0m "
- @line2 = (@line2 + 1) % $lines
- if @line2 <= 0
- @color3 = @@black
- print "\e[#{@line2};#{@col}H#{@color3}"
- else
- print "\e[#{@line2};#{@col}H#{@color3}#{@s[@line2]}"
- end
- end
- end
- def alien_gibberish n
- @alienlang.shuffle[0,n]*''
- end
- @ascii_gibberish = ('!'..'~').to_a << (0..10).to_a*8
- def ascii_gibberish n
- Array.new(n) {|i| @ascii_gibberish.sample}*''
- end
- @katakana = (File.read(
- './chars_katakana_half_width').gsub( /\s\r\n/,'')<<
- '012345687908080808080812345678900123456789'
- ).chars
- @matrix_gibberish = File.read('./matrix_gibberish').chars
- def matrix_gibberish n
- Array.new(n) {|i| @matrix_gibberish.sample}*''
- end
- def matrix
- crawlers = Array.new($columns) {|i| Crawler.new(ascii_gibberish($lines),i,-rand($lines))}
- center = ($columns/2).round
- until (crawlers[center].visible) do
- crawlers[center].print_crawler2
- end
- 20.times {
- crawlers[center].print_crawler2
- sleep 0.1
- }
- ($lines+1).times {
- crawlers.each{|x|
- x.print_crawler2
- }
- sleep 0.075
- }
- ($lines+$lines/2).times {
- crawlers.each{|x|
- x.print_crawler2_end
- }
- sleep 0.0875
- }
- end
- def type s, sec=0.06, wait=0.9
- print "#{@green}\r> \e[K"
- print "\e]50;CursorShape=0\C-G"
- sleep wait
- s.chars.each {|c| print c ; sleep sec }
- puts "\e[0m\e]50;CursorShape=1\C-G"
- end
- def clear_lines
- print "\e[2A\r\e[K\e[1A\e[K\e[1A\e[K\e[1A\e[K"
- end
- system('clear')
- print "\e[38;5;46m"
- banner = `figlet -f big -t "LEGION HACKER"` + "\n\n\n\n\n"
- print banner
- sleep 5
- print "\e[10;0H"
- progress "LOADING", "READY"
- print "\e[14;0H"
- target = "CIA"
- type "HACK #{target.upcase}"
- print "\e[2A\r\e[K\e[1A\e[K\e[1A\e[K\e[1A\e[K\e[1A"
- puts "\n💀💀💀💀💀\e[1;05m#{@red} WARNING \e[0m💀💀💀💀💀"
- puts "\e[31m YOU ARE ABOUT TO HACK #{target}.#{@green}"
- print " Do you wish to continue?"
- print "\e[14;0H"
- sleep 1.2
- type 'CONTINUE',0.08,0.5
- clear_lines
- progress 'Hacking '+target, "\e[1;05m#{@red}#{' RESTRICTED ACCESS ONLY '.center(50,'*')}\e[0m"
- type 'CRACK PASSWORD && OVERRIDE ALL SECURITY',0.08,0.2
- sleep 0.25
- alien_language 50
- stra = (1..$lines).map{|i| setpos(i,0) << "\e[K\r"}
- banner.split(/\n/).each.with_index{|s,i| stra[i] << s }
- address = (0..3).map {|i| rand(255)}*'.'
- stra[10] << "#{@green}" << "ACCESS GRANTED".center(50)
- stra[11] << "#{@normal}" <<
- "Connected to #{target} at #{address}".center(50) <<
- @green
- print @green
- stra.shuffle.each {|s|
- print s
- sleep 0.035
- }
- print "\e[14;0H"
- type 'SCAN DATABASE && DOWNLOAD RECORDS'
- clear_lines
- progress 'Scanning database', "78651 records found."
- print "\e[4A"
- # clear_lines
- progress 'Downloading records', "Download complete."
- type 'ANALYZE DATA && ENHANCE'
- clear_lines
- progress 'Analyzing data', "237 Visual Basic GUIs found."
- sleep 0.25
- print "\e[4A"
- progress 'Enhancing', "3,359,974 Visual Basic GUIs found."
- sleep 0.25
- type 'DECRYPT DATA'
- clear_lines
- decrypted = " WE ARE THE ILLUMINATI "
- print "\e[10;0H\r\e[s"
- 181.times {|i|
- s = matrix_gibberish(32) << ' '*8
- print "\e[u"
- gradient [6*i,0.5,1.0], [10*i,1.0,1.0],s
- len = (decrypted.length * (i/180.0)).round
- print "\e[u\n\r\e[K"
- print decrypted[0..len] << s[0] << "\e[7m \e[27m\n\r\e[K"
- sleep 0.05
- }
- print "\e[11;0H\r#{@red}#{decrypted} "
- print "\e[14;0H"
- type 'UPLOAD VIRUS'
- clear_lines
- progress '💀💀💀💀 Uploading virus 💀💀💀💀', "Virus installation successful.", @redbg
- type 'INITIALIZE SELF-DESTRUCT SEQUENCE'
- clear_lines
- progress '💀💀💀💀 INITIALIZING SELF-DESTRUCT 💀💀💀💀', "Self-destruction in progress.", @redbg
- matrix
- print @clear
- hashes = '#'*($columns)
- str = " HACKING COMPLETE "
- press_any_key = " PRESS ANY KEY TO CONTINUE ".center($columns,'#')
- linestart = $center_line-2
- (0..255).each {|i|
- print "\e[#{linestart};0H"
- print "\e[38;2;0;#{i};0m" << hashes
- print "\e[#{linestart+1};0H"
- print "#{hashes}\e"
- print "\e[#{linestart+1};#{($columns - str.length) / 2 + 1}H#{@blink}#{str}#{@blinkoff}"
- print "\e[#{linestart+2};0H" << press_any_key
- print "\e[#{linestart+3};0H" << hashes
- print "\r"
- sleep 0.002
- }
- x = STDIN.getc
Advertisement
Add Comment
Please, Sign In to add comment