Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Created on 06.09.2016
- @author: henryfinn
- '''
- import os
- # CLEAR COMMANDLINE
- from _winapi import WAIT_ABANDONED_0
- from time import sleep
- clear = lambda: os.system('cls')
- # PRESS ANY KEY
- import msvcrt
- # HIDDEN PASSWORD
- import getpass
- import paramiko
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- # INFINITE WHILE
- i = 0
- # WELCOME MESSAGE
- print("===========================================\n#")
- print("# REDII.DE - SERVER ADMIN TOOL v1.2\n#")
- print("# SSH Session provided by Paramiko Module\n#")
- print("===========================================")
- pw = getpass.getpass("\nEnter Password: ")
- # AUTHENTICATION FAILURE ABFANGEN
- try:
- ssh.connect('redii.de', username='ts3', password=pw)
- ssh.close()
- except paramiko.AuthenticationException:
- clear()
- print("===========================================")
- print("We had an authentication exception. Bye!")
- print("===========================================")
- sleep(5)
- exit()
- # ERSTER COMMAND AUFRUF
- print("===========================================")
- print("# Currently Supported Commands:")
- print("# > status")
- print("# > start <NAME>")
- print("# > stop <NAME>")
- print("# > help")
- print("# > exit")
- print("===========================================")
- print("\nPlease enter your command:\n")
- cmd = input()
- # WHILE SCHLEIFE FĂR GESAMTE COMMAND EINGABE BIS EXIT
- while i <= 1:
- if cmd == "status":
- clear()
- # SSH ABFRAGE STATUS TS3 SERVER
- # SSH ABFRAGE STATUS SINUSBOT
- # SSH ABFRAGE STATUS MINECRAFT SERVER
- # SSH ABFRAGE STATUS TTT SERVER
- print("===========================================")
- print("# > Teamspeak Server Status: UNKNOWN")
- print("# > Sinusbot Status: UNKNOWN")
- print("# > Minecraft Server Status: UNKNOWN")
- print("# > GMod TTT Server Status: UNKNOWN")
- print("# > Doesnt work at the moment.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "start ts3":
- clear()
- ssh.connect('redii.de', username='ts3', password=pw)
- stdin, stdout, stderr = ssh.exec_command("/opt/voice1/ts3server_startscript.sh start")
- ssh.close()
- print("===========================================")
- print("# > The Teamspeak Server is starting now...")
- print("# > If not wait a few seconds and try again!")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "stop ts3":
- clear()
- ssh.connect('redii.de', username='ts3', password=pw)
- stdin, stdout, stderr = ssh.exec_command("/opt/voice1/ts3server_startscript.sh stop")
- ssh.close()
- print("===========================================")
- print("# > The Teamspeak Server has been stopped.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "start sinusbot":
- clear()
- ssh.connect('redii.de', username='sinusbot', password=pw)
- stdin, stdout, stderr = ssh.exec_command("/opt/sinusbot/sinusbot")
- sleep(3)
- ssh.close()
- print("===========================================")
- print("# > The Sinusbot is starting now...")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "stop sinusbot":
- clear()
- ssh.connect('redii.de', username='sinusbot', password=pw)
- stdin, stdout, stderr = ssh.exec_command("killall sinusbot")
- ssh.close()
- print("===========================================")
- print("# > The Sinusbot has been stopped.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "start mc":
- clear()
- ssh.connect('redii.de', username='mc', password=pw)
- stdin, stdout, stderr = ssh.exec_command("java -Xmx1024M -Xms1024M -jar /opt/minecraft/vanilla1/minecraft_server.1.10.2.jar nogui")
- ssh.close()
- print("===========================================")
- print("# > The Minecraft Server is starting now...")
- print("# > Doesnt work at the moment.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "stop mc":
- clear()
- ssh.connect('redii.de', username='mc', password=pw)
- stdin, stdout, stderr = ssh.exec_command("")
- ssh.close()
- print("===========================================")
- print("# > The Minecraft Server has been stopped.")
- print("# > Doesnt work at the moment.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "start gmod":
- clear()
- ssh.connect('redii.de', username='gmod', password=pw)
- stdin, stdout, stderr = ssh.exec_command("")
- ssh.close()
- print("===========================================")
- print("# > The GMod TTT Server is starting now...")
- print("# > Doesnt work at the moment.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "stop gmod":
- clear()
- ssh.connect('redii.de', username='mc', password=pw)
- stdin, stdout, stderr = ssh.exec_command("")
- ssh.close()
- print("===========================================")
- print("# > The GMod TTT Server has been stopped.")
- print("# > Doesnt work at the moment.")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "help":
- clear()
- print("===========================================")
- print("# Process Names:")
- print("# > Teamspeak Server = ts3")
- print("# > Sinusbot = sinusbot")
- print("# > Minecraft Server = mc")
- print("# > Gmod TTT Server = gmod")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- elif cmd == "exit":
- exit()
- else:
- clear()
- print("===========================================")
- print("Your command is invalid!")
- print("===========================================")
- print("\nPress any key to continue...")
- msvcrt.getch()
- # WIEDERHOLENDE COMMAND ABFRAGE IN WHILE SCHLEIFE
- clear()
- print("===========================================")
- print("# Currently Supported Commands:")
- print("# > status")
- print("# > start <NAME>")
- print("# > stop <NAME>")
- print("# > help")
- print("# > exit")
- print("===========================================")
- print("\nPlease enter your command:\n")
- cmd = input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement