wibrfake-brk 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.dockerignore +48 -0
- data/.gitattributes +19 -0
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/ci.yml +90 -0
- data/.rubocop.yml +8 -0
- data/.ruby-version +1 -0
- data/Dockerfile +69 -0
- data/Gemfile +68 -0
- data/README.md +188 -0
- data/Rakefile +6 -0
- data/app/assets/config/manifest.js +5 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/2024-12-30-07:58:34-screenshot.png +0 -0
- data/app/assets/images/facebook/facebook-logo.svg +3 -0
- data/app/assets/images/google/googlelogo_color_272x92dp.png +0 -0
- data/app/assets/images/instagram/app-store.png +0 -0
- data/app/assets/images/instagram/google-play.png +0 -0
- data/app/assets/images/instagram/instagram-logo.png +0 -0
- data/app/assets/images/instagram/screenshot1.png +0 -0
- data/app/assets/images/instagram/screenshot2.png +0 -0
- data/app/assets/images/instagram/screenshot3.png +0 -0
- data/app/assets/images/instagram/screenshot4.png +0 -0
- data/app/assets/images/nauta_etecsa/CUBADEBATE.jpg +0 -0
- data/app/assets/images/nauta_etecsa/CUBAEDUCA.jpg +0 -0
- data/app/assets/images/nauta_etecsa/CUBARTE.jpg +0 -0
- data/app/assets/images/nauta_etecsa/CUBASI.jpg +0 -0
- data/app/assets/images/nauta_etecsa/ECURED.jpg +0 -0
- data/app/assets/images/nauta_etecsa/OFERTAS.jpg +0 -0
- data/app/assets/images/nauta_etecsa/PAPELETA.jpg +0 -0
- data/app/assets/images/nauta_etecsa/contenedor_bg.jpg +0 -0
- data/app/assets/images/nauta_etecsa/etecsa.jpg +0 -0
- data/app/assets/images/nauta_etecsa/nauta_wifi.jpg +0 -0
- data/app/assets/images/nauta_hogar/CUBADEBATE.jpg +0 -0
- data/app/assets/images/nauta_hogar/CUBAEDUCA.jpg +0 -0
- data/app/assets/images/nauta_hogar/CUBARTE.jpg +0 -0
- data/app/assets/images/nauta_hogar/CUBASI.jpg +0 -0
- data/app/assets/images/nauta_hogar/ECURED.jpg +0 -0
- data/app/assets/images/nauta_hogar/OFERTAS.jpg +0 -0
- data/app/assets/images/nauta_hogar/PAPELETA.jpg +0 -0
- data/app/assets/images/nauta_hogar/banner_hogar.png +0 -0
- data/app/assets/images/wibrfake/Breaker-Wallpaper1.jpg +0 -0
- data/app/assets/images/wibrfake/mac-list-parameter.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-100x100.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-32x32.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-48x48.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-apfake-on.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-apfake-set-basic.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-apfake-show.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-help.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-hostpot.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-init.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-init2.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-login-basic.jpg +0 -0
- data/app/assets/images/wibrfake/wibrfake-mac-list.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-mac-ramset-oui.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-mac-ramset.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-mac-set.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-mac-show.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-need-signin.jpg +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-active.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-init.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-list.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-new.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-rename.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-session-save.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-web-server-apfake.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-web-server-on.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-web-server-show.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-wkdump-loaded.png +0 -0
- data/app/assets/images/wibrfake/wibrfake-wkdump.png +0 -0
- data/app/assets/images/wibrfake/wibrfake.png +0 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/assets/stylesheets/basic/page_basic.css +0 -0
- data/app/assets/stylesheets/facebook/page_facebook.css +93 -0
- data/app/assets/stylesheets/google/page_google.css +137 -0
- data/app/assets/stylesheets/instagram/page_instagram.css +94 -0
- data/app/assets/stylesheets/nauta_etecsa/page_nauta.css +325 -0
- data/app/assets/stylesheets/nauta_hogar/page_nauta.css +469 -0
- data/app/assets/stylesheets/wibrfake/page_wibrfake.css +1181 -0
- data/app/assets/stylesheets/wibrfake/page_wibrfake_about.css +486 -0
- data/app/channels/application_cable/channel.rb +4 -0
- data/app/channels/application_cable/connection.rb +4 -0
- data/app/controllers/application_controller.rb +15 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/sessions_controller.rb +111 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/sessions_helper.rb +2 -0
- data/app/javascript/application.js +3 -0
- data/app/javascript/bootstrap.bundle.min.js +7 -0
- data/app/javascript/controllers/application.js +9 -0
- data/app/javascript/controllers/hello_controller.js +7 -0
- data/app/javascript/controllers/index.js +4 -0
- data/app/javascript/google/page_google.js +50 -0
- data/app/javascript/incorrect3.js +29 -0
- data/app/javascript/page_wibrfake.js +50 -0
- data/app/javascript/page_wibrfake_about.js +147 -0
- data/app/jobs/application_job.rb +7 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/user.rb +6 -0
- data/app/views/layouts/application.html.erb +33 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/pwa/manifest.json.erb +22 -0
- data/app/views/pwa/service-worker.js +26 -0
- data/app/views/sessions/basic/basic.html.erb +21 -0
- data/app/views/sessions/facebook/facebook.html.erb +132 -0
- data/app/views/sessions/google/google.html.erb +72 -0
- data/app/views/sessions/index.html.erb +11 -0
- data/app/views/sessions/instagram/instagram.html.erb +69 -0
- data/app/views/sessions/nauta_etecsa/nauta_etecsa.html.erb +97 -0
- data/app/views/sessions/nauta_hogar/nauta_hogar.html.erb +135 -0
- data/app/views/sessions/wibrfake/about/about.html.erb +164 -0
- data/app/views/sessions/wibrfake/wibrfake.html.erb +417 -0
- data/bin/.names.rb.swp +0 -0
- data/bin/brakeman +7 -0
- data/bin/bundle +114 -0
- data/bin/docker-entrypoint +13 -0
- data/bin/google.wkdump +3 -0
- data/bin/importmap +4 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/bin/rubocop +8 -0
- data/bin/setup +37 -0
- data/bin/wibrfake +20 -0
- data/config/application.rb +26 -0
- data/config/boot.rb +4 -0
- data/config/cable.yml +10 -0
- data/config/credentials.yml.enc +1 -0
- data/config/database.yml +16 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +85 -0
- data/config/environments/production.rb +105 -0
- data/config/environments/test.rb +67 -0
- data/config/icons/application-x-wkdump.xml +13 -0
- data/config/icons/hicolor/16x16/mimetypes/application-x-wkdump.png +0 -0
- data/config/icons/hicolor/32x32/mimetypes/application-x-wkdump.png +0 -0
- data/config/icons/hicolor/48x48/mimetypes/application-x-wkdump.png +0 -0
- data/config/icons/hicolor/icon-theme.cache +0 -0
- data/config/icons/hicolor/index.theme +20 -0
- data/config/icons/wkdump.desktop +5 -0
- data/config/importmap.rb +7 -0
- data/config/initializers/assets.rb +12 -0
- data/config/initializers/content_security_policy.rb +25 -0
- data/config/initializers/devise.rb +313 -0
- data/config/initializers/filter_parameter_logging.rb +8 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/permissions_policy.rb +13 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/en.yml +31 -0
- data/config/puma.rb +35 -0
- data/config/routes.rb +12 -0
- data/config/storage.yml +34 -0
- data/config.ru +6 -0
- data/db/development.sqlite3 +0 -0
- data/db/schema.rb +14 -0
- data/ext/wibrfake/extconf.rb +3 -0
- data/ext/wibrfake/wibrfake.h +0 -0
- data/images/ouilist.png +0 -0
- data/images/wibrfakehelp.png +0 -0
- data/images/wibrfakeinit.png +0 -0
- data/lib/assets/.keep +0 -0
- data/lib/tasks/.keep +0 -0
- data/lib/wibrfake/Config/ipaddr.rb +71 -0
- data/lib/wibrfake/Config/options.rb +98 -0
- data/lib/wibrfake/Config/security_wpa.rb +43 -0
- data/lib/wibrfake/DataBase/howuis.db +0 -0
- data/lib/wibrfake/DataBase/ouis.db +0 -0
- data/lib/wibrfake/DataBase/ouis.rb +24 -0
- data/lib/wibrfake/DataBase/rename.rb +15 -0
- data/lib/wibrfake/DataBase/show.rb +18 -0
- data/lib/wibrfake/Dnsmasq/dhcp.rb +149 -0
- data/lib/wibrfake/Dnsmasq/dhcp_prueba.rb +135 -0
- data/lib/wibrfake/Dnsmasq/dns.rb +34 -0
- data/lib/wibrfake/Dnsmasq/dns_prueba.rb +36 -0
- data/lib/wibrfake/Dnsmasq/dnsmasq.rb +33 -0
- data/lib/wibrfake/Listing/apfake.rb +28 -0
- data/lib/wibrfake/Listing/clients.rb +76 -0
- data/lib/wibrfake/Listing/ouis.rb +53 -0
- data/lib/wibrfake/Listing/process.rb +14 -0
- data/lib/wibrfake/Listing/sessions.rb +47 -0
- data/lib/wibrfake/Listing/web_server.rb +17 -0
- data/lib/wibrfake/Listing/wireless.rb +30 -0
- data/lib/wibrfake/Logs/credentials.log +59 -0
- data/lib/wibrfake/NetworkInterface/ip-routing.rb +99 -0
- data/lib/wibrfake/NetworkInterface/mac.rb +114 -0
- data/lib/wibrfake/NetworkInterface/monitor.rb +44 -0
- data/lib/wibrfake/NetworkInterface/ouis.db +0 -0
- data/lib/wibrfake/Process/id.rb +11 -0
- data/lib/wibrfake/Process/pids.log +5 -0
- data/lib/wibrfake/Process/pkill.rb +124 -0
- data/lib/wibrfake/Process/processes.rb +76 -0
- data/lib/wibrfake/Rails/login.rb +20 -0
- data/lib/wibrfake/Rails/routes.rb +76 -0
- data/lib/wibrfake/Rails/service.rb +58 -0
- data/lib/wibrfake/Rails/service_usage.rb +46 -0
- data/lib/wibrfake/Sessions/session.rb +188 -0
- data/lib/wibrfake/String/string.rb +109 -0
- data/lib/wibrfake/Tmp/config.yml +1 -0
- data/lib/wibrfake/config.rb +24 -0
- data/lib/wibrfake/help.rb +107 -0
- data/lib/wibrfake/optionpr.rb +68 -0
- data/lib/wibrfake/run.rb +9 -0
- data/lib/wibrfake/ty/apld.rb +110 -0
- data/lib/wibrfake/ty/prompt/answers_collector.rb +78 -0
- data/lib/wibrfake/ty/prompt/block_paginator.rb +59 -0
- data/lib/wibrfake/ty/prompt/choice.rb +147 -0
- data/lib/wibrfake/ty/prompt/choices.rb +129 -0
- data/lib/wibrfake/ty/prompt/confirm_question.rb +158 -0
- data/lib/wibrfake/ty/prompt/const.rb +17 -0
- data/lib/wibrfake/ty/prompt/converter_dsl.rb +21 -0
- data/lib/wibrfake/ty/prompt/converter_registry.rb +69 -0
- data/lib/wibrfake/ty/prompt/converters.rb +182 -0
- data/lib/wibrfake/ty/prompt/distance.rb +49 -0
- data/lib/wibrfake/ty/prompt/enum_list.rb +433 -0
- data/lib/wibrfake/ty/prompt/errors.rb +31 -0
- data/lib/wibrfake/ty/prompt/evaluator.rb +29 -0
- data/lib/wibrfake/ty/prompt/expander.rb +321 -0
- data/lib/wibrfake/ty/prompt/keypress.rb +98 -0
- data/lib/wibrfake/ty/prompt/list.rb +589 -0
- data/lib/wibrfake/ty/prompt/mask_question.rb +96 -0
- data/lib/wibrfake/ty/prompt/multi_list.rb +224 -0
- data/lib/wibrfake/ty/prompt/multiline.rb +72 -0
- data/lib/wibrfake/ty/prompt/paginator.rb +111 -0
- data/lib/wibrfake/ty/prompt/question/checks.rb +105 -0
- data/lib/wibrfake/ty/prompt/question/modifier.rb +96 -0
- data/lib/wibrfake/ty/prompt/question/validation.rb +72 -0
- data/lib/wibrfake/ty/prompt/question.rb +391 -0
- data/lib/wibrfake/ty/prompt/result.rb +42 -0
- data/lib/wibrfake/ty/prompt/selected_choices.rb +77 -0
- data/lib/wibrfake/ty/prompt/slider.rb +286 -0
- data/lib/wibrfake/ty/prompt/statement.rb +55 -0
- data/lib/wibrfake/ty/prompt/suggestion.rb +113 -0
- data/lib/wibrfake/ty/prompt/symbols.rb +89 -0
- data/lib/wibrfake/ty/prompt/test.rb +36 -0
- data/lib/wibrfake/ty/prompt/timer.rb +75 -0
- data/lib/wibrfake/ty/prompt/utils.rb +42 -0
- data/lib/wibrfake/ty/prompt/version.rb +7 -0
- data/lib/wibrfake/ty/prompt.rb +589 -0
- data/lib/wibrfake/version.rb +5 -0
- data/lib/wibrfake/wibrfake_cli.rb +683 -0
- data/log/.keep +0 -0
- data/pruebas/daemon1.pid +1 -0
- data/pruebas/daemon2.pid +1 -0
- data/pruebas/daemons.rb +44 -0
- data/public/404.html +67 -0
- data/public/406-unsupported-browser.html +66 -0
- data/public/422.html +67 -0
- data/public/500.html +66 -0
- data/public/icon.png +0 -0
- data/public/icon.svg +3 -0
- data/public/robots.txt +1 -0
- data/storage/.keep +0 -0
- data/test/application_system_test_case.rb +5 -0
- data/test/channels/application_cable/connection_test.rb +13 -0
- data/test/controllers/.keep +0 -0
- data/test/controllers/sessions_controller_test.rb +7 -0
- data/test/fixtures/files/.keep +0 -0
- data/test/fixtures/users.yml +11 -0
- data/test/helpers/.keep +0 -0
- data/test/integration/.keep +0 -0
- data/test/mailers/.keep +0 -0
- data/test/models/.keep +0 -0
- data/test/models/user_test.rb +7 -0
- data/test/system/.keep +0 -0
- data/test/test_helper.rb +15 -0
- data/tmp/.keep +0 -0
- data/tmp/pids/.keep +0 -0
- data/tmp/storage/.keep +0 -0
- data/vendor/.keep +0 -0
- data/vendor/javascript/.keep +0 -0
- data/wibrfake.gemspec +49 -0
- metadata +743 -0
@@ -0,0 +1,683 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
module WibrFake
|
3
|
+
class CLI < String
|
4
|
+
def initialize
|
5
|
+
begin
|
6
|
+
require 'fileutils'
|
7
|
+
require 'yaml'
|
8
|
+
require_relative 'Rails/service'
|
9
|
+
require_relative 'Rails/service_usage'
|
10
|
+
require_relative 'ty/prompt'
|
11
|
+
require_relative 'ty/apld'
|
12
|
+
require_relative 'String/string'
|
13
|
+
require_relative 'Rails/login'
|
14
|
+
require_relative 'NetworkInterface/monitor'
|
15
|
+
require_relative 'NetworkInterface/mac'
|
16
|
+
require_relative 'Listing/ouis'
|
17
|
+
require_relative 'Listing/apfake'
|
18
|
+
require_relative 'Listing/web_server'
|
19
|
+
require_relative 'Listing/clients'
|
20
|
+
require_relative 'Listing/sessions'
|
21
|
+
require_relative 'Config/options'
|
22
|
+
require_relative 'Config/ipaddr'
|
23
|
+
require_relative 'Config/security_wpa'
|
24
|
+
require_relative 'Process/pkill'
|
25
|
+
require_relative 'Listing/process'
|
26
|
+
require_relative 'Process/processes'
|
27
|
+
require_relative 'Process/id'
|
28
|
+
require_relative 'Sessions/session'
|
29
|
+
require_relative 'help'
|
30
|
+
rescue LoadError => e
|
31
|
+
puts e.message
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
@prompt = TTY::Prompt.new
|
35
|
+
@configAP = OpenStruct.new
|
36
|
+
@configAP = WibrFake::Config.apfake(@configAP)
|
37
|
+
@configAP.ipaddr = WibrFake::IPAddr.new
|
38
|
+
|
39
|
+
end
|
40
|
+
def banner(id: nil)
|
41
|
+
br_colorize """
|
42
|
+
█ █░ ██▓ ▄▄▄▄ ██▀███ █████▒ ▄▄▄ ██ ▄█▀▓█████
|
43
|
+
▓█░ █ ░█░▓██▒▓█████▄ ▓██ ▒ ██▒▓██ ▒ ▒████▄ ██▄█▒ ▓█ ▀
|
44
|
+
▒█░ █ ░█ ▒██▒▒██▒ ▄██▓██ ░▄█ ▒▒████ ░ ▒██ ▀█▄ ▓███▄░ ▒███
|
45
|
+
░█░ █ ░█ ░██░▒██░█▀ ▒██▀▀█▄ ░▓█▒ ░ ░██▄▄▄▄██ ▓██ █▄ ▒▓█ ▄
|
46
|
+
░░██▒██▓ ░██░░▓█ ▀█▓░██▓ ▒██▒░▒█░ ▓█ ▓██▒▒██▒ █▄░▒████▒
|
47
|
+
░ ▓░▒ ▒ ░▓ ░▒▓███▀▒░ ▒▓ ░▒▓░ ▒ ░ ▒▒ ▓▒█░▒ ▒▒ ▓▒░░ ▒░ ░
|
48
|
+
▒ ░ ░ ▒ ░▒░▒ ░ ░▒ ░ ▒░ ░ ▒ ▒▒ ░░ ░▒ ▒░ ░ ░ ░
|
49
|
+
░ ░ ▒ ░ ░ ░ ░░ ░ ░ ░ ░ ▒ ░ ░░ ░ ░
|
50
|
+
░ ░ ░ ░ ░ ░░ ░ ░ ░
|
51
|
+
░ """
|
52
|
+
puts_red "\e[4m\t\t\t\tBy BreakerTWS #{WibrFake.version}\n", 1
|
53
|
+
puts "\n\033[38;5;196m[\e[1;37m+\033[38;5;196m]\e[1;37m Session ID: #{id}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def validate_iface(iface)
|
57
|
+
stdout, stderr, status = Open3.capture3('iw dev')
|
58
|
+
ifaces = []
|
59
|
+
if(status.success?)
|
60
|
+
stdout.each_line{|line|
|
61
|
+
if(line =~ /^\s*Interface\s+(\S+)/)
|
62
|
+
ifaces << $1
|
63
|
+
end
|
64
|
+
}
|
65
|
+
unless(ifaces.include?(iface))
|
66
|
+
warn "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Interface #{iface} does not exist..."
|
67
|
+
exit 1
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
def start(options)
|
72
|
+
if(options.usage_server)
|
73
|
+
WibrFake::RailsUsage.new.start
|
74
|
+
end
|
75
|
+
validate_iface(options.iface)
|
76
|
+
options.server_web = Array.new
|
77
|
+
options.uuid = WibrFake::UUID.session(options.iface)
|
78
|
+
options.iface_init = options.iface
|
79
|
+
options.uuid_init = options.uuid
|
80
|
+
options.session = WibrFake::Session.new(id: options.uuid)
|
81
|
+
banner(id: options.uuid)
|
82
|
+
prompt_color_valid = "\n\033[38;5;236m\e[0m\033[48;5;236m \033[38;5;196mwibrfake #{options.iface} \e[0m\033[38;5;236m\e[0m"
|
83
|
+
prompt_color_invalid = "\n\033[38;5;236m\e[0m\033[48;5;236m\033[38;5;196m✘ wibrfake #{options.iface} \e[0m\033[38;5;196m\e[0m"
|
84
|
+
commands = %w[help clear banner monitor web_server apfake clients session mac apfake set run pkill show exit]
|
85
|
+
WibrFake::Config.new(@configAP, options.iface, options.uuid)
|
86
|
+
unless(options.file_wkdump.nil?)
|
87
|
+
dump = Array.new
|
88
|
+
puts "\033[38;5;196m[\e[1;37m+\033[38;5;196m]\e[1;37m The session has been successfully loaded from a wkdump file"
|
89
|
+
File.open(options.file_wkdump, 'r').each{|wkdump|
|
90
|
+
dump << wkdump
|
91
|
+
}
|
92
|
+
inp = dump.each
|
93
|
+
end
|
94
|
+
loop do
|
95
|
+
unless(options.file_wkdump.nil?)
|
96
|
+
begin
|
97
|
+
input = inp.next
|
98
|
+
rescue StopIteration
|
99
|
+
options.file_wkdump = nil
|
100
|
+
@configAP.session_modified = true
|
101
|
+
end
|
102
|
+
end
|
103
|
+
if(options.file_wkdump.nil?)
|
104
|
+
input = @prompt.ask(prompt_color_valid) {|get|
|
105
|
+
get.required true
|
106
|
+
}
|
107
|
+
end
|
108
|
+
if(true)
|
109
|
+
if(commands.include?(input.split.first))
|
110
|
+
#apfake_actived
|
111
|
+
prompt_color_valid = "\n\033[38;5;236m\e[0m\033[48;5;236m \033[38;5;196mwibrfake wlo1 \e[0m\033[38;5;236m\e[0m"
|
112
|
+
case input.split.first
|
113
|
+
when 'exit'
|
114
|
+
WibrFake::Pkill.kill_all()
|
115
|
+
WibrFake::Listing.sessions_list_return.each{|session|
|
116
|
+
config_yml = YAML.load_file(File.join(File.dirname(__FILE__), 'Tmp', session, 'config.yml'))
|
117
|
+
if(!(config_yml['session']['session_save']))
|
118
|
+
FileUtils.rm_rf(File.join(File.dirname(__FILE__), 'Tmp', session))
|
119
|
+
end
|
120
|
+
}
|
121
|
+
break
|
122
|
+
when 'help'
|
123
|
+
WibrFake::Help.help
|
124
|
+
when 'clear'
|
125
|
+
system('clear')
|
126
|
+
banner(id: options.uuid)
|
127
|
+
when 'banner'
|
128
|
+
banner(id: options.uuid)
|
129
|
+
when 'show'
|
130
|
+
begin
|
131
|
+
case input.split.fetch(1)
|
132
|
+
when 'options'
|
133
|
+
WibrFake::Listing.show_process(options.iface)
|
134
|
+
when 'process'
|
135
|
+
begin
|
136
|
+
WibrFake::Processes.status(input.split.fetch(2)).each{|process|
|
137
|
+
if(process.empty?)
|
138
|
+
warn "Process not found"
|
139
|
+
else
|
140
|
+
puts "#{input.split.fetch(2)}: #{process}"
|
141
|
+
end
|
142
|
+
}
|
143
|
+
rescue IndexError
|
144
|
+
puts WibrFake::Processes.status_all
|
145
|
+
end
|
146
|
+
when 'login'
|
147
|
+
WibrFake::RailsLogin.show(1)
|
148
|
+
else
|
149
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command show [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
150
|
+
prompt_color_valid = prompt_color_invalid
|
151
|
+
end
|
152
|
+
rescue IndexError
|
153
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command show [options]. not found, Run the show command for more details."
|
154
|
+
prompt_color_valid = prompt_color_invalid
|
155
|
+
|
156
|
+
rescue Errno::ENOENT => e
|
157
|
+
puts e.message
|
158
|
+
end
|
159
|
+
when'set'
|
160
|
+
begin
|
161
|
+
case input.split.fetch(1)
|
162
|
+
when 'iface'
|
163
|
+
begin
|
164
|
+
if !(options.iface==input.split.fetch(2)) and @configAP.session_modified
|
165
|
+
options.session.session_modified(status: true, id: options.uuid)
|
166
|
+
options.iface = input.split.fetch(2)
|
167
|
+
elsif !(@configAP.session_modified)
|
168
|
+
options.session.session_modified(status: false, id: options.uuid)
|
169
|
+
options.iface = input.split.fetch(2)
|
170
|
+
end
|
171
|
+
rescue IndexError
|
172
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Network interface name is missing"
|
173
|
+
end
|
174
|
+
when 'ssid'
|
175
|
+
begin
|
176
|
+
if !(@configAP.ssid==input.split[2..-1].join(" ")) and @configAP.session_modified
|
177
|
+
options.session.session_modified(status: true, id: options.uuid)
|
178
|
+
@configAP.ssid = input.split[2..-1].join(" ")
|
179
|
+
elsif !(@configAP.session_modified)
|
180
|
+
options.session.session_modified(status: false, id: options.uuid)
|
181
|
+
@configAP.ssid = input.split[2..-1].join(" ")
|
182
|
+
end
|
183
|
+
|
184
|
+
rescue IndexError
|
185
|
+
warn "Falta el nombre del punto de acceso"
|
186
|
+
end
|
187
|
+
when 'password'
|
188
|
+
begin
|
189
|
+
if(@configAP.wpa.nil?)
|
190
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command set password. not disponible, configure wpa authentication, use \"set wp [AUTHENTICATION]\""
|
191
|
+
prompt_color_valid = prompt_color_invalid
|
192
|
+
else
|
193
|
+
if !(@configAP.password==input.split.fetch(2)) and @configAP.session_modified
|
194
|
+
options.session.session_modified(status: true, id: options.uuid)
|
195
|
+
@configAP.password = input.split.fetch(2)
|
196
|
+
@configAP.wpa = "wpa2"
|
197
|
+
elsif !(@configAP.session_modified)
|
198
|
+
options.session.session_modified(status: false, id: options.uuid)
|
199
|
+
@configAP.password = input.split.fetch(2)
|
200
|
+
@configAP.wpa = "wpa2"
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
rescue IndexError
|
205
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Access point password is missing"
|
206
|
+
end
|
207
|
+
when 'driver'
|
208
|
+
begin
|
209
|
+
if !(@configAP.driver==input.split.fetch(2)) and @configAP.session_modified
|
210
|
+
options.session.session_modified(status: true, id: options.uuid)
|
211
|
+
@configAP.driver = input.split.fetch(2)
|
212
|
+
elsif !(@configAP.session_modified)
|
213
|
+
options.session.session_modified(status: false, id: options.uuid)
|
214
|
+
@configAP.driver = input.split.fetch(2)
|
215
|
+
end
|
216
|
+
|
217
|
+
rescue IndexError
|
218
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Network driver name missing"
|
219
|
+
end
|
220
|
+
when 'ignore_ssid'
|
221
|
+
begin
|
222
|
+
if !(@configAP.ignore_ssid==input.split.fetch(2)) and @configAP.session_modified
|
223
|
+
options.session.session_modified(status: true, id: options.uuid)
|
224
|
+
@configAP.ignore_ssid = input.split.fetch(2)
|
225
|
+
elsif !(@configAP.session_modified)
|
226
|
+
options.session.session_modified(status: false, id: options.uuid)
|
227
|
+
@configAP.ignore_ssid = input.split.fetch(2)
|
228
|
+
end
|
229
|
+
rescue IndexError
|
230
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Ingore ssid configuration is missing"
|
231
|
+
end
|
232
|
+
when 'hw_mode'
|
233
|
+
begin
|
234
|
+
if !(@configAP.hw_mode==input.split.fetch(2)) and @configAP.session_modified
|
235
|
+
options.session.session_modified(status: true, id: options.uuid)
|
236
|
+
@configAP.hw_mode = input.split.fetch(2)
|
237
|
+
elsif !(@configAP.session_modified)
|
238
|
+
options.session.session_modified(status: false, id: options.uuid)
|
239
|
+
@configAP.hw_mode = input.split.fetch(2)
|
240
|
+
end
|
241
|
+
rescue IndexError
|
242
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Hw mode missing"
|
243
|
+
end
|
244
|
+
when 'login'
|
245
|
+
begin
|
246
|
+
if(WibrFake::RailsLogin.validate?(input.split.fetch(2)))
|
247
|
+
if !(@configAP.login==input.split.fetch(2)) and @configAP.session_modified
|
248
|
+
options.session.session_modified(status: true, id: options.uuid)
|
249
|
+
@configAP.login = input.split.fetch(2)
|
250
|
+
elsif !(@configAP.session_modified)
|
251
|
+
options.session.session_modified(status: false, id: options.uuid)
|
252
|
+
@configAP.login = input.split.fetch(2)
|
253
|
+
end
|
254
|
+
else
|
255
|
+
puts "login not found"
|
256
|
+
end
|
257
|
+
rescue IndexError
|
258
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Access point login is missing"
|
259
|
+
end
|
260
|
+
when 'route'
|
261
|
+
begin
|
262
|
+
if !(@configAP.login_route==input.split.fetch(2)) and @configAP.session_modified
|
263
|
+
options.session.session_modified(status: true, id: options.uuid)
|
264
|
+
@configAP.login_route = input.split.fetch(2)
|
265
|
+
elsif !(@configAP.session_modified)
|
266
|
+
options.session.session_modified(status: false, id: options.uuid)
|
267
|
+
@configAP.login_route = input.split.fetch(2)
|
268
|
+
end
|
269
|
+
rescue IndexError
|
270
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Web server login path missing"
|
271
|
+
end
|
272
|
+
when 'port'
|
273
|
+
begin
|
274
|
+
if !(@configAP.port==input.split.fetch(2).to_i) and @configAP.session_modified
|
275
|
+
options.session.session_modified(status: true, id: options.uuid)
|
276
|
+
@configAP.port = input.split.fetch(2)
|
277
|
+
elsif !(@configAP.session_modified)
|
278
|
+
options.session.session_modified(status: false, id: options.uuid)
|
279
|
+
@configAP.port = input.split.fetch(2)
|
280
|
+
end
|
281
|
+
rescue IndexError
|
282
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m The port is missing"
|
283
|
+
end
|
284
|
+
when 'wp'
|
285
|
+
begin
|
286
|
+
if(input.split.fetch(2)=="wpa2") or (input.split.fetch(2)=="wpa") or (input.split.fetch(2)=="wep")
|
287
|
+
if !(@configAP.wpa==input.split.fetch(2)) and @configAP.session_modified
|
288
|
+
options.session.session_modified(status: true, id: options.uuid)
|
289
|
+
@configAP.wpa = input.split.fetch(2)
|
290
|
+
@configAP.wpa_pairwise = "CCMP" if(input.split.fetch(2)=="wpa")
|
291
|
+
@configAP.wpa_key_mgmt = "WPA-PSK" if(input.split.fetch(2)=="wpa")
|
292
|
+
@configAP.wpa_wep = @configAP.wpa=="wep"? "wep":nil
|
293
|
+
@configAP.required_pass = "yes"
|
294
|
+
elsif !(@configAP.session_modified)
|
295
|
+
options.session.session_modified(status: false, id: options.uuid)
|
296
|
+
@configAP.wpa = input.split.fetch(2)
|
297
|
+
@configAP.wpa_pairwise = "CCMP" if(input.split.fetch(2)=="wpa")
|
298
|
+
@configAP.wpa_key_mgmt = "WPA-PSK" if(input.split.fetch(2)=="wpa")
|
299
|
+
@configAP.wpa_wep = @configAP.wpa=="wep"? "wep":nil
|
300
|
+
@configAP.required_pass = "yes"
|
301
|
+
end
|
302
|
+
elsif(input.split.fetch(2)=="nil") or (input.split.fetch(2)=="none")
|
303
|
+
if !(@configAP.wpa==nil)
|
304
|
+
options.session.session_modified(status: true, id: options.uuid)
|
305
|
+
@configAP.wpa = nil
|
306
|
+
elsif !(@configAP.session_modified)
|
307
|
+
options.session.session_modified(status: false, id: options.uuid)
|
308
|
+
@configAP.wpa = nil
|
309
|
+
end
|
310
|
+
else
|
311
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m WPA security method does not exist"
|
312
|
+
end
|
313
|
+
rescue IndexError
|
314
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Access point security method is missing"
|
315
|
+
end
|
316
|
+
when 'pairwise'
|
317
|
+
begin
|
318
|
+
if(WibrFake::SecurityWPA.scan_pairwise(@configAP.wpa, input.split.fetch(2))==1)
|
319
|
+
prompt_color_valid = prompt_color_invalid
|
320
|
+
else
|
321
|
+
if !(@configAP.wpa_pairwise==input.split.fetch(2)) and @configAP.session_modified
|
322
|
+
options.session.session_modified(status: true, id: options.uuid)
|
323
|
+
@configAP.wpa_pairwise = input.split.fetch(2)
|
324
|
+
elsif !(@configAP.session_modified)
|
325
|
+
options.session.session_modified(status: false, id: options.uuid)
|
326
|
+
@configAP.wpa_pairwise = input.split.fetch(2)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
rescue IndexError
|
330
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Access point security encryption is missing"
|
331
|
+
end
|
332
|
+
when 'key_mgmt'
|
333
|
+
begin
|
334
|
+
if(WibrFake::SecurityWPA.scan_mgmt(@configAP.wpa, input.split.fetch(2))==1)
|
335
|
+
prompt_color_valid = prompt_color_invalid
|
336
|
+
else
|
337
|
+
if !(@configAP.wpa_key_mgmt==input.split.fetch(2)) and @configAP.session_modified
|
338
|
+
options.session.session_modified(status: true, id: options.uuid)
|
339
|
+
@configAP.wpa_key_mgmt = input.split.fetch(2)
|
340
|
+
elsif !(@configAP.session_modified)
|
341
|
+
options.session.session_modified(status: false, id: options.uuid)
|
342
|
+
@configAP.wpa_key_mgmt = input.split.fetch(2)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
rescue IndexError
|
346
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Access point security method is missing"
|
347
|
+
end
|
348
|
+
when 'gateway'
|
349
|
+
begin
|
350
|
+
if !(@configAP.ipaddr==WibrFake::IPAddr.new(input.split.fetch(2))) and @configAP.session_modified
|
351
|
+
options.session.session_modified(status: true, id: options.uuid)
|
352
|
+
@configAP.ipaddr = WibrFake::IPAddr.new(input.split.fetch(2))
|
353
|
+
elsif !(@configAP.session_modified)
|
354
|
+
options.session.session_modified(status: false, id: options.uuid)
|
355
|
+
@configAP.ipaddr = WibrFake::IPAddr.new(input.split.fetch(2))
|
356
|
+
end
|
357
|
+
rescue IndexError
|
358
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Inet is missing"
|
359
|
+
rescue IPAddr::InvalidAddressError
|
360
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Wrong IP Format"
|
361
|
+
end
|
362
|
+
when 'netmask'
|
363
|
+
begin
|
364
|
+
if !(@configAP.ipaddr.mask==input.split.fetch(2)) and @configAP.session_modified
|
365
|
+
options.session.session_modified(status: true, id: options.uuid)
|
366
|
+
@configAP.ipaddr.defined_mask(input.split.fetch(2))
|
367
|
+
elsif !(@configAP.session_modified)
|
368
|
+
options.session.session_modified(status: false, id: options.uuid)
|
369
|
+
@configAP.ipaddr.defined_mask(input.split.fetch(2))
|
370
|
+
end
|
371
|
+
rescue IndexError
|
372
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Net mask missing"
|
373
|
+
end
|
374
|
+
when 'rekey'
|
375
|
+
begin
|
376
|
+
if !(@configAP.wpa_rekey==input.split.fetch(2)) and @configAP.session_modified
|
377
|
+
options.session.session_modified(status: true, id: options.uuid)
|
378
|
+
@configAP.wpa_rekey = input.split.fetch(2)
|
379
|
+
elsif !(@configAP.session_modified)
|
380
|
+
options.session.session_modified(status: false, id: options.uuid)
|
381
|
+
@configAP.wpa_rekey = input.split.fetch(2)
|
382
|
+
end
|
383
|
+
rescue IndexError
|
384
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m WPA rekey configuration is missing"
|
385
|
+
end
|
386
|
+
when 'channel'
|
387
|
+
begin
|
388
|
+
if !(@configAP.channel==input.split.fetch(2)) and @configAP.session_modified
|
389
|
+
options.session.session_modified(status: true, id: options.uuid)
|
390
|
+
@configAP.channel = input.split.fetch(2)
|
391
|
+
elsif !(@configAP.session_modified)
|
392
|
+
options.session.session_modified(status: false, id: options.uuid)
|
393
|
+
@configAP.channel = input.split.fetch(2)
|
394
|
+
end
|
395
|
+
rescue IndexError
|
396
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m The channel is missing"
|
397
|
+
end
|
398
|
+
when 'wmm'
|
399
|
+
begin
|
400
|
+
if !(@configAP.wmm==input.split.fetch(2)) and @configAP.session_modified
|
401
|
+
options.session.session_modified(status: true, id: options.uuid)
|
402
|
+
@configAP.wmm = input.split.fetch(2)
|
403
|
+
elsif !(@configAP.session_modified)
|
404
|
+
options.session.session_modified(status: false, id: options.uuid)
|
405
|
+
@configAP.wmm = input.split.fetch(2)
|
406
|
+
end
|
407
|
+
rescue IndexError
|
408
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Missing if it enables virtualization or disables it"
|
409
|
+
end
|
410
|
+
when 'credentials'
|
411
|
+
begin
|
412
|
+
if !(@configAP.path_credential==input.split.fetch(2)) and @configAP.session_modified
|
413
|
+
options.session.session_modified(status: true, id: options.uuid)
|
414
|
+
@configAP.path_credential = input.split.fetch(2)
|
415
|
+
elsif !(@configAP.session_modified)
|
416
|
+
options.session.session_modified(status: false, id: options.uuid)
|
417
|
+
@configAP.path_credential = input.split.fetch(2)
|
418
|
+
end
|
419
|
+
rescue
|
420
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m The path where the credentials will be saved is missing"
|
421
|
+
end
|
422
|
+
else
|
423
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command set [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
424
|
+
prompt_color_valid = prompt_color_invalid
|
425
|
+
end
|
426
|
+
rescue IndexError
|
427
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command set [options]. not found, Run the show command for more details."
|
428
|
+
prompt_color_valid = prompt_color_invalid
|
429
|
+
end
|
430
|
+
when 'pkill'
|
431
|
+
begin
|
432
|
+
case input.split.fetch(1)
|
433
|
+
when 'all'
|
434
|
+
WibrFake::Pkill.kill_all()
|
435
|
+
when 'dns'
|
436
|
+
unless(WibrFake::Pkill.kill(input.split.fetch(1)))
|
437
|
+
puts "#{input.split.fetch(1)} process not found running"
|
438
|
+
end
|
439
|
+
when 'dhcp'
|
440
|
+
unless(WibrFake::Pkill.kill(input.split.fetch(1)))
|
441
|
+
puts "#{input.split.fetch(1)} process not found running"
|
442
|
+
end
|
443
|
+
when 'hostapd'
|
444
|
+
unless(WibrFake::Pkill.kill(input.split.fetch(1)))
|
445
|
+
puts "#{input.split.fetch(1)} process not found running"
|
446
|
+
end
|
447
|
+
when 'wpa_supplicant'
|
448
|
+
unless(WibrFake::Pkill.kill(input.split.fetch(1)))
|
449
|
+
puts "#{input.split.fetch(1)} process not found running"
|
450
|
+
end
|
451
|
+
when 'web_server'
|
452
|
+
unless(WibrFake::Pkill.kill(input.split.fetch(1)))
|
453
|
+
puts "#{input.split.fetch(1)} process not found running"
|
454
|
+
end
|
455
|
+
else
|
456
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command pkill [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
457
|
+
prompt_color_valid = prompt_color_invalid
|
458
|
+
end
|
459
|
+
rescue Errno::ESRCH
|
460
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Process not found"
|
461
|
+
rescue IndexError
|
462
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command pkill [options]. not found, Run the help command for more details."
|
463
|
+
prompt_color_valid = prompt_color_invalid
|
464
|
+
end
|
465
|
+
when 'monitor'
|
466
|
+
begin
|
467
|
+
case input.split.fetch(1)
|
468
|
+
when 'on'
|
469
|
+
WibrFake::Monitor.on(options.iface)
|
470
|
+
when 'off'
|
471
|
+
WibrFake::Monitor.off(options.iface)
|
472
|
+
when 'status'
|
473
|
+
WibrFake::Monitor.status(options.iface)
|
474
|
+
else
|
475
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command monitor [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
476
|
+
prompt_color_valid = prompt_color_invalid
|
477
|
+
end
|
478
|
+
rescue IndexError
|
479
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command monitor [options]. not found, Run the help command for more details."
|
480
|
+
prompt_color_valid = prompt_color_invalid
|
481
|
+
end
|
482
|
+
when 'web_server'
|
483
|
+
begin
|
484
|
+
case input.split.fetch(1)
|
485
|
+
when 'on'
|
486
|
+
options.server_web << WibrFake::Rails.new(@configAP.host_server, @configAP.port, @configAP.login, @configAP.login_route, @configAP.path_credential, options.iface, options.uuid).start
|
487
|
+
when 'off'
|
488
|
+
WibrFake::Pkill.kill_silence("web_server")
|
489
|
+
when 'status'
|
490
|
+
status = Array.new
|
491
|
+
if(!options.server_web.empty?)
|
492
|
+
options.server_web.each{|server_web|
|
493
|
+
WibrFake::RailsLogin.show(0).each{|login|
|
494
|
+
WibrFake::Processes.status("server").each{|server_pid|
|
495
|
+
if(server_web.include?("#{server_pid}_#{login}"))
|
496
|
+
status << "#{login}: #{server_web["#{server_pid}_#{login}"]}"
|
497
|
+
end
|
498
|
+
}
|
499
|
+
}
|
500
|
+
}
|
501
|
+
end
|
502
|
+
if(status.empty?)
|
503
|
+
warn "\e[1;33m[\e[1;37m-\e[1;33m]\e[1;37m You don't have any web server running"
|
504
|
+
else
|
505
|
+
puts "Running servers:"
|
506
|
+
puts
|
507
|
+
puts status
|
508
|
+
puts "\nTo see the identification processes for each server running, run \"show process web_server\""
|
509
|
+
end
|
510
|
+
when 'show'
|
511
|
+
WibrFake::Listing.web_server_show(@configAP)
|
512
|
+
else
|
513
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command web_server [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
514
|
+
prompt_color_valid = prompt_color_invalid
|
515
|
+
end
|
516
|
+
rescue IndexError
|
517
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command web_server [options]. not found, Run the help command for more details."
|
518
|
+
prompt_color_valid = prompt_color_invalid
|
519
|
+
end
|
520
|
+
when 'apfake'
|
521
|
+
begin
|
522
|
+
case input.split.fetch(1)
|
523
|
+
when 'on'
|
524
|
+
WibrFake::Config.new(@configAP, options.iface, options.uuid)
|
525
|
+
WibrFake::Apld.new(options.iface, @configAP.ipaddr, options.uuid)
|
526
|
+
when 'off'
|
527
|
+
WibrFake::Pkill.kill_silence("dns")
|
528
|
+
WibrFake::Pkill.kill_silence("dhcp")
|
529
|
+
WibrFake::Pkill.kill_silence("hostapd")
|
530
|
+
when 'show'
|
531
|
+
WibrFake::Listing.apfake_show(@configAP, options.iface)
|
532
|
+
else
|
533
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command apfake [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
534
|
+
prompt_color_valid = prompt_color_invalid
|
535
|
+
end
|
536
|
+
rescue IndexError
|
537
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command apfake [options]. not found, Run the help command for more details."
|
538
|
+
prompt_color_valid = prompt_color_invalid
|
539
|
+
end
|
540
|
+
when 'mac'
|
541
|
+
begin
|
542
|
+
case input.split.fetch(1)
|
543
|
+
when 'show'
|
544
|
+
WibrFake::Mac.show(options.iface)
|
545
|
+
when 'set'
|
546
|
+
begin
|
547
|
+
if(input.split.fetch(2))
|
548
|
+
WibrFake::Mac.set(options.iface, input.split.fetch(2))
|
549
|
+
end
|
550
|
+
rescue IndexError
|
551
|
+
puts "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Lack of arguments, the mac set operation needs a mac as input\n[mac set xx:xx:xx:xx:xx:xx:xx]"
|
552
|
+
prompt_color_valid = prompt_color_invalid
|
553
|
+
end
|
554
|
+
when 'ramset'
|
555
|
+
begin
|
556
|
+
if(input.split.fetch(2))
|
557
|
+
WibrFake::Mac.ramset(options.iface, input.split.fetch(2))
|
558
|
+
end
|
559
|
+
rescue IndexError
|
560
|
+
WibrFake::Mac.ramset(options.iface)
|
561
|
+
end
|
562
|
+
when 'list'
|
563
|
+
begin
|
564
|
+
if(input.split.fetch(2))
|
565
|
+
WibrFake::Listing.ouis_mac(input.split.fetch(2), false)
|
566
|
+
end
|
567
|
+
rescue IndexError
|
568
|
+
WibrFake::Listing.ouis_mac()
|
569
|
+
end
|
570
|
+
when 'reset'
|
571
|
+
WibrFake::Mac.reset(options.iface)
|
572
|
+
else
|
573
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command mac [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
574
|
+
prompt_color_valid = prompt_color_invalid
|
575
|
+
end
|
576
|
+
rescue IndexError
|
577
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command mac [options]. not found, Run the help command for more details."
|
578
|
+
prompt_color_valid = prompt_color_invalid
|
579
|
+
end
|
580
|
+
when 'clients'
|
581
|
+
begin
|
582
|
+
case input.split.fetch(1)
|
583
|
+
when 'connected'
|
584
|
+
WibrFake::Listing.clients_connected(id: options.uuid)
|
585
|
+
when 'disconnected'
|
586
|
+
WibrFake::Listing.clients_disconnected(id: options.uuid)
|
587
|
+
when 'logs'
|
588
|
+
WibrFake::Listing.clients_logs(id: options.uuid)
|
589
|
+
else
|
590
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command clients [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
591
|
+
prompt_color_valid = prompt_color_invalid
|
592
|
+
end
|
593
|
+
rescue IndexError
|
594
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command clients [options]. not found, Run the help command for more details."
|
595
|
+
prompt_color_valid = prompt_color_invalid
|
596
|
+
end
|
597
|
+
when 'session'
|
598
|
+
begin
|
599
|
+
case input.split.fetch(1)
|
600
|
+
when 'list'
|
601
|
+
WibrFake::Listing.sessions_list(id: options.uuid)
|
602
|
+
when 'new'
|
603
|
+
begin
|
604
|
+
if(input.split.fetch(2))
|
605
|
+
WibrFake::Session.new(id: input.split.fetch(2))
|
606
|
+
WibrFake::Config.new(WibrFake::Config.apfake(OpenStruct.new), options.iface_init, input.split.fetch(2))
|
607
|
+
puts "\033[38;5;46m[\e[1;37m+\033[38;5;46m]\e[1;37m New session created: #{input.split.fetch(2)}"
|
608
|
+
end
|
609
|
+
rescue IndexError
|
610
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m You have not defined the name for the new session"
|
611
|
+
end
|
612
|
+
when 'remove'
|
613
|
+
begin
|
614
|
+
if(input.split.fetch(2))
|
615
|
+
if(options.session.remove(number: input.split.fetch(2), id: options.uuid))
|
616
|
+
options.uuid = nil
|
617
|
+
end
|
618
|
+
end
|
619
|
+
rescue IndexError
|
620
|
+
puts "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m You have not defined which session you want to delete"
|
621
|
+
end
|
622
|
+
when 'rename'
|
623
|
+
begin
|
624
|
+
if(input.split.fetch(2))
|
625
|
+
begin
|
626
|
+
if(input.split.fetch(3))
|
627
|
+
if(options.session.rename(number: input.split.fetch(2), name: input.split.fetch(3), id: options.uuid)=='current')
|
628
|
+
options.uuid = input.split.fetch(3)
|
629
|
+
end
|
630
|
+
end
|
631
|
+
rescue IndexError
|
632
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m You haven't defined a name for the session"
|
633
|
+
end
|
634
|
+
end
|
635
|
+
rescue IndexError
|
636
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Which session to rename has not been defined"
|
637
|
+
end
|
638
|
+
when 'active'
|
639
|
+
options.session.active(id: options.uuid)
|
640
|
+
@configAP.session_remove = false
|
641
|
+
when 'save'
|
642
|
+
WibrFake::Config.new(@configAP, options.iface, options.uuid)
|
643
|
+
options.session.save(id: options.uuid)
|
644
|
+
when 'init'
|
645
|
+
begin
|
646
|
+
if(input.split.fetch(2))
|
647
|
+
options.uuid = options.session.init(number: input.split.fetch(2))
|
648
|
+
if(options.uuid)
|
649
|
+
options.file_wkdump = File.join(File.dirname(__FILE__), 'Tmp', options.uuid, 'wkdump', "#{options.uuid}.wkdump")
|
650
|
+
dump = Array.new
|
651
|
+
File.open(options.file_wkdump, 'r').each{|wkdump|
|
652
|
+
dump << wkdump
|
653
|
+
}
|
654
|
+
inp = dump.each
|
655
|
+
end
|
656
|
+
@configAP.session_modified = false
|
657
|
+
end
|
658
|
+
rescue IndexError
|
659
|
+
warn "\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m The session to start has not been defined"
|
660
|
+
end
|
661
|
+
else
|
662
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command session [#{input.split.fetch(1)}]. not found, Run the help command for more details."
|
663
|
+
prompt_color_valid = prompt_color_invalid
|
664
|
+
end
|
665
|
+
rescue IndexError
|
666
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command session [options]. not found, Run the help command for more details."
|
667
|
+
prompt_color_valid = prompt_color_invalid
|
668
|
+
end
|
669
|
+
end
|
670
|
+
else
|
671
|
+
puts "\n\033[38;5;196m[\e[1;37m✘\033[38;5;196m]\e[1;37m Command #{input}. not found, Run the help command for more details."
|
672
|
+
prompt_color_valid = prompt_color_invalid
|
673
|
+
end
|
674
|
+
end
|
675
|
+
end
|
676
|
+
end
|
677
|
+
end
|
678
|
+
class GUI
|
679
|
+
def self.start(options)
|
680
|
+
puts "Continuara..."
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|