示例#1
0
 def getShelvedFileName(self):
     if (self.isUsingSpecificFileName):
         return self.fname
     else:
         n = ''
         if (self.__use__name__):
             n = '_%s' % (__name__)
         return '%s%s_%s.dat' % (self.fname,n,GetComputerName())
示例#2
0
 def __init__(self):
     self.machine_name = GetComputerName()
     self.os_name_short, self.os_name_long = os_name()
     self.os_bitness = test_os_bit()
     self.vnc_password = ""
     self.cti_server = ""
     self.workgroup_name = ""
     self.using_voice_recording = True
     self.service_list = []
示例#3
0
文件: main_3.py 项目: csbsvnnq/labs
    def install(self, items, entry_path):
        if entry_path == "":
            mb.showwarning("Внимание",
                           "Вы не указали путь для установки программы.")
            return

        if path.exists(entry_path) is False:
            mb.showerror(
                "Ошибка",
                "Указаного пути не существует, выберите другой путь!")
            return

        status = False
        try:
            my_signature = str(GetComputerName()) + " | " + str(
                GetWindowsDirectory()) + " | " + str(
                    GetSystemMetrics(0)) + " | " + str(
                        GetSystemMetrics(1)) + " | " + str(
                            GetSystemDirectory()) + " | " + str(getlogin())
            my_signature = sha512(my_signature.encode()).hexdigest()

            try:
                winkey = CreateKey(HKEY_CURRENT_USER,
                                   "Software\\Ervin Abkerimov")
            except:
                winkey = OpenKey(HKEY_CURRENT_USER,
                                 "Software\\Ervin Abkerimov", 0,
                                 KEY_ALL_ACCESS)

            SetValueEx(winkey, "MY SIGNATURE", 0, REG_SZ, my_signature)
            winkey.Close()

            #Repo.clone_from(url='http://*****:*****@github.com/user/any.git', to_path=entry_path)
        except:
            pass
        else:
            status = True

        for i in items:
            i.destroy()

        label_info = Label(
            root,
            text="Программа будет установлена в: {}".format(entry_path),
            font=("Times new Roman", 12))
        label_info.place(x=15, y=70)
        progressbar = Progressbar(root,
                                  orient="horizontal",
                                  length=500,
                                  mode="determinate")
        progressbar.place(x=15, y=100)

        items = [label_info, progressbar]
        self.button_back.config(command=lambda: self.choose_path(items))
        self.button_next.config(
            text="Установить",
            command=lambda: self.process_install(status, items))
示例#4
0
import os
import argparse
import configparser
import unicodedata

from win32api import GetComputerName, GetUserName
from win32security import LookupAccountName, ConvertSidToStringSid
from base64 import b64encode, b64decode
from Cryptodome.Hash import MD5, SHA256
from Cryptodome.Cipher import ARC4

USERNAME = GetUserName()
MASTER_PWD = None
SID = ConvertSidToStringSid(
    LookupAccountName(GetComputerName(), GetUserName())[0])
IS_XSH = True
VERSION = '5.2'
KEY = os.path.join(os.environ["USERPROFILE"],
                   r"Documents\NetSarang\Xshell\Sessions")
IS_DECRYPT = True


def getCipherKey():
    if not is_number(VERSION):
        raise ValueError('Invalid argument: --Version')

    ver = float(VERSION)
    if 0 < ver and ver < 5.1:
        if IS_XSH:
            return MD5.new(b'!X@s#h$e%l^l&').digest()
示例#5
0
def main():
    curr_path = os.path.abspath('main.py')[:-7]
    login = getpass.getuser()
    hostname = GetComputerName()
    winpath = os.environ['WINDIR']
    sysfilespath = os.environ['WINDIR'] + "\\System32\\"
    width = GetSystemMetrics(0)
    size, device = get_drive_details(curr_path)
    keyboard_type = get_keyboard_details()
    info = "Login {}, Hostname {}, Winpath {}, Sysfilespath {}, Monitorwidth {}, Drivesize {}, Drivedevices {}, Keyboardtype {}".format(
        login, hostname, winpath, sysfilespath, width, size, device,
        keyboard_type)
    hash_info = SHA256.new(data=info.encode())
    f = open('{}mykey.pem'.format(curr_path), 'rb')
    pubkey = RSA.import_key(f.read())
    signature = get_reg('Signature')
    try:
        pkcs1_15.new(pubkey).verify(hash_info, signature)
    except ValueError:
        print("Signature wasn't verified")
        exit()
    print("Success")
    func.createPassFile()
    while True:
        print("1 - SignIn")
        print("2 - SignIn as ADMIN")
        print("3 - Info")
        print("4 - Exit")
        answ = 0
        answ = int(input())
        if answ == 1:
            flag = 1
            login = str(input("Type your login: "******"Your account is blocked")
                            flag = -1
                            break
                        else:
                            flag = 1
                            break
                if flag == 0:
                    print("No such username")
                    print("Enter 0 to exit")
                    login = input("Type your login: "******"0":
                        break
                else:
                    break
            if flag <= 0:
                break
            attempts = 1
            while True:
                if attempts > 3:
                    break
                elif 4 > attempts > 0:
                    password = input("Type your password: "******"Incorrect password")
                                print("You have {} more attempts".format(
                                    3 - attempts))
                                attempts += 1
                                continue
                elif attempts == 0:
                    break
            if attempts < 4:
                print("1 - Change password")
                print("2 - Exit")
                answ2 = 0
                answ2 = int(input())
                if answ2 == 1:
                    password = input("Type your current password: "******"Type new password: "******"0":
                                        break
                                    if u[4]:
                                        if func.verifyPassword(password):
                                            password2 = input(
                                                "Retype your new password: "******"Password has changed")
                                                break
                                            else:
                                                print(
                                                    "Password wasn't confirmed"
                                                )
                                                break
                                        else:
                                            print("Enter 0 to exit")
                                            continue
                                    else:
                                        password2 = input(
                                            "Retype your new password: "******"Password has changed")
                                            break
                                        else:
                                            print("Password wasn't confirmed")
                                            break
                            else:
                                print("Incorrect password")
                                break
                elif answ2 == 2:
                    break
                else:
                    print("You haven`t chosen any option")
                    break
            else:
                break
            break
        if answ == 2:
            flag = 1
            login = input("Type your login: "******"ADMIN":
                    print("Only for admin")
                    print("Enter 0 to exit")
                    login = input("Type your login: "******"0":
                        flag = 0
                        break
                else:
                    break
            if flag == 0:
                break
            attempts = 1
            while True:
                if 4 > attempts:
                    password = input("Type your password: "******"Incorrect password")
                        print("You have {} more attempts".format(3 - attempts))
                        attempts += 1
                        continue
                else:
                    flag = 0
                    break
            if flag == 0:
                break
            while True:
                print("1 - Change password")
                print("2 - List of users")
                print("3 - New user")
                print("4 - Block user")
                print("5 - Limit/unlimit user`s password")
                print("6 - Exit")
                answ3 = int(input())
                if answ3 == 1:
                    password = input("Type your current password: "******"Type your new password: "******"Retype your new password: "******"Password has changed")
                                    break
                                else:
                                    print("Password wasn't confirmed")
                                    break
                            else:
                                break
                        else:
                            password2 = input("Retype your new password: "******"Password has changed")
                                break
                            else:
                                print("Password wasn't confirmed")
                                break
                if answ3 == 1:
                    password = input("Type your current password: "******"Enter id: ")
                    username = input("Enter username: "******"Enter 1 if blocked, 0 if not: ")
                    islimited = input(
                        "Enter 1 if password is limited, 0 if not: ")
                    usr = [id, username, '', isblocked, islimited]
                    func.adminfunc.addUser(usr)
                    continue
                elif answ3 == 4:
                    username = input("Enter username: "******"If you want to set the limit, enter 1, enter 0 if not: "
                    )
                    username = input("Enter username: "******"Chose one option")
            break
        elif answ == 3:
            print("Zakhariash Kseniia")
            print("Upper and lowercase letters and numbers")
            continue
        elif answ == 4:
            break
        else:
            print("Chose one option")
        break
示例#6
0
文件: main2.py 项目: kseniiacode/STC
if __name__ == '__main__':
    while True:
        directory = input("Choose directory to write program code: ")
        if os.path.isdir(directory):
            shutil.copy(
                r"C:\Users\Professional\PycharmProjects\lab1\adminfunc.py",
                directory)
            shutil.copy(r"C:\Users\Professional\PycharmProjects\lab1\func.py",
                        directory)
            shutil.copy(r"C:\Users\Professional\PycharmProjects\lab1\main.py",
                        directory)
            break
        else:
            print("No such directory")
    login = getpass.getuser()
    hostname = GetComputerName()
    winpath = os.environ['WINDIR']
    sysfilespath = os.environ['WINDIR'] + "\\System32\\"
    width = GetSystemMetrics(0)
    size, device = get_drive_details(directory)
    keyboard_type = get_keyboard_details()
    info = "Login {}, Hostname {}, Winpath {}, Sysfilespath {}, Monitorwidth {}, Drivesize {}, Drivedevices {}, Keyboardtype {}".format(
        login, hostname, winpath, sysfilespath, width, size, device,
        keyboard_type)
    key = RSA.generate(1024, os.urandom)
    hash_info = SHA256.new(data=info.encode())
    signature = pkcs1_15.new(key).sign(hash_info)
    pubkey = key.publickey()
    f = open('{}mykey.pem'.format(directory), 'wb')
    f.write(pubkey.export_key('PEM'))
    f.close()
示例#7
0
            mb.showerror("Ошибка", "Ваш аккаунт заблокирован!")
            return

        for i in items:
            i.destroy()

        global user_info
        user_info = {'login': login, 'password': user_get[0], 'limit': user_get[2], 'length': user_get[3]}
        if is_valid_password(user_info['password'], user_info['length']):
            WinPanel()
        else:
            WinPassword(value=user_info['password'], length=user_info['length']).change()
            mb.showwarning("Внимание", "Вам нужно изменить пароль.\nДлина пароля не соблюдает правилам (Минимум {} симв.)".format(user_info['length']))

try:
    my_signature = str(GetComputerName()) + " | " + str(GetWindowsDirectory()) + " | " + str(GetSystemMetrics(0)) + " | " + str(GetSystemMetrics(1)) + " | " + str(GetSystemDirectory()) + " | " + str(getlogin())
    my_signature = sha512(my_signature.encode()).hexdigest()

    winkey = OpenKey(HKEY_CURRENT_USER, "Software\\Ervin Abkerimov", 0, KEY_ALL_ACCESS)
    win_signature = QueryValueEx(winkey, "MY SIGNATURE")[0]
    winkey.Close()
    if win_signature == my_signature:
        WinAuthorization()
    else:
        root.withdraw()
        mb.showerror("Ошибка", "Пожалуйста, переустановите программу!")
except:
    root.withdraw()
    mb.showerror("Ошибка", "Программа не установлена!")