misc2.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import typer
  2. import config
  3. from misc import apache_ldap
  4. from misc.headers import create_headerfiles
  5. app = typer.Typer()
  6. cfg = config.Config()
  7. @app.command()
  8. def headers():
  9. create_headerfiles(cfg.system_dir + "\\Export")
  10. @app.command()
  11. def ldap_backup():
  12. cred = cfg.cognos11.credentials
  13. apache_ldap.ldap_backup(cred.username, cred.password, cfg.cognos11.config_dir + "\\apacheds_backup.ldif")
  14. @app.command()
  15. def ldap_restore(backup_file: str):
  16. cred = cfg.cognos11.credentials
  17. apache_ldap.restore_ldap(cred.username, cred.password, backup_file)
  18. @app.command()
  19. def ldap_password(old_password: str, new_password: str) -> bool:
  20. return apache_ldap.ldap_change_admin_password(old_password, new_password)
  21. @app.command()
  22. def ldap_admin():
  23. if ldap_password("gc01gapsC$", ""):
  24. print("Passwort ist bereits aktuell.")
  25. for p in ["Cognos#11Cognos#11", "mEn$q3b%P9p1j!A-ku", "Never4getpw#!!##"]:
  26. if ldap_password(p, "gc01gapsC$"):
  27. break
  28. if __name__ == "__main__":
  29. headers()