404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.15.26.71: ~ $
from ctypes import Structure, POINTER, c_void_p, cast, create_string_buffer, \
    c_char_p, byref, memmove
from ctypes import windll, WinDLL, WINFUNCTYPE
try:
    from ctypes import wintypes
except ValueError:
    # see http://bugs.python.org/issue16396
    raise ImportError("wintypes")

from keyring.util.escape import u

# Crypto API ctypes bindings


class DATA_BLOB(Structure):
    _fields_ = [('cbData', wintypes.DWORD),
                ('pbData', POINTER(wintypes.BYTE))]


class CRYPTPROTECT_PROMPTSTRUCT(Structure):
    _fields_ = [('cbSize', wintypes.DWORD),
                ('dwPromptFlags', wintypes.DWORD),
                ('hwndApp', wintypes.HWND),
                ('szPrompt', POINTER(wintypes.WCHAR))]


# Flags for CRYPTPROTECT_PROMPTSTRUCT

CRYPTPROTECT_PROMPT_ON_UNPROTECT = 1
CRYPTPROTECT_PROMPT_ON_PROTECT = 2

# Flags for CryptProtectData/CryptUnprotectData

CRYPTPROTECT_UI_FORBIDDEN = 0x01
CRYPTPROTECT_LOCAL_MACHINE = 0x04
CRYPTPROTECT_CRED_SYNC = 0x08
CRYPTPROTECT_AUDIT = 0x10
CRYPTPROTECT_NO_RECOVERY = 0x20
CRYPTPROTECT_VERIFY_PROTECTION = 0x40
CRYPTPROTECT_CRED_REGENERATE = 0x80

# Crypto API Functions

_dll = WinDLL('CRYPT32.DLL')

CryptProtectData = WINFUNCTYPE(wintypes.BOOL,
                               POINTER(DATA_BLOB),
                               POINTER(wintypes.WCHAR),
                               POINTER(DATA_BLOB),
                               c_void_p,
                               POINTER(CRYPTPROTECT_PROMPTSTRUCT),
                               wintypes.DWORD,
                               POINTER(DATA_BLOB))(('CryptProtectData', _dll))

CryptUnprotectData = WINFUNCTYPE(wintypes.BOOL,
                                 POINTER(DATA_BLOB),
                                 POINTER(wintypes.WCHAR),
                                 POINTER(DATA_BLOB),
                                 c_void_p,
                                 POINTER(CRYPTPROTECT_PROMPTSTRUCT),
                                 wintypes.DWORD, POINTER(DATA_BLOB))(
                                     ('CryptUnprotectData', _dll))

# Functions


def encrypt(data, non_interactive=0):
    blobin = DATA_BLOB(cbData=len(data),
                       pbData=cast(c_char_p(data),
                                   POINTER(wintypes.BYTE)))
    blobout = DATA_BLOB()

    if not CryptProtectData(byref(blobin),
                            u('python-keyring-lib.win32crypto'),
                            None, None, None,
                            CRYPTPROTECT_UI_FORBIDDEN,
                            byref(blobout)):
        raise OSError("Can't encrypt")

    encrypted = create_string_buffer(blobout.cbData)
    memmove(encrypted, blobout.pbData, blobout.cbData)
    windll.kernel32.LocalFree(blobout.pbData)
    return encrypted.raw


def decrypt(encrypted, non_interactive=0):
    blobin = DATA_BLOB(cbData=len(encrypted),
                       pbData=cast(c_char_p(encrypted),
                                   POINTER(wintypes.BYTE)))
    blobout = DATA_BLOB()

    if not CryptUnprotectData(byref(blobin),
                              u('python-keyring-lib.win32crypto'),
                              None, None, None,
                              CRYPTPROTECT_UI_FORBIDDEN,
                              byref(blobout)):
        raise OSError("Can't decrypt")

    data = create_string_buffer(blobout.cbData)
    memmove(data, blobout.pbData, blobout.cbData)
    windll.kernel32.LocalFree(blobout.pbData)
    return data.raw

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
Gnome.py File 4.39 KB 0644
Google.py File 12.12 KB 0644
Windows.py File 5.75 KB 0644
__init__.py File 0 B 0644
_win_crypto.py File 3.39 KB 0644
file.py File 7.54 KB 0644
file_base.py File 6.57 KB 0644
keyczar.py File 2.88 KB 0644
multi.py File 2.14 KB 0644
pyfs.py File 9.69 KB 0644