Example #1
0
 def start():
     """Start of the program"""
     print("LOADING Config...", end=" ")
     CONFIG.load()
     print("DONE")
     print("SETTING UP DATABASE...", end=" ")
     Database.setup()
     print("DONE")
     print("LOADING AUTHENTICATION...", end=" ")
     Auth.start()
     print("DONE")
     print("LOADING SCRAPER...", end=" ")
     Scraper.start()
     print("DONE")
     print("LOADING LIBRARIES...", end=" ")
     Library.start()
     print("DONE")
     if Ripper.enabled:
         print("STARTING RIPPER...", end=" ")
         Ripper.start()
         print("DONE")
     print("STARTING WEBSERVICES...", end=" ")
     Webserver.start()
     print("DONE")
     print("TACKEM HAS STARTED")
Example #2
0
 def login(self, **kwargs: Any):
     """Login Page"""
     return_url = kwargs.get("return_url", CONFIG["webui"]["baseurl"].value)
     username = kwargs.get("username", "")
     password = kwargs.get("password", "")
     timeout = kwargs.get("timeout", "")
     if len(username) > 0 and len(password) > 0:
         Auth.login(username, password, timeout, return_url)
     return {"returnurl": return_url}
Example #3
0
 def password(self, **kwargs: Any):
     """Login Page"""
     Auth.check_auth()
     password = kwargs.get("password", None)
     new_password = kwargs.get("new_password", None)
     new_password_check = kwargs.get("new_password_check", None)
     if password is not None and new_password is not None and new_password_check is not None:
         if new_password == new_password_check:
             if Auth.change_password(password, new_password):
                 raise cherrypy.HTTPRedirect(cherrypy.url().replace("/password", "/"))
Example #4
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""
        user = 0
        if len(vpath) == 0:
            return self

        section = ""
        api_key = vpath.pop(0)
        if len(api_key) == 40:
            user = self._check_api_key(api_key)
            if len(vpath) == 0:
                return self
            section = vpath.pop(0).lower()
        else:
            user = Auth.check_logged_in()
            section = api_key.lower()

        cherrypy.request.params["user"] = user

        if section == "admin":
            return APIAdmin()
        if section == "library":
            return APILibrary()
        if section == "ripper":
            return APIRipper()
        if section == "scraper":
            return APIScraper()
        return API404()
Example #5
0
 def POST(self, userid: int, **kwargs) -> str:
     """POST Function"""
     self._check_user(True)
     if "username" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing User Name",
             errorNumber=0,
         )
     if "password" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing User Password",
             errorNumber=1,
         )
     if "isadmin" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing is admin Setting",
             errorNumber=2,
         )
     if Auth.update_user(
         userid,
         kwargs["username"],
         kwargs["password"],
         kwargs["isadmin"] == "true",
     ):
         return self._return_data("User", "Update User", True)
     return self._return_data(
         "User",
         "Add User",
         False,
         error="Update Failed Due to Auth",
         errorNumber=3,
     )
Example #6
0
 def POST(self, **kwargs) -> str:
     """POST Function"""
     self._check_user(True)
     if "username" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing User Name",
             errorNumber=0,
         )
     if "password" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing User Password",
             errorNumber=1,
         )
     if "isadmin" not in kwargs:
         return self._return_data(
             "User",
             "Add User",
             False,
             error="Missing is admin Setting",
             errorNumber=2,
         )
     if Auth.add_user(kwargs["username"], kwargs["password"], kwargs["isadmin"] == "true"):
         return self._return_data("User", "Add User", True)
     return self._return_data(
         "User",
         "Add User",
         False,
         error="Failed User Name Taken",
         errorNumber=3,
     )
Example #7
0
 def DELETE(self, userid: int, **kwargs) -> str:
     """DELETE Function"""
     self._check_user(True)
     Auth.delete_user(userid)
     return self._return_data("User", "Update User", True)
Example #8
0
 def users(self) -> dict:
     """Grab the users info"""
     return {"users": Auth.get_users()}
Example #9
0
 def logout(self):
     """Logout Page"""
     Auth.logout()