// Copyright 2016 Etix Labs // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include // sig #include // std::shared_ptr #include // parsing opt #include // LOG #include // conf #include // std::thread #include // operator""ms #include // sig // All the tasks managed by the dispatcher #include #include #include #include #include #include #include namespace etix { namespace cameradar { enum class task { init, preparation, mapping, parsing, path_attack, creds_attack, thumb_generation, print, finished }; class dispatcher { private: bool busy; task current; std::string nmap_output; const configuration& conf; std::shared_ptr cache; const std::pair& opts; std::list queue; public: dispatcher() = delete; dispatcher(const configuration& conf, std::shared_ptr cache, const std::pair& opts) : busy(false) , current(task::init) , nmap_output("/tmp/scans/scan" + std::to_string(std::chrono::system_clock::to_time_t( std::chrono::system_clock::now())) + ".xml") , conf(conf) , cache(cache) , opts(opts){}; ~dispatcher() = default; bool doing_stuff() const { return this->busy; } void do_stuff(); void run(); }; } }