def takeinputs(self,__str,num): name, done = QtWidgets.QInputDialog.getText( self, 'Input Dialog', __str) if done: self.cams = Output() stdouterr = "" if num == 1: stdouterr = os.popen("useradd "+name).read() if num == 2: stdouterr = os.popen("userdel "+name).read() if num == 3: stdouterr = os.popen("id "+name).read() if num == 4: stdouterr = os.popen("groupadd "+name).read() if num == 5: stdouterr = os.popen("groupdel "+name).read() if num == 6: stdouterr = os.popen("groupmod "+name).read() if num == 7: stdouterr = os.popen("passwd "+name).read() if num == 8: stdouterr = os.popen("usermod "+name).read() if num == 9: stdouterr = os.popen("groupmod "+name).read() if num == 10: stdouterr = os.popen("w "+name).read() self.cams.te.setText(stdouterr) self.cams.show()
class UserWindow(QtWidgets.QMainWindow,Ui_UserWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_UserWindow.__init__(self) self.setupUi(self) self.setFixedWidth(555) self.setFixedHeight(425) self.setWindowTitle("User Commands Window") qtRectangle = self.frameGeometry() centerPoint = QtWidgets.qApp.desktop().availableGeometry().center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) self.CreateUserAccount.clicked.connect(lambda: self.takeinputs("Enter the name of User:"******"Enter the name of User:"******"Enter the name of User:"******"Enter the name of Group:",4)) self.DeleteUserGroup.clicked.connect(lambda: self.takeinputs("Enter the name of Group:",5)) self.ChangeGroupDetails.clicked.connect(lambda: self.takeinputs("Enter the name of Group:",6)) self.ChangeUserPassword.clicked.connect(lambda: self.takeinputs("Enter the name of User:"******"Enter the name of User:"******"Enter the name of Group:",9)) self.ViewUserSession.clicked.connect(lambda: self.takeinputs("Enter the name of User:"******"" if num == 1: stdouterr = os.popen("useradd "+name).read() if num == 2: stdouterr = os.popen("userdel "+name).read() if num == 3: stdouterr = os.popen("id "+name).read() if num == 4: stdouterr = os.popen("groupadd "+name).read() if num == 5: stdouterr = os.popen("groupdel "+name).read() if num == 6: stdouterr = os.popen("groupmod "+name).read() if num == 7: stdouterr = os.popen("passwd "+name).read() if num == 8: stdouterr = os.popen("usermod "+name).read() if num == 9: stdouterr = os.popen("groupmod "+name).read() if num == 10: stdouterr = os.popen("w "+name).read() self.cams.te.setText(stdouterr) self.cams.show() def Exit_Window(self): self.cams = main_window.MainWindow() self.cams.show() self.close()
def takeinputs(self, __str, num): name, done = QtWidgets.QInputDialog.getText(self, 'Input Dialog', __str) if done: self.cams = Output() stdouterr = "" if num == 3: stdouterr = os.popen("systemctl enable " + name).read() if num == 4: stdouterr = os.popen("systemctl status " + name).read() if num == 5: stdouterr = os.popen("systemctl restart " + name).read() if num == 6: stdouterr = os.popen("systemctl is-enabled " + name).read() if num == 11: stdouterr = os.popen("locate " + name).read() if num == 12: stdouterr = os.popen("find " + name).read() if num == 13: stdouterr = os.popen("systemctl disable " + name).read() self.cams.te.setText(stdouterr) self.cams.show()
def takeinputs(self, __str, num): name, done = QtWidgets.QInputDialog.getText(self, 'Input Dialog', __str) if done: self.cams = Output() stdouterr = "" if num == 2: stdouterr = os.popen("yum install " + name).read() if num == 3: stdouterr = os.popen("yum remove " + name).read() if num == 4: stdouterr = os.popen("yum update " + name).read() if num == 5: stdouterr = os.popen("yum list " + name).read() if num == 6: stdouterr = os.popen("yum search " + name).read() if num == 7: stdouterr = os.popen("yum info " + name).read() if num == 9: stdouterr = os.popen("yum provides " + name).read() self.cams.te.setText(stdouterr) self.cams.show()
def Output_(self, __str): _str = __str self.cams = Output() stdouterr = os.popen(_str).read() self.cams.te.setText(stdouterr) self.cams.show()
class ServiceWindow(QtWidgets.QMainWindow, Ui_ServiceWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_ServiceWindow.__init__(self) self.setupUi(self) self.setFixedWidth(555) self.setFixedHeight(425) self.setWindowTitle("Service Commands Window") qtRectangle = self.frameGeometry() centerPoint = QtWidgets.qApp.desktop().availableGeometry().center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) self.las.clicked.connect( lambda: Output_("systemctl list-units -at service")) self.lrs.clicked.connect( lambda: Output_("systemctl -t service --state=active")) self.eas.clicked.connect( lambda: takeinputs("Enter the name of the service", 3)) self.vss.clicked.connect( lambda: takeinputs("Enter the name of the service", 4)) self.ras.clicked.connect( lambda: takeinputs("Enter the name of the service", 5)) self.cise.clicked.connect( lambda: takeinputs("Enter the name of the service", 6)) self.cl.clicked.connect(lambda: Output_("systemd-journald.service")) self.vl.clicked.connect(lambda: Output_("journalctl")) self.vao.clicked.connect( lambda: Output_("cat /etc/pam.d/system-authtlog")) self.sbt.clicked.connect(lambda: Output_("crontab -e")) self.ffbn.clicked.connect( lambda: takeinputs("Enter the name of the file", 11)) self.ffbc.clicked.connect( lambda: takeinputs("Enter the name of the file", 12)) self.das.clicked.connect( lambda: takeinputs("Enter the name of the service", 13)) self.vrlt.clicked.connect(lambda: Output_("who -r")) self.Exit.clicked.connect(self.Exit_Window) def takeinputs(self, __str, num): name, done = QtWidgets.QInputDialog.getText(self, 'Input Dialog', __str) if done: self.cams = Output() stdouterr = "" if num == 3: stdouterr = os.popen("systemctl enable " + name).read() if num == 4: stdouterr = os.popen("systemctl status " + name).read() if num == 5: stdouterr = os.popen("systemctl restart " + name).read() if num == 6: stdouterr = os.popen("systemctl is-enabled " + name).read() if num == 11: stdouterr = os.popen("locate " + name).read() if num == 12: stdouterr = os.popen("find " + name).read() if num == 13: stdouterr = os.popen("systemctl disable " + name).read() self.cams.te.setText(stdouterr) self.cams.show() def Output_(self, __str): _str = __str self.cams = Output() stdouterr = os.popen(_str).read() self.cams.te.setText(stdouterr) self.cams.show() def Exit_Window(self): self.cams = main_window.MainWindow() self.cams.show() self.close()
def yum_shell(self): self.cams = EmbTerminal() self.cams.show()
class YumWindow(QtWidgets.QMainWindow, Ui_YumWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) Ui_YumWindow.__init__(self) self.setupUi(self) self.setFixedWidth(555) self.setFixedHeight(425) self.setWindowTitle("Yum Commands Window") qtRectangle = self.frameGeometry() centerPoint = QtWidgets.qApp.desktop().availableGeometry().center() qtRectangle.moveCenter(centerPoint) self.move(qtRectangle.topLeft()) self.yrc.clicked.connect(lambda: self.Output_( "dnf -y install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm" )) self.yrc.clicked.connect(lambda: self.Output_( "dnf -y install https://fedoraproject.org/pub/epel-release-latest-8.noarch.rpm" )) self.wtis.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 2)) self.wtds.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 3)) self.uap.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 4)) self.lap.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 5)) self.sap.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 6)) self.gioap.clicked.connect( lambda: self.takeinputs("Enter the name of package:", 7)) self.laip.clicked.connect(lambda: self.Output_("yum list installed")) self.ypf.clicked.connect( lambda: self.takeinputs("Enter the name of function:", 9)) self.us.clicked.connect(lambda: self.Output_("yum update")) self.cfau.clicked.connect(lambda: self.Output_("yum check-update")) self.YumShell.clicked.connect(lambda: self.yum_shell()) self.Exit.clicked.connect(self.Exit_Window) def takeinputs(self, __str, num): name, done = QtWidgets.QInputDialog.getText(self, 'Input Dialog', __str) if done: self.cams = Output() stdouterr = "" if num == 2: stdouterr = os.popen("yum install " + name).read() if num == 3: stdouterr = os.popen("yum remove " + name).read() if num == 4: stdouterr = os.popen("yum update " + name).read() if num == 5: stdouterr = os.popen("yum list " + name).read() if num == 6: stdouterr = os.popen("yum search " + name).read() if num == 7: stdouterr = os.popen("yum info " + name).read() if num == 9: stdouterr = os.popen("yum provides " + name).read() self.cams.te.setText(stdouterr) self.cams.show() def yum_shell(self): self.cams = EmbTerminal() self.cams.show() def Output_(self, __str): _str = __str self.cams = Output() stdouterr = os.popen(_str).read() self.cams.te.setText(stdouterr) self.cams.show() def Exit_Window(self): self.cams = main_window.MainWindow() self.cams.show() self.close()